Hide Table of Contents

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  

 

' Constant enumerators

Const swDisplayArcCenterPoints = 1

Const swDisplayEntityPoints = 2

Const swIgnoreFeatureColors = 3

 

Sub UserOptions()

Set swApp = CreateObject ("SldWorks.Application")

Set Part = swApp.ActiveDoc

 

' Exit if no model is active

If Part Is Nothing Then   

Exit Sub

End If

 

' Get current setting

val = Part.GetUserPreferenceToggle( swIgnoreFeatureColors ) 

' Create message

msg1 = "Ignore Feature Color is currently set to " & val  

' Send message to user

swApp.SendMsgToUser msg1       

 

' Change setting to TRUE, which indicates to ignore feature colors

swApp.SendMsgToUser "Setting swIgnoreFeatureColors to TRUE" 

res = Part.SetUserPreferenceToggle (swIgnoreFeatureColors, TRUE)

 

' Verify if successful

If (res = TRUE) Then        

swApp.SendMsgToUser "Setting made successfully"

Else

swApp.SendMsgToUser "Error! Setting was unsuccessful!"

End If

 

End Sub

 

 



Provide feedback on this topic

SOLIDWORKS welcomes your feedback concerning the presentation, accuracy, and thoroughness of the documentation. Use the form below to send your comments and suggestions about this topic directly to our documentation team. The documentation team cannot answer technical support questions. Click here for information about technical support.

* Required

 
*Email:  
Subject:   Feedback on Help Topics
Page:   Ignore Feature Colors Example (VBA)
*Comment:  
*   I acknowledge I have read and I hereby accept the privacy policy under which my Personal Data will be used by Dassault Systèmes

Print Topic

Select the scope of content to print:

x

We have detected you are using a browser version older than Internet Explorer 7. For optimized display, we suggest upgrading your browser to Internet Explorer 7 or newer.

 Never show this message again
x

Web Help Content Version: API Help (English only) 2012 SP05

To disable Web help from within SOLIDWORKS and use local help instead, click Help > Use SOLIDWORKS Web Help.

To report problems encountered with the Web help interface and search, contact your local support representative. To provide feedback on individual help topics, use the “Feedback on this topic” link on the individual topic page.