Assembly components automation using SOLIDWORKS API
Component in SOLIDWORKS assembly is an instance of the model documents (IModelDoc2) in assembly.
Components can be automated via IComponent2 interface available in SOLIDWORKS API.
The main operations on components include, but not limited to:
- In context editing
- BOM composition
Pointer to the underlying document of the component can be retrieved via IComponent2::GetModelDoc2 SOLIDWORKS API method. This method returns null for suppressed or lightweight components. Refer the Get Model Doc For Lightweight Component for code example demonstrating how to retrieve the pointer to all types of components.
Explore this section for code examples and macros of automating assemblies and components.