CAD+ Toolset | Utilities for SOLIDWORKS automation
SOLIDWORKS utilities for improving your productivity in SOLIDWORKS. Automate properties, geometry, export and much more

Download Buy

CAD+ Toolset extensibility via COM API


Several module of CAD+ Toolset expose COM APIs which enables the automation via COM (e.g. from VBA macros) from SOLIDWORKS.

All COM APIs are available in the type library CadPlusSwAddInComAPI.tlb (CAD+ COM API for SOLIDWORKS) in the installation folder of CAD+ Toolset.

In order to connect to the CAD+ COM API use the following code:

Set swApp = Application.SldWorks

Dim swCadPlus As ICadPlusSwAddIn
    
Dim swCadPlusFact As CadPlusSwAddInFactory
Set swCadPlusFact = New CadPlusSwAddInFactory

Set swCadPlus = swCadPlusFact.Create(swApp, True)

Second parameter of CadPlusSwAddInFactory::Create allows to load CAD+ Toolset automatically if not loaded

BOM+

Access the BOM+ API via ICadPlusSwAddIn::Bom which returns IBomModuleCom.

  • bool ItemsEnvironmentEnabled { get; set; } Gets or sets the item environment
  • IBomTemplateCom[] GetTemplates() Returns the installed templates
  • IBomItemCom BuildBom(IModelDoc2 model, string confName) Builds the BOM from the specified model and configuration
  • void Export(IBomItemCom item, IBomTemplateCom template, string filePath, bool includeRoot) Exports BOM to the nominated file with the specified template

Explore BOM+ COM API automation examples here

Flat Pattern Export

Access the BOM+ API via ICadPlusSwAddIn::FlatPatternExport which returns IFlatPatternExportModuleCom.

  • IFlatPatternExportResult[] BatchExportFlatPatterns(IModelDoc2 model, ref IFlatPatternExportDataCom[] exportData) Batch exports flat patterns with the specified export data

Explore Flat Pattern Export COM API automation examples here

QR Code

Access the QR Code API via ICadPlusSwAddIn::QrCode which returns IQrCodeModuleCom.

  • IQrCodeElementCom Insert(IDrawingDoc drw, ISheet sheet, QrCodeDockCom_e dock, double size, double offsetX, double offsetY, string expression, bool allowExpressionErrors) Inserts QR Code element
  • IQrCodeElementCom GetQrCode(IDrawingDoc drw, ISketchPicture qrCodePicture) Gets QR Code element from the sketch picture
  • IQrCodeElementCom[] IterateQrCodes(IDrawingDoc drw) Iterates QR Code elements in the drawing

Explore QR Code COM API automation examples here


Product of Xarial Product of Xarial