Reverse Order of Decals Example (VBA)
This example shows how to reverse the order of the decals applied on
a model.
'---------------------------------------
'
' Preconditions: Model document is open and
' model
has more than one decal
' applied
on it.
'
' Postconditions: The order of the decals is reversed.
'
'---------------------------------------
Option Explicit
Dim swApp As SldWorks.SldWorks
Dim swModel As SldWorks.ModelDoc2
Dim swModelDocExt As SldWorks.ModelDocExtension
Dim swDecal As SldWorks.Decal
Dim lNbrDecals As Long, i As Long
Dim boolstatus As Boolean
Sub main()
Set swApp = Application.SldWorks
Set swModel = swApp.ActiveDoc
Set swModelDocExt = swModel.Extension
'Get last decal ID
lNbrDecals = swModelDocExt.GetDecalsCount
' Reverse order of decals
boolstatus = swModelDocExt.ReverseDecalsOrder(lNbrDecals)
' Force a rebuild of the model to see the reordered list
of decals
boolstatus = swModel.ForceRebuild3(True)
End Sub