
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Greetings, I am using Inventor 2016 and Windows7
Attached are the part files I am using to develop this process.
Currently, the code labled "Leaderswithspecificedge" creates a leader on the corner of the edge and not the midpoint of the edge.
So, one would think you need to get the midpoint of the edge right? So it was created about half way down the code.
However, when I use the midpoint it creates a leader that is actually inside the box and not outside.
I removed the second node because it was not necessary.
I have been playing around with the translations on the oLeaderPoints and it now creates what I want. Just needs to be on the midpoint of the line.
Thoughts on how to make this work?
Since this is answers day, might as well ask.
SyntaxEditor Code Snippet
'edge for this view{3,6,9,12} Dim oDrawDoc As DrawingDocument = ThisApplication.ActiveDocument Dim oActiveSheet As Sheet = oDrawDoc.ActiveSheet Dim orefdoc As PartDocument = ThisApplication.Documents.Open("K:\Part1.ipt", False) Dim oDrawingCurvesEnum As DrawingCurvesEnumerator Dim oEdge As Edge = orefdoc.ComponentDefinition.SurfaceBodies.Item(1).Edges.Item(6) Dim oView As DrawingView = oDrawDoc.ActiveSheet.DrawingViews.Item(1) oDrawingCurvesEnum = oView.DrawingCurves(oEdge) Dim oDrawingCurve As DrawingCurve = oDrawingCurvesEnum.Item(1) Dim oMidPoint As Point2d = oDrawingCurve.MidPoint Dim oTG As TransientGeometry = ThisApplication.TransientGeometry Dim oLeaderPoints As ObjectCollection oLeaderPoints = ThisApplication.TransientObjects.CreateObjectCollection ' Create a few leader points. oLeaderPoints.Add(oTG.CreatePoint2d(oMidPoint.X-2.54, oMidPoint.Y+6)) 'oLeaderPoints.Add(oTG.CreatePoint2d(oMidPoint.X+1, oMidPoint.Y + 6)) ' Create an intent and add to the leader points collection. ' This is the geometry that the leader text will attach to. Dim oGeometryIntent As GeometryIntent oGeometryIntent = oActiveSheet.CreateGeometryIntent(oDrawingCurve) oLeaderPoints.Add(oGeometryIntent) ' Create text with simple string as input. Since this doesn't use ' any text overrides, it will default to the active text style. Dim sText As String sText = "API Leader Note" Dim oLeaderNote As LeaderNote oLeaderNote = oActiveSheet.DrawingNotes.LeaderNotes.Add(oLeaderPoints, sText) ' Insert a node. Dim oFirstNode As LeaderNode oFirstNode = oLeaderNote.Leader.RootNode.ChildNodes.Item(1) 'Dim oSecondNode As LeaderNode ' oSecondNode = oFirstNode.ChildNodes.Item(1) 'oFirstNode.InsertNode(oSecondNode, oTG.CreatePoint2d(oMidPoint.X, oMidPoint.Y + 5))
photo of what is happenening
Solved! Go to Solution.