- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi @Anonymous,
i try to find out if an occurrence has an ModelLeaderNote.
The occurrence self did not has such a property or function to get this information.
So i tried to iterate through the ComponentDefinition.ModelAnnotations.ModelLeaderNotes.
But unlike the LeaderNote in the drawings which has an AttachedEntity function, the ModelLeaderNote did not have such a function.
Is there any other way to find this information?
Cheers
René
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello Rene,
what is it that you are trying to do?
I did the following:
drew a modelleadernote and selected it.
than went to VBA and set a watch on the application
then go to the activedocument , selectset.
there you will find the selected modelLeaderNote
then search....., here the object structure:
Modelleadernote type: modelleadernote Definition type: modelleadernotedefinition Intent type: geometryintent Geometry type: edge Parent type: surfacebody Parent type: partcomponent definition
I hope you understand this and can do something with it.....
else let me know
Kudo's are also appreciated
Succes on your project, and have a nice day
Herm Jan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Referenced object can be retrieved through definition of ModelLeaderNote(ModelLeaderNoteDefinition). From this definition, either Intent or AnnotaionPlane would give referenced object details as shown below.
Thanks and regards,
CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello @HermJan.Otterman, @chandra.shekar.g,
thanks for your suggestions.
Indeed I tried this already.
@HermJan.Otterman: The PartComponentDefinition is not the occurence self. I did not found a way to get the Occurrence.
@chandra.shekar.g: I did not find any property/function in the AnnotationPlane which will get the Occurrence?
Cheers
Rene
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Try the below VBA code to get referenced document from ModelLeaderNote. Will this helpful? or Looking for specific occurrence?
Sub Main()
Dim oDoc As AssemblyDocument
Set oDoc = ThisApplication.ActiveDocument
Dim oDef As AssemblyComponentDefinition
Set oDef = oDoc.ComponentDefinition
Dim oNotes As ModelLeaderNote
For Each oNotes In oDef.ModelAnnotations.ModelLeaderNotes
Dim oReferDoc As Document
Set oReferDoc = oNotes.Definition.Intent.Geometry.Parent.ComponentDefinition.Document
Next
End SubThanks and regards,
CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I'm searching for the specific occurrence.
The idea is, select an occurrence, set some information in Attributes and if existing, update this information also in the attached ModelLeaderNote.
So I need to find out has this occurrence an ModelLeaderNote or has any ModelLeaderNote attached to this occurrence.
Cheers
Rene
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Try the following VBA code to get specific occurrence of ModelLeaderNote.
Sub Main()
Dim oDoc As AssemblyDocument
Set oDoc = ThisApplication.ActiveDocument
Dim oDef As AssemblyComponentDefinition
Set oDef = oDoc.ComponentDefinition
Dim oNotes As ModelLeaderNote
For Each oNotes In oDef.ModelAnnotations.ModelLeaderNotes
Dim oBody As SurfaceBody
Set oBody = oNotes.Definition.Intent.Geometry.Parent
Dim occ As ComponentOccurrence
For Each occ In oDef.Occurrences.AllLeafOccurrences
Dim occBody As SurfaceBody
For Each occBody In occ.Definition.SurfaceBodies
If oBody Is occBody Then
Debug.Print occ.Name
GoTo NextIteration
End If
Next
Next
NextIteration:
Next
End SubPlease feel free to contact if there is any queries.
If solves problem, click on "Accept as solution" / give a "Kudo".
Thanks and regards,
CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
thanks for this solution. It seems to work in my sample.
For the real world, I think, this is not a good solution.
There are many loops in a big assembly with 1000 or more occurrences, this will take a lot of time.
Cheers
Rene
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Currently, there is no direct Inventor API to get referenced occurrence like AttachedEntity of LeaderNote in Drawing document. You can this wish list at idea station using below link.
https://forums.autodesk.com/t5/inventor-ideas/idb-p/v1232/tab/most-recent
Thanks and regards,
CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Create an idea on idea station: https://forums.autodesk.com/t5/inventor-ideas/get-referenced-object-occurrence-of-modelleadernote/id...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi, I know it is very late to answer your question, but I had to do this today, so I found a solution (which works in my case, but I dont know if it is generic enough). So, the function I did works to find the connected EdgeProxy of a ModelLeaderNote in an assembly document :
public static EdgeProxy FindNoteConnectedEdgeProxy(AssemblyDocument assembly, ModelLeaderNote note)
{
EdgeProxy edgeProxy = null;
Edge connectedEdge = note.Definition.Intent.Geometry as Edge;
SelectionFilterEnum[] selectionFilter = new SelectionFilterEnum[1];
selectionFilter[0] = SelectionFilterEnum.kPartEdgeFilter;
ObjectsEnumerator objFound = assembly.ComponentDefinition.FindUsingPoint(note.Definition.Leader.AllNodes[note.Definition.Leader.AllNodes.Count].Position, ref selectionFilter, 0.001, true);
foreach (object obj in objFound)
{
if (obj is EdgeProxy)
{
EdgeProxy proxy = (EdgeProxy)obj;
if (connectedEdge != null)
{
if (proxy.NativeObject.Equals(connectedEdge))
{
edgeProxy = proxy;
break;
}
}
else
{
edgeProxy = proxy;
break;
}
}
}
return edgeProxy;
}
I have no time to check what kind of object may be connected to a ModelLeaderNote, but I think this example can easily be modify to handles more connected object types. And of course, if you need an occurrence (ComponentOccurrence), this is easily found with the any proxy object through the "ContainingOccurrence" property.