API: How to export an assembly component to a Parasolid file (VBA, VB.NET, C#)

Version 4

    This example shows how to export a selected assembly component to a Parasolid file.


    Problem statement:

    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.


    1. Extract the archive in a convenient location.
    2. Open an assembly.
    3. Select a component in the main assembly or one of its sub-assemblies.
    4. 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.


    - Subscription Services 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.