Alright, my curiosity was eating at me, so I decided to do a study of this issue in hopes of gaining a glimpse on how Inventor decides to assign these .Item() numbers to a component's edges. And hoo boy... It's a confusing-looking mess. I'm sure that there's a rhyme and reason to it (there has to be, otherwise Inventor would likely get stuck trying to decide which edge to render first), but I'm not picking up on it. I figured I'd post some of my findings for others to see. Perhaps one of you can help me figure out what's going on here.
To start off, I've put together a set of procedures to dynamically generate Leader Notes on any component that I specify by name (i.e. as it appears in the Model Tree) within a specified View on my drawing. These procedures will find the named component, and then attach a Leader Note to each of its visible edges; each Leader Note will specify which edge number is assigned to each edge within that component's DrawingCurveEnumerator.Item() array:
Public Sub AnnotateComponentEdges()
' This procedure's purpose is to simply annotate every visible edge of a specified component with Leader Notes; each Leader Note will
' specify the .Item() number of each edge contained within the specified component's DrawingCurvesEnumerator.Item() array.
' This procedure will allow me to study how Inventor goes about assigning a component's edges to this array in hopes of figuring out
' the method behind Inventor's madness, as it'd greatly help me to better predict which edges to attach auto-generated Leader Notes to.
' Set a reference to the drawing document.
Dim oDrawDoc As Inventor.DrawingDocument
Set oDrawDoc = ThisApplication.ActiveDocument
' Set a reference to the active sheet.
Dim oSheet As Inventor.Sheet
Set oSheet = oDrawDoc.ActiveSheet
' Set a reference to all drawing views.
Dim oViews As DrawingViews
Set oViews = oSheet.DrawingViews
' This variable will specify which DrawingView we're referencing.
Dim iViewNum As Integer
' iViewNum = 1 ' sets oView to "VIEW1."
' iViewNum = 5 ' sets oView to "VIEW5."
' iViewNum = 6 ' sets oView to "VIEW6."
iViewNum = 8
' Set a reference to the specified drawing view (iViewNum).
Dim oView As Inventor.DrawingView
Set oView = oViews.Item(iViewNum)
' Set a reference to the assembly document.
Dim oAssyDoc As Inventor.AssemblyDocument
Set oAssyDoc = oView.ReferencedDocumentDescriptor.ReferencedDocument
' Readies code for creation of reference points for dimension placement.
Dim oTG As TransientGeometry
Set oTG = ThisApplication.TransientGeometry
' This variable will fetch the parameters from the Crate Assembly Model.
Dim oCrateParams As Parameters
Set oCrateParams = oAssyDoc.ComponentDefinition.Parameters
' This variable will fetch the Crate Assembly Model's "unit_slot_count" parameter value.
Dim oCrateUnitSlotCount As Parameter
Set oCrateUnitSlotCount = oCrateParams.Item("unit_slot_count") ' returns 1, 2, 3 or 4.
' Set a reference to the Crate Assembly Model's component definition.
Dim oCrateCompDef As AssemblyComponentDefinition
Set oCrateCompDef = oAssyDoc.ComponentDefinition
' This variable will be used to reference an occurrence of oCrateCompDef.
Dim oCrateCompOcc As Inventor.ComponentOccurrence
' This variable will be used to retrieve all of the rendered DrawingCurves of the current oCrateCompOcc component.
Dim oDrawingCurvesEnum As DrawingCurvesEnumerator
' This variable will be set to the pre-selected DrawingCurve of the current oCrateCompOcc component that we'll be attaching a Leader Note to.
Dim oDrawingCurve As DrawingCurve
'---------------------------------------------------------------------
' This String variable will contain the name of the component that we want to cover in Leader Notes.
Dim sCompName As String
' sCompName = "bracing_block_4r"
' sCompName = "block_1b_us1"
' sCompName = "block_1b_us4"
' sCompName = "block_1t_us4"
' sCompName = "top_cap_1"
sCompName = "test_block_1A"
' First, we must locate the component occurrence of our named component (sCompName). Once found, we can then assign the DrawingCurvesEnumerator
' of the named component to oDrawingCurvesEnum, which will allow us to then annotate the named component's edges.
For Each oCrateCompOcc In oCrateCompDef.Occurrences
' We'll skip over all suppressed components, as well as components with no visible SurfaceBodies.
If oCrateCompOcc.Suppressed = False And oCrateCompOcc.SurfaceBodies.Count > 0 Then
' If the current oCrateCompOcc's name matches sCompName, then we've found our component! We assign the current component occurrence to
' oDrawingCurvesEnum, and then exit this For-Each loop.
If oCrateCompOcc.Name = sCompName Then
Set oDrawingCurvesEnum = oView.DrawingCurves(oCrateCompOcc)
Exit For
End If
End If
Next
' This variable will keep count of each DrawingCurve edge number as we iterate through them in the For-Each loop below.
Dim iEdgeNum As Integer
iEdgeNum = 1
' Now that we've assigned oDrawingCurvesEnum to our named component's DrawingCurves, we will create a For-Each loop to annotate each visible edge
' with a Leader Note.
For Each oDrawingCurve In oDrawingCurvesEnum
Call GenerateTestLeaderNote(iViewNum, oDrawDoc, oAssyDoc, oDrawingCurve, iEdgeNum)
iEdgeNum = iEdgeNum + 1
Next
End Sub
Public Sub GenerateTestLeaderNote(iViewNum, oDrawDoc, oAssyDoc, oDrawingCurve, iEdgeNum)
' This procedure's purpose is for testing purposes only, and is only to be used by the AnnotateComponentEdges() procedure.
' This procedure will generate a Leader Note on the rendered component edge within the specified View provided by AnnotateComponentEdges().
' Set a reference to the active sheet.
Dim oSheet As Sheet
Set oSheet = oDrawDoc.ActiveSheet
' Set a reference to all drawing views.
Dim oViews As DrawingViews
Set oViews = oSheet.DrawingViews
' Set a reference to the specified drawing view (iViewNum).
Dim oView As Inventor.DrawingView
Set oView = oViews.Item(iViewNum)
' This variable will contain the text that the Leader Note will display.
Dim sLNText As String
sLNText = "Edge #" & iEdgeNum
' Get the mid point of the selected curve, assuming that the selected curve is linear.
Dim oMidPoint As Point2d
Set oMidPoint = oDrawingCurve.MidPoint
' Set a reference to the TransientGeometry object.
Dim oTG As TransientGeometry
Set oTG = ThisApplication.TransientGeometry
' Create a reference to a TransientObjects' ObjectCollection.
Dim oLeaderPoints As ObjectCollection
Set oLeaderPoints = ThisApplication.TransientObjects.CreateObjectCollection
' This variable will be used for adding attribute values to each created dimension.
Dim oDim1Att As AttributeSet
' Create a leader point that marks where the "elbow" of the Leader Note should be placed in relation to the arrow head's location
' (which is the MidPoint of our specified DrawingCurve).
Call oLeaderPoints.Add(oTG.CreatePoint2d(oMidPoint.X + 1.5, oMidPoint.Y + 1.5))
' 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
Set oGeometryIntent = oSheet.CreateGeometryIntent(oDrawingCurve, oMidPoint)
Call oLeaderPoints.Add(oGeometryIntent)
' Generate the actual Leader Note on the drawing.
Dim oLeaderNote As LeaderNote
Set oLeaderNote = oSheet.DrawingNotes.LeaderNotes.Add(oLeaderPoints, sLNText)
' Now to give our oLeaderNote some custom attribute sets to allow us to delete only these auto-generated Leader Notes.
Set oDim1Att = oLeaderNote.AttributeSets.Add("iLogic_Created")
Set oDim1Att = oLeaderNote.AttributeSets.Add("ID")
End Sub
Let's start off with something simple - a 6-in. long 2x4 piece of lumber (I'll refer to this as our test block), oriented in three different positions. When "flat-viewed" so that we can only see a single face of our test block at a time, the edge numbering seems to be rather consistent no matter how the visible face is oriented (see image below). No matter how the visible face is rotated, the edge numbers appear to be consistent.
Each column of images here shows a single face of the test block. From top to bottom, we see each chosen face in its default orientation, then rotated 90°, and then rotated 135° from its original orientation.
So what about when our test block is viewed isometrically? Well, it takes what we've established thus far and throws it out the window (see image below). I placed leader notes on the test blocks at the top of each "column" of the image above. But as you can see here, the edge numbers in these isometric views don't relate at all to the edge numbers that were assigned in the "flat" views shown above.
NOTE: Each image shown here correlates to the orientations seen at the top of each "column" within the previous image.
Alright, well what if we look at one of these test blocks isometrically with its hidden edges shown? Is there any consistency between the hidden & not-hidden isometric views? Why, yes there is, apparently (see image below)! Edges #1 - #9 are the same edges in both of these isometric views. Edges #10 - #12 are the hidden edges.
Edges #1 - #9 are consistent between these two isometric views of the same testing block.
Alright, let's throw a curve ball at this study and see what we get when we try this out with the following custom block:
Here's the part drawing for the custom block that we'll see shortly...
So here's what we get when we run those procedures on this custom block:
The numerical order that the edges have is consistent for a bit, but the hidden edges throw off the sequence.
..Welp. Apparently Edges #1 - #7 are consistent between both of these isometric views, but then the hidden lines cut into the sequence. And here I was thinking that maybe hidden lines got the lower prioritization and were counted after all of the visible lines were numbered first. Ugh...
I've some fuzzy guesses that perhaps the edges are numbered based on how a component is created, and its orientation to its local origin point. But I've no actual proof of anything like that at this time. I think that at this point I'm just going to stop looking into this myself, and hope that an Inventor developer happens to come along and sate my curiosity about this subject. If anyone else has any clue how this works, please feel free to post about it.