Message 1 of 4
Auto number sketched symbols
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I am looking for an iLogic code that will allow users to select multiple sketched symbols and automatically number them and insert as a text box into the drawing.
This is the ideal:
e.g.The predefined sketched symbols are contained in a separate drawing file (which is within the shared sketched symbol library:
"\Inventor Data (MAC)\Design_Data\Symbol Library\General Symbols.idw"
I found a code snippet here that allows the single insertion of a sketched symbol but not multiple at once and without any automatic numbering.
Sub Main() 'Query stamp insertion requirement oDrawDoc = ThisDoc.Document question = MessageBox.Show("Do you want to insert a stamp?", "Stamp Requirement", MessageBoxButtons.YesNo, MessageBoxIcon.Question) If question = vbYes Then Dim strSelectedStamp As String = "Result2" Dim strStampList As New ArrayList strStampRequired = True 'strStampList.Add("F&C Stamp Round") 'strStampList.Add("As-Built Stamp Round") 'strStampList.Add("Test") 'strSelectedStamp = InputListBox("Please select a stamp.", strStampList, strSelectedStamp, "Stamp Selection", "Available Stamps") Dim strDrawDoc As Inventor.DrawingDocument = ThisApplication.ActiveDocument Dim SourceFile1 As String = "\\vpfs1\Inventor Data (MAC)\Design_Data\Symbol Library\General Symbols.idw" Dim strSourceIDW As DrawingDocument strSourceIDW = ThisApplication.Documents.Open(SourceFile1, 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) If MsgBox("Would you like to place the stamp on the drawing?", MsgBoxStyle.YesNo, "Insert Stamp") = MsgBoxResult.Yes Then 'Insert stamp if required 'InsertSymbol(symbolDef.Name) Dim oSketchedSymbolDef As SketchedSymbolDefinition _ = oDrawDoc.SketchedSymbolDefinitions.Item(strSelectedStamp) Dim oSheet As Sheet = oDrawDoc.ActiveSheet 'create insertion point, coordinates - in cm ! Dim oTG As TransientGeometry = ThisApplication.TransientGeometry Dim oInsertionPoint As Point2d = oTG.CreatePoint2d(10, 10) ' 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) End If End If Next strSourceIDW.Close() End If End Sub
Any help?
Dan Machen
Autodesk Inventor 2019 Certified Professional
Did you find this reply helpful ? If so please use the Accept as Solution or Kudos button below.
Ideas that need support:
Circular / Rectangular Point Matrix
Allow Axis & Plane Selection on Rectangular / Circular pattern
Graphical iLogic Programming
Autodesk Inventor 2019 Certified Professional
Did you find this reply helpful ? If so please use the Accept as Solution or Kudos button below.
Ideas that need support:
Circular / Rectangular Point Matrix
Allow Axis & Plane Selection on Rectangular / Circular pattern
Graphical iLogic Programming