- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello community
Im new developing in inventor, Im building a part add-in where open a form in modeless, until here everything is good, then I need to get the face that user selects in object, and change some values in the form depend of selected face. I need every time that the user select a face get values and update textbox in the form. someone have any idea how I can achive this? I am working with c#. I have this classs but I dont know in what place create the object.
public class Select
{
private InteractionEvents interactionEvents;
private SelectEvents selectEvents;
private MouseEvents oMouseEvents;
bool bStillSelecting;
public Object Pick(SelectionFilterEnum filter, Application app)
{
dynamic _return = null;
bStillSelecting = true;
//Create an InteractionEvents object.
interactionEvents = app.CommandManager.CreateInteractionEvents();
interactionEvents.OnTerminate += InteractionOnTerminate;
//Define that we want select events rather than mouse events.
interactionEvents.SelectionActive = true;
interactionEvents.InteractionDisabled = false;
//Set a reference to the select events.
selectEvents = interactionEvents.SelectEvents;
//oMouseEvents = interactionEvents.MouseEvents;
//oMouseEvents.MouseMoveEnabled = true;
//Set the filter using the value passed in.
selectEvents.AddSelectionFilter(filter);
selectEvents.OnSelect += SelectionOnSelect;
//The InteractionEvents object.
interactionEvents.Start();
//Loop until a selection is made.
do
{
app.UserInterfaceManager.DoEvents();
} while (bStillSelecting);
//Get the selected item. If more than one thing was selected,
//just get the first item and ignore the rest.
ObjectsEnumerator oSelectedEnts = selectEvents.SelectedEntities;
_return = oSelectedEnts.Count > 0 ? oSelectedEnts[1] : null;
//Stop the InteractionEvents object.
interactionEvents.Stop();
selectEvents = null;
interactionEvents = null;
return _return;
}
private void SelectionOnSelect(Inventor.ObjectsEnumerator JustSelectedEntities, Inventor.SelectionDeviceEnum SelectionDevice, Inventor.Point ModelPosition, Inventor.Point2d ViewPosition, Inventor.View View)
{
bStillSelecting = false;
}
private void InteractionOnTerminate()
{
bStillSelecting = false;
}
}
Thanks so much for your help
Solved! Go to Solution.