Announcements
Due to scheduled maintenance, the Autodesk Community will be inaccessible from 10:00PM PDT on Oct 16th for approximately 1 hour. We appreciate your patience during this time.
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: 

iLogic Attaching Sketch Symbol To Feature Control Frame

0 REPLIES 0
Reply
Message 1 of 1
greg.szkilnyk
67 Views, 0 Replies

iLogic Attaching Sketch Symbol To Feature Control Frame

Hello all,

 

I am trying to create some iLogic to automatically attach a specific Sketch Symbol to all feature control frames in a drawing (in Inventor 2017).  I can place the symbol 'near' the FCF but can't actually successfully attach a leader to any Geometry Intent on the FCF object (so any relocation of the FCF will bring the Sketch Symbol along with it).  The code is below.  The program crashes when adding the leader.

 

Dim oDoc As DrawingDocument
oDoc = ThisApplication.ActiveDocument
Dim oSht As Inventor.Sheet
oSht = oDoc.ActiveSheet

Dim oLeaderPoints As ObjectCollection
oLeaderPoints = ThisApplication.TransientObjects.CreateObjectCollection
Dim oGeometryIntent As GeometryIntent
Dim oTG As TransientGeometry
oTG = ThisApplication.TransientGeometry
Dim originPt As Point2d
Dim fcf As FeatureControlFrame
'Add inspection bubble symbol from library (will not crash if symbol already added)
Dim oSketchSymLib As SketchedSymbolDefinitionLibrary
oSketchSymLib = oDoc.SketchedSymbolDefinitions.SketchedSymbolDefinitionLibraries.Item("KTR Inspection Sketch Symbols")
Dim oSymDef As SketchedSymbolDefinition
oSymDef = oDoc.SketchedSymbolDefinitions.AddFromLibrary(oSketchSymLib, "Dimension Balloon", True)

For Each fcf In oSht.FeatureControlFrames
If fcf.Notes = "" Then ' Change to check for balloons
While existingInspNums.Contains(dimCtr) = True
dimCtr = dimCtr + 1
End While
sPromptStrings(0) = CStr(dimCtr)
oSymbol = oSht.SketchedSymbols.Add(oSymDef, oTG.CreatePoint2d(fcf.Position.X,fcf.Position.Y+1.2), 0, 1, sPromptStrings)
originPt = oTG.CreatePoint2d(oSymbol.Position.X,oSymbol.Position.Y)
oGeometryIntent = oSht.CreateGeometryIntent(fcf,fcf.Position)
oLeaderPoints.Clear
oLeaderPoints.Add(originPt)
oLeaderPoints.Add(oGeometryIntent)
oSymbol.Leader.AddLeader(oLeaderPoints) 'Program crashes on this line
oSymbol.LeaderVisible = False
dimCtr = dimCtr + 1
End If
Next

   

0 REPLIES 0

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

Post to forums  

Autodesk Design & Make Report