Created by: gwideman, Aug 13, 2012 7:25 pm
Revised by: gwideman, Aug 13, 2012 7:25 pm (1 revisions)

Overview

This page discusses the PrintDriver component of the Lasercut software. PrintDriver is more or less the same functionality as the Lasercut application (minus drawing editing), but packaged as a DLL with a minimal COM Automation interface. That interface allows PrintDriver to act as an addin for other applications like CorelDRAW, and thereby provide a way to output "direct" from CorelDRAW to the laser cutter.

COM Automation interface

Here is the COM Automation API for PrintDriver. (In IDL format -- for easier reading I have removed all the annotations and most of the UUIDs etc).
// Generated .IDL file (by the OLE/COM Object Viewer)
//
// typelib filename: PrintDriver.dll
 
[
  uuid(D62889E7-EAC8-4D53-907B-E893D004E069),
  version(1.0),
  helpstring("LaserPrintDriver 1.0 Type Library"),
  custom(DE77BA64-517C-11D1-A2DA-0000F8773CE9, 83951780),
  custom(DE77BA63-517C-11D1-A2DA-0000F8773CE9, 1298106658)
 
]
library LASERPRINTDRIVERLib
{
    // TLib :     // TLib : OLE Automation : {00020430-0000-0000-C000-000000000046}
    importlib("stdole2.tlb");
 
    // Forward declare all types defined in this typelib
    interface ILaserPrint;
    interface IComImportData;
    dispinterface _ISimLaserCmdEvents;
    interface ISimLaserCmd;
 
    coclass LaserPrint {
        [default] interface ILaserPrint;
    };
 
    interface ILaserPrint : IDispatch {
        HRESULT Show(
                        [in] long nHwnd,
                        [in] VARIANT_BOOL nShowType);
        HRESULT SetProjectFileName([in] BSTR bstrProjectFileName);
        HRESULT GetLaserPrintStatues([out, retval] int* nStatues);
        HRESULT ConfigeMachine();
        HRESULT ExitInstance();
        HRESULT ExportTechnicsFile();
        HRESULT CheckDog([out, retval] int* nStatues);
        HRESULT CheckPermitRefreshData(
                        [in] BSTR bstrProjectFileName,
                        [out, retval] int* nStatues);
        HRESULT GetTableWidth([out, retval] double* fWidth);
        HRESULT GetTableHeight([out, retval] double* fHeight);
    };
 
    coclass ComImportData {
        [default] interface IComImportData;
    };
 
    interface IComImportData : IDispatch {
        HRESULT ImportLaserData([out] BSTR* bstrFileName);
    };
 
    dispinterface _ISimLaserCmdEvents {
        properties:
        methods:
    };
 
    coclass SimLaserCmd {
        [default] interface ISimLaserCmd;
        [default, source] dispinterface _ISimLaserCmdEvents;
    };
 
    interface ISimLaserCmd : IDispatch {
        HRESULT StopSim();
        HRESULT SetAutoSimSpeed([in] long speed);
        HRESULT ComputeWorkTime([out] long* nWorkTime);
    };
};
 
Notes:
  • "Statues" presumably should be "Status" or possible "Statuses"

Comments

The provided interfaces are sufficient to invoke the PrintDriver UI, have it load and display a file (for example, in AI format), and run a simulation of the cut path.
However, the API does not appear to provide any functionality with which to automatically fill in the associations of color to laser power and speed. Nor is there any API for actually compiling the drawing to cutter commands, and sending it to the cutter. Lacking these APIs, these tasks must be carried out manually by the user.