Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Duplicate or copy as sketched symblol

1 REPLY 1
SOLVED
Reply
Message 1 of 2
johan
325 Views, 1 Reply

Duplicate or copy as sketched symblol

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)
1 REPLY 1
Message 2 of 2
prakasht66
in reply to: johan

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

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report