Hello, I'm developing a macro for solidworks and I can't find the command line that fulfills the function of the " toggle view " button when I click on the view in the unfolded state (to allow me to reverse the direction of the folds)
Anyone have an idea?
Yes, that's right, I can confirm that.
Another possibility is to check the symmetrical view according to your needs:
'Cocher Symétrie de la vue horizontal
Dim mirrored As Boolean
Dim orientation As Long
swView.SetMirrorViewOrientation True, swMirrorViewPositions_e.swMirrorViewPosition_Horizontal
swView.GetMirrorViewOrientation mirrored, orientation
Debug.Print "Mirrored? " & mirrored
Debug.Print "Orientation (0 = horizontal)? " & orientation

1 Like
Hello sbadenis,
Excellent information, it works perfectly.
For those who would be interested, here is the complete code:
Option Explicit
Dim swApp As Object
Dim swModel As SldWorks.ModelDoc2
Dim swDraw As SldWorks.DrawingDoc
Dim swView As SldWorks.View
Sub main()
Set swApp = Application.SldWorks
Set swModel = swApp.ActiveDoc
Set swDraw = swModel
Set swView=swDraw.GetFirstView' selects the page
Set swView=swView.GetNextView' selects the first view
'Check Horizontal View Symmetry
Dim mirrored As Boolean
Dim orientation As Long
swView.SetMirrorViewOrientation True, swMirrorViewPositions_e.swMirrorViewPosition_Horizontal
swView.GetMirrorViewOrientation mirrored orientation
Debug.Print "Mirrored?" " & mirrored
Debug.Print "Orientation (0 = horizontal)? " & orientation
End Sub
@Thierry_ARNOULD ...
Consider assigning the " Best Answer " to @sbadenis ... " because he is worth it"...


1 Like
Thank you @maclane for once I don't need to pay you royalties on your favorite image!
1 Like