Here is a basic example of that complicated stuff I just mentioned. It is very narrow in its capability right now though, because it will only work if several things work out the right way. The leader note must be attached to something, and it must be a DrawingCurve, and that curve must represent an Edge in the model. All that stuff can be expanded upon to make it much more robust.
Dim oLNote As LeaderNote = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kDrawingNoteFilter, "Select a leader note to inspect.")
If oLNote Is Nothing Then Return
Dim oLeader As Inventor.Leader = oLNote.Leader
If oLeader.HasRootNode Then
Dim oRNode As LeaderNode = oLeader.RootNode
Dim oNodes As LeaderNodesEnumerator = oLeader.AllNodes
For Each oNode As LeaderNode In oNodes
If oNode.AttachedEntity Is Nothing Then Continue For
Dim oGI As GeometryIntent = oNode.AttachedEntity
Dim oGeom As Object = Nothing : Try : oGeom = oGI.Geometry : Catch : End Try
If oGeom Is Nothing Then Continue For
MsgBox("TypeName(oGeom) = " & TypeName(oGeom),,"")
If TypeOf oGeom Is DrawingCurve Then
Dim oDC As DrawingCurve = oGeom
Dim oDView As DrawingView = oDC.Parent
Dim oDViewDoc As Document = oDView.ReferencedDocumentDescriptor.ReferencedDocument
MsgBox("View Model Doc = " & oDViewDoc.FullDocumentName,,"")
Dim oMGeom As Object = oDC.ModelGeometry
If TypeOf oMGeom Is Edge Then
Dim oEdge As Edge = oMGeom
Dim oNoteDoc As Document = oEdge.Parent.ComponentDefinition.Document
MsgBox("Note Model Doc = " & oNoteDoc.FullDocumentName, , "")
ElseIf TypeOf oMGeom Is Face Then
Dim oFace As Face = oMGeom
Dim oNoteDoc As Document = oFace.Parent.ComponentDefinition.Document
MsgBox("Note Model Doc = " & oNoteDoc.FullDocumentName, , "")
End If
ElseIf TypeOf oGeom Is SketchEntity Then
Dim oSE As SketchEntity = oGeom
Dim oSketch As Sketch = oSE.Parent
Dim oSketchParent As Object = oSketch.Parent
MsgBox("TypeName(oSketchParent) = " & TypeName(oSketchParent),,"")
End If
Next 'oNode
End If
If this solved your problem, or answered your question, please click ACCEPT SOLUTION .
Or, if this helped you, please click (LIKE or KUDOS) 👍.
Wesley Crihfield

(Not an Autodesk Employee)