Is it possible to Duplicate a sketched symblol in a drawing?
Like this
Copy Sketched symbol("TheName")
Paste Sketched symbol("TheName") as Sketched symbol("TheName-2")
Or when i use this to add "TheName" to the drawing, give it the name "TheName-2" and so on..
SyntaxEditor Code Snippet
Dim oDrawDoc As DrawingDocument = ThisDrawing.Document Dim oSketchedSymbolDef As SketchedSymbolDefinition _ = oDrawDoc.SketchedSymbolDefinitions.Item("TheName") Dim oTG As TransientGeometry = ThisApplication.TransientGeometry Dim oInsertionPoint As Point2d = oTG.CreatePoint2d(strFormat(iFormatPos,1), strFormat(iFormatPos,2)) Dim oSketchedSymbol As SketchedSymbol _ = oSheet.SketchedSymbols.Add( _ oSketchedSymbolDef, _ oInsertionPoint, _ 0, 1, Nothing)
Solved! Go to Solution.
Solved by prakasht66. Go to Solution.
Hi ,
I think this would be helpful for your requirement .
Sub CopyoSketchedSymbol()
Dim oDocument As Document
Set oDocument = ThisApplication.ActiveDocument
Dim oDrawDoc As DrawingDocument
Dim oSheet As Sheet
Set oDrawDoc = ThisApplication.ActiveDocument
Set oSheet = oDrawDoc.ActiveSheet
Dim oSketchedSymbolDef As SketchedSymbolDefinition
Set oSketchedSymbolDef = oDrawDoc.SketchedSymbolDefinitions.Item("TheName")
Dim oSketchedSymbolDefNew As SketchedSymbolDefinition
Set oSketchedSymbolDefNew = oSketchedSymbolDef.CopyTo(oDrawDoc, False)
Dim symbolNewName As String
symbolNewName = oSketchedSymbolDefNew.Name
symbolNewName = Replace(oSketchedSymbolDefNew.Name, "Copy of", "")
oSketchedSymbolDefNew.Name = symbolNewName & "-2"
Dim oPoint As Point2d
Set oPoint = ThisApplication.TransientGeometry.CreatePoint2d(oSheet.Width / 2, oSheet.Height / 2)
Dim sPromptStrings(0) As String
sPromptStrings(0) = "A"
Dim oSketchedSymbol As SketchedSymbol
Set oSketchedSymbol = oSheet.SketchedSymbols.Add(oSketchedSymbolDefNew, oPoint, 0, 1, sPromptStrings)
End Sub