How to get the results of a MouseClick-Event into main program

 

Hello all,

I'm fairly new to programming for SolidEdge. I started with Jason's Solid Edge Addin Wizard for VS2005 and already have a running programm in C/C++. For interaction with the user I think I have to use events - in this particular case MouseClick-Events. The user has to click on an edge or a face in the model and only after that my program should continue. So I'd like to have a course of action as the following:

- a running method starts the event and waits for the event to finish

- the event waits for the user to click on an edge and returns some values to the previous method

- the method gets the values of the event and continues its work

The start of the event already is described in CEventManager::XAddInEvents::raw_OnCommand in EventManager.cpp: IfFailGoCheck(CLocateCommandObj::CreateInstance(&pLocateCommand), pLocateCommand); pLocateCommand->AddRef(); pLocateCommand->CreateCommand( SolidEdgeConstants::seNoDeactivate ); pLocateCommand->GetCommand()->Start(); /* here should be something like "wait for the event to finish and get its result" */

Can anybody tell me how to wait for the event?

Thanks,

Tob

 

Posted by: Tob Tischler
Post date: 3/28/2011 11:33:35 PM

1 REPLY

RE: How to get the results of a MouseClick-Event into main program

Examine the c++ sample add-in in the sdk. There is a mouse object one can get from the command object. The mouse object has a filter interface where one can add edges, faces, lines, circles etc. to the filter. The mouse also has an event set where "clicks" and other events can be implemented. Also the mouse has a "filter events" event that can be used that is passed a locate candidate that the event implemenation can reject based on its own criteria. The sample files, command.cpp and locate.cpp has all the gory details. The locate.cpp file is used by the second command of the sample. The default implemention of the locate command is to do nothing when Filter is fired. That is, it simply accepts the input object.

 

So for example, one might want to only locate circles that have a radius in a certain range. In the filter event, see if the input is a circle and if so, get the radius and accept/reject based on the value.

 

Posted by: R.D. Holland
Post date: 6/20/2011 7:01:26 AM