03-28-2022
06:25 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
03-28-2022
06:25 AM
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.