Activate SOLIDWORKS Inspection
To use the SOLIDWORKS Inspection add-in API, you must first:
- Install SOLIDWORKS Professional or Premium 2022 (or later).
- Install SOLIDWORKS Inspection 2022 (or later) with a valid license key.
- Activate the SOLIDWORKS Inspection add-in from SOLIDWORKS Tools > Add-Ins....
After activation, you can access the user-interface help for SOLIDWORKS Inspection by selecting Tools > SOLIDWORKS Inspection > Help and Quick Start Tour. See how SOLIDWORKS Inspection works in the user interface before trying to balloon drawings using the SOLIDWORKS Inspection APIs.
How to balloon a drawing using the SOLIDWORKS Inspection APIs
- Refer to the Examples in IInspectionAddinMgr.
- Get the IInspectionMgr add-in object.
Read Accessing SOLIDWORKS Add-in Objects to determine GUID or ProgID of the SOLIDWORKS Inspection add-in.
For example in VBA,
...
Dim inspectionMgr As SwInspectionAddin.InspectionAddinMgr
Set progID = "Inspection.ExtSwAddin"
Set inspectionMgr = SwApp.GetAddInObject(progID)
- Create inspection project data.
Dim projData As SwInspectionAddin.InspectionProjectData
Set projData = inspectionMgr.CreateInspectionProjectData
'Specify properties in projData, e.g.,
projData.AutoBalloon = True
projData.StartNumber = 1
projData.IncludeNotes = True
projData.NotesAutoExplode = True
projData.Extraction = swiCharacteristicInfoExtraction_e.swiExtraction_Automatic
- Balloon the drawing by creating an inspection project based on an inspection template and project data.
Templates are located in install_drive:\ProgramData\SOLIDWORKS\SolidWorks Inspection yyyy Addin\Templates.
Dim inspectionProj As SwInspectionAddin.InspectionProject
Set inspectionProj = inspectionMgr.CreateInspectionProject("dir_name\template_name.swidot", projData)
How to modify the Bill of Characteristics
All of the inspection characteristics that you extracted during creation of the inspection project appear in a Bill of Characteristics.
Modifying Characteristics
After the model is ballooned, you can add/edit characteristics using:
inspectionMgr.AddCharacteristics(annotationArray)
inspectionMgr.GetCharacteristicIDs
Set charData = inspectionMgr.GetCharacteristicsData(charID)
inspectionMgr.EditCharacteristic(charID, charData)
Exploding Characteristics
You can separate characteristics into multiple instances whenever charData.Quantity >= 1 by setting:
projData.CreateForEachInstance = True
How to add/edit balloons
Adding/Editing
If you set projData.AutoBalloon to false, you can manually add inspection balloons.
Set aBalloonSettingsObject = inspectionMgr.GetBalloonSettings
'Specify the offsets and/or properties in the aBalloonSettingsObject.
Call inspectionMgr.AddOrEditBalloons(aBalloonSettingsObject)
Removing
You can remove all balloons from the document.
Call inspectionMgr.RemoveBalloons
Selecting
You can select all balloons in the document.
Call inspectionMgr.SelectBalloons
How to add customizations to the inspection report
Manage vendor, operation, and inspection method lists to fit company requirements by using:
How to publish and export inspection reports using the SOLIDWORKS Inspection APIs
After you finish ballooning the drawing, you can export the inspection report in a variety of file types: