Files
Lesson 3.5 homework solution
Code
'Homework 3.5
'Write a macro that switches between a "high performance" and "low performance" mode by _
controlling these properties: _
-System Options-->Performance-->Update mass properties while saving document _
-Document Properties-->Image Quality-->Shaded and draft quality HLR/HLV resolution _
During the "low performance mode", the first option should be toggled off and the second _
option should be on the "coarse" setting. _
During the "high performance mode", the first option should be toggled on and the second _
option should be on the "fine" setting.
Dim swApp As SldWorks.SldWorks
Dim swModel As SldWorks.ModelDoc2
Sub main()
Set swApp = Application.SldWorks
Set swModel = swApp.ActiveDoc
If swApp.GetUserPreferenceToggle _
(swUserPreferenceToggle_e.swUpdateMassPropsDuringSave) = 1 Then
swApp.SetUserPreferenceToggle _
swUserPreferenceToggle_e.swUpdateMassPropsDuringSave, False
swModel.Extension.SetUserPreferenceInteger _
swUserPreferenceIntegerValue_e.swImageQualityShaded, _
swUserPreferenceOption_e.swDetailingNoOptionSpecified, _
swImageQualityShaded_e.swShadedImageQualityCoarse
Else
swApp.SetUserPreferenceToggle _
swUserPreferenceToggle_e.swUpdateMassPropsDuringSave, True
swModel.Extension.SetUserPreferenceInteger _
swUserPreferenceIntegerValue_e.swImageQualityShaded, _
swUserPreferenceOption_e.swDetailingNoOptionSpecified, _
swImageQualityShaded_e.swShadedImageQualityFine
End If
End Sub