Dynamically Mirror Sketch Entities Example (VBA)
This example shows how to enable dynamic sketch mirroring.
'---------------------------------------------
'
' Preconditions: Sketch is active.
'
' Postconditions:
' (1)
Linear sketch segment is created and selected.
' (2)
Sketch mode changes to dynamic sketch mirror mode.
'
'----------------------------------------------
Option Explicit
Dim
swApp As
SldWorks.SldWorks
Dim
swModel As
SldWorks.ModelDoc2
Dim
swSkMgr As
SldWorks.SketchManager
Dim
swSketch As
SldWorks.Sketch
Dim
swSketchSegment As
SldWorks.SketchSegment
Dim
swSelMgr As
SldWorks.SelectionMgr
Dim
swSelData As
SldWorks.SelectData
Dim
bRet As
Boolean
Sub main()
Set
swApp = Application.SldWorks
Set
swModel = swApp.ActiveDoc
Set
swSelMgr = swModel.SelectionManager
Set
swSelData = swSelMgr.CreateSelectData
Set
swSketch = swModel.GetActiveSketch2
Set
swSketchSegment = swModel.CreateLine2(0,
0, 0, 1, 1, 1)
bRet
= swSketchSegment.Select4(True,
swSelData)
Set
swSkMgr = swModel.SketchManager
swSkMgr.SetDynamicMirror (True)
' Now ready to interactively dynamically mirror sketch
entities
End Sub