select a position on a face

select a position on a face

johnteng00
Advocate Advocate
693 Views
5 Replies
Message 1 of 6

select a position on a face

johnteng00
Advocate
Advocate

 

 

Hi guys,

 

I already have a function to select one or many faces. Now I want to implement a function so that user can select two position on the selected faces, is this possible with Inventor? Could you please tell me how to do it?

 

I use c++ visutal studio 2005, but vb is also ok for me. I want to learn the concept.

 

thank you very much.

Best Regards

John

0 Likes
694 Views
5 Replies
Replies (5)
Message 2 of 6

ekinsb
Alumni
Alumni

It should be possible using InteractionEvents.  I assume this is what you're already using to get the face selection.  I'm not sure of your exact workflow and it would take a bit of experimenting with various things to see what would work the best for your case but I'm sure it's a solvable problem.


Brian Ekins
Inventor and Fusion 360 API Expert
Mod the Machine blog
0 Likes
Message 3 of 6

johnteng00
Advocate
Advocate

 

 

thank you for your reply.

 

Here is my problem:

 

This is my basic command class:

        class ATL_NO_VTABLE CCmdBaseImpl :

                public CComObjectRootEx<CComSingleThreadModel>,

                        public IDispEventImpl<0, CCmdBaseImpl, &DIID_ButtonDefinitionSink, &LIBID_Inventor, 1, 0>

 

In the derived class:

I can overwrite the function:

 

      SelectEvents_OnSelect(ObjectsEnumerator *pJustSelectedEntities,

                                            SelectionDeviceEnum SelectionDevice,   Point *pModelPosition, Point2d *pViewPosition,

                                            View *pView) ;

 

So when user select a point on a face, I beleive I could get the model point.

 

Now the question is how to display the model point temporarily? At least I should let user know where he has selected on the face, it is a cross or some other sign will be great, but I can't find examples to show me how to do this.

 

could anyone please give me a hints or at least tell me where I should go to find out the solution?

 

thanks again

john

0 Likes
Message 4 of 6

ekinsb
Alumni
Alumni

You can use client graphics to display the point.  There is a special version of client graphics that's associated with InteractionEvents that you access through the InteractionGraphics property of the InteractionEvents object.  There is an overview topic for client graphics in the programming help that hopefully is enough to get you going or you can post back here if you run into problems. 


Brian Ekins
Inventor and Fusion 360 API Expert
Mod the Machine blog
0 Likes
Message 5 of 6

johnteng00
Advocate
Advocate

thank you very much. this is the help I want.

john

0 Likes
Message 6 of 6

johnteng00
Advocate
Advocate

 

 

Hi guys,

 

 

 

I have two problems.

 

 

 

a. how to get points which are on a face.

 After selecting a face, I need to get two reference points on the selected face. I could get the frist one when user selects the object, but how to get the second one? I try to use mouse event object and use the overwritten function: 

 

MouseEvents_OnMouseClick

 

 

 

but the model point returned is not the point on the face. I check the document, it seems no way you get it directly.

 

 

 

 

 

b. Clean up client grahpics

 I use the following call to get interactionGraphics 

 

CComPtr<InteractionGraphics> interactionGraphics_ptr;

 

m_pInteractionEvtsObj->get_InteractionGraphics(&interactionGraphics_ptr);

 

Then I add two nodes and create two points graphics.

It works fine. However, the problems appear when I issue my command again, and the previous created temp client graphics are still there. My question now, is there any way to clean up the previous created client graphics?

thanks & best regards

john

0 Likes