Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to locate parts using the parts list row?

7 REPLIES 7
SOLVED
Reply
Message 1 of 8
Stakin
198 Views, 7 Replies

How to locate parts using the parts list row?

In a drawing parts list ,is there a way to implement the following functions by API:

1, Select a single row or multi rows in a parts list,and highlight it. 

2, and in the canvas and browser, the components of the select parts list rows cross-highlight. 

3, Get all indexes of selection and selectionset in brower and each views .

 

This function was released in the 2024 version,as shown in the following figure;Is there  a corresponding API methods or other solutions?

Stakin_0-1720091948785.png

 

7 REPLIES 7
Message 2 of 8
AMHumiston
in reply to: Stakin

i looked through the selection filters and can't find one that will let you isolate the row in the parts list, like the default selection filer will allow.

 

if you selected the parts list a custom user form could provide the data you are looking for.

 

I'd be interested if anyone has any idea how this works, i even tried going into VBA and looking through the properties and didn't have any luck.

Message 3 of 8
Stakin
in reply to: AMHumiston

Yes,I haven't find either. 

If we select a partslist row manully, the draingview and browsepan will high light the corresponding parts;

but how to access the highlightset?

Message 4 of 8
AMHumiston
in reply to: Stakin

would you share what you have so far for code? i can build off of it. i was thinking, if we loaded the parts list into user form and then let you select the rows you'd like to edit. then we have a start.

 

what information are you trying to retrieve from the selected rows?

Message 5 of 8
_dscholtes_
in reply to: Stakin


@Stakin wrote:

but how to access the highlightset?


I'm not sure if you want to add components to a collection/set to highlight them in your drawing or if there's a highlight set in your drawing and you want to access the components in them, but maybe this can help:

Drawing documents do not have a highlight set, but they do have a SelectSet (DrawingDocument.SelectSet).

Message 6 of 8
g.georgiades
in reply to: Stakin

There is currently no way to specifically select parts list rows via the API.

There are a couple idea board entries for it you can vote for that are related to this.

https://forums.autodesk.com/t5/inventor-ideas/provide-api-access-to-which-parts-list-row-was-right-c...

https://forums.autodesk.com/t5/inventor-ideas/open-idw-directly-from-part-list/idi-p/9389040

 

 

I have been wanting to be able to quickly open the associated drawing based on what row the user right clicks for the longest time (My addin adds a context menu entry to the parts list). Since you pointed out that the browser highlights the occurrences when the rows are selected (I've been using 2023 until very recently so I did not notice that...) - I did some testing - and found a solution for my need that scans the model tree.

 

When left or right clicking the parts list row, other things are deselected and only the parts list is remaining in select set which is good. And if rows are selected - the browser nodes highlight.

 

I found this only works if the parts list and the affected models are on the same sheet. Nodes in other sheets do not highlight.

 

I have attached my code which includes all the weird behavior I came across. It is reduced to simply output the occurrence name, but it can be adapted. My code stops once it finds the first highlighted node since its all I need, but it can be adapted to keep a running tally instead, or cross reference against the parts list rows to determine the row index (as long as there are not duplicates in the list)

 

Scanning the browser pane can be pretty taxing though - I have some optimizations included but it may not be all that is possible, and even with all the optimizations, it can still run slow. This does have a major inefficiency if the parts list row is a custom row - it cannot detect that it so it ends up searching everything to find nothing.

 

Another outlandish idea I had is to somehow use the mouse position relative to the parts list to determine which row is hovered, or clicked during an interaction events, but I have not worked on that avenue.

 

Hopefully you can glean something from this!

Message 7 of 8
Stakin
in reply to: g.georgiades

Thank you,
I need to spend some time learning the program and methods you mentioned. I will follow up and keep you informed of the progress .
Message 8 of 8
WCrihfield
in reply to: Stakin

Hi @Stakin.  I am mainly just curious at this point as to why you want to attempt to simulate most, if not all of the same behavior that is already built into Inventor's user interface?  Do you not have Inventor 2024 yet, and are trying to make this happen in an earlier version of Inventor, using iLogic rules?  Or do you have something else in mind...such as wanting to do something further with one (or more) of the selected / highlighted objects?  The folks at Autodesk likely have a pretty huge and diverse block of code supporting that new functionality, including event handlers, navigating browser nodes, navigating all the DrawingCurve / DrawingCurveSegment entities within multiple views, temporary customized right-click menu entries, and on, and on.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Technology Administrators


Autodesk Design & Make Report