Ignore Feature Colors Example (VBA)
This example shows how to change a user preference option so that feature
colors are ignored in parts. This option setting, swIgnoreFeatureColors,
can be TRUE or FALSE and can be different for each document. It is not
a system-level setting; it is a document-level setting. Therefore, you
must set this value for each document.
By default, when a document is created, swIgnoreFeatureColors
is FALSE. Document-level user preferences are changed using IModelDoc2::SetUserPreference*.
'------------------------------------------------------------
Option Explicit
Dim swApp As SldWorks.SldWorks
Dim Part As SldWorks.ModelDoc2
Dim res, val As Boolean
Dim msg1 As String
Const swUseFolderSearchRules =
0
Const swDisplayArcCenterPoints
= 1
Const swDisplayEntityPoints = 2
Const swIgnoreFeatureColors = 3
Sub UserOptions()
Set swApp =
CreateObject ("SldWorks.Application")
Set Part = swApp.ActiveDoc
If Part Is Nothing
Then
Exit Sub
End If
val = Part.GetUserPreferenceToggle( swIgnoreFeatureColors
)
msg1 = "Ignore
Feature Color is currently set to " & val
swApp.SendMsgToUser msg1
swApp.SendMsgToUser "Setting swIgnoreFeatureColors
to TRUE"
res = Part.SetUserPreferenceToggle (swIgnoreFeatureColors,
TRUE)
If (res = TRUE)
Then
swApp.SendMsgToUser "Setting made successfully"
Else
swApp.SendMsgToUser "Error! Setting was
unsuccessful!"
End If
End Sub