Macro to toggle the scroll item into view option in SOLIDWORKS documents

Edit ArticleEdit Article
More 'Goodies'

Scroll selected item into view option in SOLIDWORKS settings
Scroll selected item into view option in SOLIDWORKS settings

This VBA macro allows to toggle on and off the 'Scroll selected item into view' option in FeatureManager section of SOLIDWORKS settings. This provides performance benefits when working with models with large feature tree (e.g. Large Assembly Documents). Turning off this option will significantly improve the speed of selecting items in the graphics area as Feature Tree does not need to be scrolled into the view.

Using macro in Toolbar+

This macro can be used in Toolbar+ which will improve the user experience. It is possible to enable the toggle state for the macro button.

Paste this code into the "Toggle Button State Code" text box:

Return CType(Application, Object).Sw.GetUserPreferenceToggle(64)

Code for handling the state of the toggle button
Code for handling the state of the toggle button

Dim swApp As SldWorks.SldWorks

Sub main()

    Set swApp = Application.SldWorks
    
    Dim curVal As Boolean
    curVal = False <> swApp.GetUserPreferenceToggle(swUserPreferenceToggle_e.swFeatureManagerEnsureVisible)
    
    swApp.SetUserPreferenceToggle swUserPreferenceToggle_e.swFeatureManagerEnsureVisible, Not curVal
    
End Sub

Product of Xarial Product of Xarial