Skip to main content
1-Visitor
August 31, 2022
Solved

Mouse events in Creo Parametric API

  • August 31, 2022
  • 2 replies
  • 2948 views

Hi again,

 

Once again the newbie question.

 

We want to develop an extension that depends on the ability to receive some basic info about the items clicked by our users (e.g. - id of the clicked element).  I see such info displayed by the system on mouse hover and on mouse click selection. Unfortunately, I did not found any documented API which notify me on this events.

Do I understand right that no hooks are provided by API on the mouse events? How do you solve this standard situation?

 

Thank you so much for your advise.

Best answer by remy

given the scenario you are after then @Eike_Hauptmann suggestion to use ProSelect is the solution. Once the selection is successfull dig in and get the information you need.

 

Then again Creo Toolkit offers thousands of functions that have been refined over decades.

Remember that feasibility is tied up to what is possible from the User Interface perspective. 
Possible does not necessarily mean available.

And finally: all functionalities do not necessarily have an API.

As developers,, we tend to think that APIs tap directly in the UI functionalities while an API is actually a door that has been purposefully created by R&D and simply that door sometimes is simply not there.

Reversely some developers who are less versed in using Creo and more in coding need to understand firstly what happens from the UI's perspective and refrain from simply rolling out the documentation.

This is the content of this article in a nutshell : https://www.ptc.com/en/support/article/cs324624 

2 replies

15-Moonstone
August 31, 2022

Hi,

 

you have two options ... you can use a triggered behaviour (if you want to have a parallel opened Dialog). Or you can use an explicit Select (Toolkit Select 🙂 ). So people acitvate your function and select the element from the type you have defined (e.g. feature).

 

Both are possible ... as triggered you can use uifcDialogListener in OTK or ProNotificationSet in TK.

 

Be aware that the triggered functions get called more often than you want so you need to strip that down and it slows your Creo. So if possible I would recommend the use of the Select option. (TK - ProSelect, OTK - pfcSession->Select)

 

Br,

Eike

1-Visitor
August 31, 2022

Eike, thanks a lot for your answer.

 

I need the event to be reflected in the dialog so the "triggered functionality" matches it.

I found now uifcDrawingAreaListener::OnLeftMouseDown(); Probably that what I was looking for. Not sure yet what is a "Drawing Area".

 

Kudos and BR

 

 

15-Moonstone
August 31, 2022

What Remy says !

 

A Drawing Area is a Dialog Element where you can draw in ... it's also inside the main Creo Dialog where the CAD Model is shown.

 

I wouldn't recommend to put things directly on these listeners because they would be called often. So the way with the select is the best option you have under respect to your system resources.

 

Br,

Eike

21-Topaz I
August 31, 2022

When it comes to the mouse interaction you need to be exhaustive about the event that you are looking for.
What exactly do you mean by  "the ability to receive some basic info about the items clicked by our users "?


Mouse interaction implies hovering, Right Mouse Button, Left Mouse Button, movement and so on. 

EIke suggestion is the selection consquently this function is about when LMB on something in the graphics window.

The more exhaustive the events you need and the easier it will to make suggestion.

I have to reckon that when searching "mouse" in the documentation only 3 functions are listed though.

1-Visitor
August 31, 2022

Hi Remy,

 

Sorry for not being specific enough. Let's consider a possible scenario:

 

1. The program will present some model (either assembly or part), which has several surfaces.

2. The user will click on one of the surfaces (Left Mouse Button).

3. I want to receive this event and be able to identify the surface selected (left mouse clicked) by the user. 

 

"I have to reckon that when searching "mouse" in the documentation only 3 functions are listed though". - That is exactly what worries me!

Thanks for your reaction. 

BR - 

remy21-Topaz IAnswer
21-Topaz I
August 31, 2022

given the scenario you are after then @Eike_Hauptmann suggestion to use ProSelect is the solution. Once the selection is successfull dig in and get the information you need.

 

Then again Creo Toolkit offers thousands of functions that have been refined over decades.

Remember that feasibility is tied up to what is possible from the User Interface perspective. 
Possible does not necessarily mean available.

And finally: all functionalities do not necessarily have an API.

As developers,, we tend to think that APIs tap directly in the UI functionalities while an API is actually a door that has been purposefully created by R&D and simply that door sometimes is simply not there.

Reversely some developers who are less versed in using Creo and more in coding need to understand firstly what happens from the UI's perspective and refrain from simply rolling out the documentation.

This is the content of this article in a nutshell : https://www.ptc.com/en/support/article/cs324624