This example shows how to export a selected assembly component to a Parasolid file.
Exporting a part from an assembly is usually a matter of traversing the assembly and calling ModelDocExtension::SaveAs with the appropriate file extension. However, this will export a file using the last-used configuration and not the configuration as used in the context of the assembly. Furthermore, this does not take into account assembly-level or in-context features.
The solution is to create a temporary part, add the body from the assembly component, and export the part from the temporary part.
- Extract the archive in a convenient location.
- Open an assembly.
- Select a component in the main assembly or one of its sub-assemblies.
- Run the macro (VBA, VB.NET, or C#) in the SolidWorks Macro Editor.
A Parasolid file is saved to the current directory, overwriting any existing file.
|- required for full access.|
- Looking for more API Examples?
Copyright © 2011 Dassault Systèmes SolidWorks Corp. All rights reserved.
Do not distribute or reproduce without the written consent of Dassault Systèmes SolidWorks Corp.