Hi all; The display states poluge my "part" and "asm" files (among other things because of the unfolded, mechanically welded, and each configuration creation (sometimes I forget to uncheck the "link appearances" box)). I found a bit of macro that deletes all display states -except the current one- and unchecks the "Link appearance states to configurations" box
[vb]
Dim swApp As Object
Dim part As Object
Dim boolstatus As Boolean
Dim longstatus As Long
Dim longwarnings As Long
Dim modelDoc As SldWorks.ModelDoc2
Sub main()
Set swApp = Application.SldWorks
Set modelDoc = swApp.ActiveDoc
Set part = swApp.ActiveDoc
boolstatus = modelDoc.RemoveAllDisplayStates
End Sub
[vb]
only this macro only works on parts. Do you know how to modify the code to apply to both parts and assemblies?
Note: keeping in mind that I am a Solidworks macro nozzle....
> Removes all display states and appearances from this part document.
I'll let you see how to use the DeleteDisplayState function in the doc, you have to tell it the name of the display state to be deleted. To do this, you will need to make a loop that retrieves all the display states.