- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I am writing a macro that inserts the sketch symbol, but after inserting the symbol does not stick to the line, it can be dragged anywhere. I want it to stick to the line. Can you help me?
Sub TEST()
Dim oDoc As DrawingDocument
Set oDoc = ThisApplication.ActiveDocument
Dim oSheet As sheet
Set oSheet = oDoc.ActiveSheet
Dim xPos As Double
Dim yPos As Double
Dim oLine As Object
Set oLine = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kAllEntitiesFilter, "Pick a line")
xPos = oLine.StartPoint.x
yPos = oLine.StartPoint.y
Dim oSketchedSymbolDef As SketchedSymbolDefinition
Set oSketchedSymbolDef = oDoc.SketchedSymbolDefinitions.Item("MySymbol")
Dim oTG As TransientGeometry
Set oTG = ThisApplication.TransientGeometry
Dim oSketchedSymbol As SketchedSymbol
Set oSketchedSymbol = oSheet.SketchedSymbols.Add _
(oSketchedSymbolDef, oTG.CreatePoint2d(xPos, yPos), 0, 1)
End Sub
Solved! Go to Solution.