AnsweredAssumed Answered

how to use the ViewDispRefPoints api

Question asked by Derek Eldridge on Nov 6, 2015

I'm just a user, not a developer. My visual basic understanding is minimal, but i've been able to use examples to create a few macros.

I'm trying to create a macro to turn off all of the View references. I DO NOT want to use the Hide all Types toggle. It aggravates me to go back to View/Hide all Types, then turn off all the individuals that i still don't want.

I used the "SetUserPreferenceToggle" to set all of the following:

     HideAll = False

     Planes = False

     Axes = False

     COORDINATE_SYSTEMS = False

     POINTS = False

     Curves = False

     SKETCH_DIMENSIONS_3D = False

     ALL_ANNOTATIONS = False

     SKETCHES = False

     LIVE_SECTION_PLANES = False

     ROUTING_POINTS = False

 

This is what i have so far:

Sub main()

 

    Dim swApp                       As SldWorks.SldWorks

    Dim swModel                     As SldWorks.ModelDoc

    Dim Output                      As Boolean

    Dim HideAll                     As Boolean

    Dim Planes                      As Boolean

    Dim Axes                        As Boolean

    Dim COORDINATE_SYSTEMS          As Boolean

    Dim POINTS                      As Boolean

    Dim Curves                      As Boolean

'    Dim PARTING_LINES               As Boolean

    Dim SKETCH_DIMENSIONS_3D        As Boolean

    Dim ALL_ANNOTATIONS             As Boolean

    Dim SKETCHES                    As Boolean

    Dim LIVE_SECTION_PLANES         As Boolean

    Dim ROUTING_POINTS              As Boolean

'    Dim CENTER_OF_MASS              As Boolean

 

     HideAll = False

     Planes = False

     Axes = False

     COORDINATE_SYSTEMS = False

     POINTS = False

     Curves = False

'     PARTING_LINES = False

     SKETCH_DIMENSIONS_3D = False

     ALL_ANNOTATIONS = False

     SKETCHES = False

     LIVE_SECTION_PLANES = False

     ROUTING_POINTS = False

'     CENTER_OF_MASS = False

    ViewDispRefPoints = False

        

    Set swApp = Application.SldWorks

    Set swModel = swApp.ActiveDoc

   

    Output = swModel.SetUserPreferenceToggle(swViewDisplayHideAllTypes, HideAll): Debug.Assert Output

    Output = swModel.SetUserPreferenceToggle(swDisplayPlanes, Planes): Debug.Assert Output

    Output = swModel.SetUserPreferenceToggle(swDisplayAxes, Axes): Debug.Assert Output

    Output = swModel.SetUserPreferenceToggle(swDisplayTemporaryAxes, Axes): Debug.Assert Output

    Output = swModel.SetUserPreferenceToggle(swDisplayCoordSystems, COORDINATE_SYSTEMS): Debug.Assert Output

    Output = swModel.SetUserPreferenceToggle(swDisplayReferencePoints, POINTS): Debug.Assert Output

    Output = swModel.SetUserPreferenceToggle(swDisplayCurves, Curves): Debug.Assert Output

'    Output = swModel.SetUserPreferenceToggle(swDisplayPartingLines, PARTING_LINES): Debug.Assert Output

    Output = swModel.SetUserPreferenceToggle(swDisplaySketches, SKETCH_DIMENSIONS_3D): Debug.Assert Output

    Output = swModel.SetUserPreferenceToggle(swDisplayAllAnnotations, ALL_ANNOTATIONS): Debug.Assert Output

    Output = swModel.SetUserPreferenceToggle(swDisplaySketches, SKETCHES): Debug.Assert Output

    Output = swModel.SetUserPreferenceToggle(swDisplayLiveSections, LIVE_SECTION_PLANES): Debug.Assert Output

    Output = swModel.SetUserPreferenceToggle(swDisplayRoutePoints, ROUTING_POINTS): Debug.Assert Output

'    Output = swModel.SetUserPreferenceToggle(swDisplayCenterOfMass, CENTER_OF_MASS): Debug.Assert Output

   

End Sub

 

There are still quite a bit of things left on the list that are not covered under the "SetUserPreferenceToggle", or that are and did not seem to work.

Untitled.png

View Origins

View Points

View Parting Lines

View 3D Sketch Plane

View Sketch Relations

View Grid

View Lights

View Cameras

View Decals

View Dimension Names

View Weld Beads

View Center Of Mass

 

I found that in particular View reference points is covered under "ViewDispRefPoints" and the API doc says it the following:

Visual Basic (Declaration)
Sub ViewDispRefPoints() 
Visual Basic (Usage)
Dim instance As IModelDoc2   instance.ViewDispRefPoints()

Also under iModelDoc2 I found:

ViewDispCoordinateSystem

ViewDispOrigins

ViewDispRefaxes

ViewDispRefplanes

ViewDispRefPoints

ViewDispTempRefaxes

But I don't understand how to use them. Does this mean it's a function? If someone could give me a sample of how to use it in context, I think it would help alot.

 

The only sample i have is from another macro that uses the following:

 

Dim swApp As Object

Dim Part As Object

Sub main()

Set swApp = Application.SldWorks

Set Part = swApp.ActiveDoc

Part.ViewZoomtofit2

End Sub

 

Are those DIMs essentially building a path so the final command like this:

Application.SldWorks.ActiveDoc.ViewZoomtofit2

Outcomes