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 to attach Sketch Symbol leader to a Feature Control Frame

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

iLogic to attach Sketch Symbol leader to a Feature Control Frame

Hello,

 

I am trying to create some iLogic to automate the attachment of a sketch symbol to all feature control frames in a drawing.  I am having some issues using a geometry intent with the Feature Control Frame object.  The goal is to place the sketch symbol and attach to the feature control frame so that if the FCF is relocated manually, the symbol follows.  The program crashed in the line that tries to add the sketch symbol leader, see below:

 

 

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

'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)

Dim
oSymbol As SketchedSymbol Dim sPromptStrings(0) As String Dim oPosition As Point2d Dim fcf As FeatureControlFrame dimCtr = 1 Dim oLeaderPoints As ObjectCollection oLeaderPoints = ThisApplication.TransientObjects.CreateObjectCollection Dim oGeometryIntent As GeometryIntent Dim oTG As TransientGeometry oTG = ThisApplication.TransientGeometry Dim originPt As Point2d Dim placePt As Point2d 'Scan all (non-hole) feature control frames and assign inspection bubbles For Each fcf In oSht.FeatureControlFrames If fcf.Notes = "" Then ' Change to check for balloons 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) ' Code crashes here 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