Hi everyone,
i have a problem and i hope someone can help me,
I use an ilogic rule to insert a sketch symbol in a certain position, and it works but only if I choose the symbol, I would like to remove the choice and insert the symbol directly, can anyone help me?
Thank you all
Dim strStampList As New ArrayList
strStampRequired = True
strStampList.Add("My symbol")
strSelectedStamp = InputListBox("Please select a stamp.", strStampList, strSelectedStamp, "Stamp Selection", "Available Stamps")
Dim strDrawDoc As Inventor.DrawingDocument = ThisApplication.ActiveDocument
Dim oSymbolName As String
oSymbolName = "My symbol"
Dim SourceFile As String = "N:\Inventor 2022\Design Data\Symbol Library\Simboli.idw"
Dim strSourceIDW As DrawingDocument
strSourceIDW = ThisApplication.Documents.Open(SourceFile, False)
Dim symbolDef As SketchedSymbolDefinition
For Each symbolDef In strSourceIDW.SketchedSymbolDefinitions
strStampList.Add(symbolDef.Name)
Next
'strSelectedStamp = InputListBox("Please select a stamp.", strStampList, strSelectedStamp, "Stamp Selection", "Available Stamps")
For Each symbolDef In strSourceIDW.SketchedSymbolDefinitions
If (StrComp(symbolDef.Name, strSelectedStamp, vbTextCompare) = 0) Then
CopyFrom = symbolDef.CopyTo(strDrawDoc, True)
End If
Next
strSourceIDW.Close()
'End If
Dim oDrawDoc As DrawingDocument = ThisDrawing.Document
' Obtain a reference to the desired sketched symbol definition.
'Dim oSketchedSymbolDef As SketchedSymbolDefinition _
' = oDrawDoc.SketchedSymbolDefinitions.Item("Nome file + percorso")
'Dim oSymbolName As String
oSymbolName = "My symbol"
Dim oDoc As DrawingDocument
oDoc = ThisApplication.ActiveDocument
'get the symbol definition to use
Dim oSketchedSymbolDef As SketchedSymbolDefinition
oSketchedSymbolDef = oDoc.SketchedSymbolDefinitions.Item(oSymbolName)
Dim oSheet As Sheet = oDrawDoc.ActiveSheet
'create insertion point, coordinates - in cm !
Dim oTG As TransientGeometry = ThisApplication.TransientGeometry
Dim oInsertionPoint As Point2d = oTG.CreatePoint2d(3, 0.5)
' Add an instance of the sketched symbol definition to the sheet.
' Rotate angle = 0 radians,
' scale = 1 when adding
' no prompt text
Dim oSketchedSymbol As SketchedSymbol _
= oSheet.SketchedSymbols.Add( _
oSketchedSymbolDef, _
oInsertionPoint, _
0, 1, Nothing)