UserInputEvents or SelectEvents? For OnSelect handling

UserInputEvents or SelectEvents? For OnSelect handling

Jef_E
Collaborator Collaborator
1,227 Views
6 Replies
Message 1 of 7

UserInputEvents or SelectEvents? For OnSelect handling

Jef_E
Collaborator
Collaborator

Hi,

 

I am tweaking my AddIn, and stumbled upon something. There are two ways to catch the event of a user selecting a object. Which one is preferred for my case?

 

For me catching the OnSelect Event is when the user clicks on a object. I would like to know it, to process his selection and  then show specific parameters or other things that are relevant for us. mostly partdocument, assembly documents and component occurrences are processed.

 

But is there a difference if I use the InteractionEvents.SelectEvents Or CommandManager.UserInputEvents it's OnSelectEvent?



Please kudo if this post was helpfull
Please accept as solution if your problem was solved

Inventor 2014 SP2
0 Likes
Accepted solutions (2)
1,228 Views
6 Replies
Replies (6)
Message 2 of 7

bradeneuropeArthur
Mentor
Mentor

Hi,

 

Could you please provide me as text file the code regarding the selection events methods.

 

.CommandManager.CreateInteractionEvents.SelectEvents

For me they are not fired/working.

So I can't investigate the differences.

 

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes
Message 3 of 7

Jef_E
Collaborator
Collaborator
Accepted solution

Okay, I think i figured it out, use the createinteractionevents when you want the user to pick something as a question.

 

Example: addin replaces a selected item. Code runs, and there is no Item selected... ask the user to select a item and then the code proceeds.

or like it is used in this link. http://adndevblog.typepad.com/manufacturing/2013/02/pick-a-point.html

 

 

 

Now secondly I found something weird in the UserInputEvents.Unselect If a deselection is made, it gets caught twice the event?? Why is this?

 

I tested it with this code

 

    Private Sub User_OnUnSelect(ByVal UnSelectedEntities As Inventor.ObjectsEnumerator,
                                ByVal SelectionDevice As Inventor.SelectionDeviceEnum,
                                ByVal ModelPosition As Inventor.Point,
                                ByVal ViewPosition As Inventor.Point2d,
                                ByVal View As Inventor.View) _
                                Handles UserInputEvents.OnUnSelect

        Debug.Print(SelectionDevice.ToString)
        Debug.Print(UnSelectedEntities.Count)

    End Sub

This is the debug output when select 1 item and the unselect it.

 

kGraphicsWindowSelection
0
kGraphicsWindowSelection
0

So what does this mean? There were 0 entities deselected twice? Huh.. that strikes me as odd or is it a bug? @johnsonshiue



Please kudo if this post was helpfull
Please accept as solution if your problem was solved

Inventor 2014 SP2
0 Likes
Message 4 of 7

bradeneuropeArthur
Mentor
Mentor

Hi,

 

I can't get it to work:

 

What am I doing wrong:

 

Public WithEvents SE As Inventor.SelectEvents

SE = _InvApp.CommandManager.CreateInteractionEvents.SelectEvents

Private Sub SE_OnUnSelect(UnSelectedEntities As ObjectsEnumerator, SelectionDevice As SelectionDeviceEnum, ModelPosition As Point, ViewPosition As Point2d, View As Inventor.View) Handles SE.OnUnSelect
        MsgBox(SelectionDevice.ToString)
        MsgBox(UnSelectedEntities.Count)
    End Sub

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes
Message 5 of 7

Jef_E
Collaborator
Collaborator
Accepted solution

Edit: I cannot edit my post, forget about the bug, I subscribed twice to the event. Still 0 entities are unselected

 

@bradeneuropeArthur just follow the link I posted.



Please kudo if this post was helpfull
Please accept as solution if your problem was solved

Inventor 2014 SP2
0 Likes
Message 6 of 7

bradeneuropeArthur
Mentor
Mentor

@Jef_E

 

What does it mean for this moment?

 

Regards,

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes
Message 7 of 7

Jef_E
Collaborator
Collaborator

That, if you want to monitor constantly what the user is selecting you should use the UserInputEvents. If you want to create a Pick function you should use the SelectEvents



Please kudo if this post was helpfull
Please accept as solution if your problem was solved

Inventor 2014 SP2
0 Likes