Flip Sketch Picture Example (VBA)
This example shows how to flip a sketch picture.
'--------------------------------------
'
' Preconditions: Sketch picture feature is selected.
'
' Postcondtiions: Sketch picture is flipped,
' if
it hadn't already been flipped.
'
'--------------------------------------
Option Explicit
Dim swApp As SldWorks.SldWorks
Dim swModel As SldWorks.ModelDoc2
Dim swSelMgr As SldWorks.SelectionMgr
Dim swFeat As SldWorks.Feature
Dim swSketchPicture As SldWorks.sketchPicture
Dim boolstatus As Boolean
Dim width As Double
Dim height As Double
Dim x As Double
Dim y As Double
Dim angle As Double
Sub main()
Set swApp = Application.SldWorks
Set swModel = swApp.ActiveDoc
Set swSelMgr = swModel.SelectionManager
' Sketch picture must be selected in the FeatureManager
design tree
Set swFeat = swSelMgr.GetSelectedObject6(1,
-1)
' Get the sketch picture feature
Set swSketchPicture = swFeat.GetSpecificFeature2
Debug.Print "Feature type and name = " &
swFeat.GetTypeName2
boolstatus = swSketchPicture.Flip(False)
Debug.Print " Sketch
picture flipped? " & swSketchPicture.Flipped
swSketchPicture.GetSize
width, height
Debug.Print " Width
= " & width * 1000 & " mm"
Debug.Print " Height
= " & height * 1000 & " mm"
angle = swSketchPicture.angle
Debug.Print " Angle
= " & angle * 57.3 & " degrees"
End Sub