Macro to reverse the direction of a flattening

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?

Well I finally answered my own question, the command is swView.FlipView = True
info found here:Create and Flip Flat-Pattern View of Sheet Metal Part Example (VB) - 2023 - SOLIDWORKS API Help

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

image

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

Thank you very much :pray:

@Thierry_ARNOULD ...
Consider assigning the " Best Answer " to @sbadenis ... " because he is worth it"...
image
:grin:

1 Like

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

1 Like

Ahhhhh! flute, I had forgotten about it... :grin: :moneybag: :moneybag: :moneybag:

1 Like