select entity event: is it possible?

select entity event: is it possible?

gennadyKhkh
Enthusiast Enthusiast
1,000 Views
5 Replies
Message 1 of 6

select entity event: is it possible?

gennadyKhkh
Enthusiast
Enthusiast

Want to get stop at select entity event in Navisworks Manage 2023.

Samples in Lab_Events collections does not have any click or select event demo.

Is it possible to interveen selection process?

Thank you,

Gennady

0 Likes
Accepted solutions (2)
1,001 Views
5 Replies
Replies (5)
Message 2 of 6

alexisDVJML
Collaborator
Collaborator

You can use the SelectionChanged.
If you want to alter the slection, just turn on a flag to detect being called again or temporary change your SelectionChanged event handler.

Main Scientist, Full Stack Developer & When Time Permits Director of IDIGO ► On your marks, Set, Go
0 Likes
Message 3 of 6

gennadyKhkh
Enthusiast
Enthusiast

Hello, Alexis,

having problems with Navisworks documentation. could you please, point me to SelectionChanged event description.

Dot Net API reference is mentioned Autodesk.Navisworks.Api.Takeoff assembly but not sure if it is appropriate for the current view item selection event.

Thank you

0 Likes
Message 4 of 6

gennadyKhkh
Enthusiast
Enthusiast
Accepted solution

Hello, Alexis,

discovered from sample code  where is such event subscription located:

DocumentCurrentSelection class, Changed event

And it is working fine to select entities in Navisworks current view.

Regards,

Gennady

Message 5 of 6

lanneauolivier
Advocate
Advocate
Accepted solution

Using SelectionChanged does not allow to modify the selection because this is in readonly.

 

The way I do it is by creating a InputPlugin, in the MouseUp function, I get the ModelItem user clicked with view.PickItemFromPoint(x, y).ModelItem then change it acording to my rules.

Then return true to block Navisworks's selecting process

If you did nothing, return false to let Navisworks select stuff.

 

Regards

Message 6 of 6

alexisDVJML
Collaborator
Collaborator
Good Technique.
For similar situations, in our plugin I use a different trick: on SelectionChanged, I set up internal action that is executed in next call to our plugin OnIdle.
Main Scientist, Full Stack Developer & When Time Permits Director of IDIGO ► On your marks, Set, Go
0 Likes