Brandon Massoni

Stop display states from making really large part file

Discussion created by Brandon Massoni on May 21, 2015
Latest reply on May 22, 2015 by Keith Rice

If you create or delete a lot of configurations in a macro, the part file will get tremendously large. If you don't care about hidden elements (suppressed is okay), you should delete display states to keep the file size controlled. Example: I manually deleted the display states and my part went from 70MB to 2 MB!

 

Here is how to do it inside a macro,

 

Dim swApp As SldWorks.SldWorks

Dim swModel As SldWorks.ModelDoc2

Dim swPart As SldWorks.PartDoc

 

Sub main()

 

    Set swApp = Application.SldWorks

    Set swModel = swApp.ActiveDoc

    Set swPart = swModel

 

    swPart.RemoveAllDisplayStates

End Sub

Outcomes