cancel
Showing results for 
Search instead for 
Did you mean: 

I cannot find the event to get the actual TxManipulatorElementData that is select.

Siemens Pioneer Siemens Pioneer
Siemens Pioneer

Question:

 

I have created an event for when the user selects the  TxManipulation but I cannot find the event to get the actual TxManipulatorElementData that is select.

 

Answer:

 

 You can use TxPickListener class to register to the Picked event. Then from the TxPickListener_PickedEventArgs event arguments you can take the ElementIndex. It will return you the index of the picked element in the manipulator.

 

void picker _Picked(object sender, TxPickListener_PickedEventArgs args)
{
         int index = args.ElementIndex;
         ArrayList elements = manip.GetGraphicsElements();
         TxManipulatorElementGraphicsData element = elements[index - 1] as TxManipulatorElementGraphicsDat
}

 

 

 

Note: When you create the elements of the manipulator, set the  Pickable property of the  element data to true. Also when you create the TxPickListener, set its IgnorPickOfTransientObjects property to false.

Then register to the Picked and Deactivated events. In the Deactivated event handler unregister from both events:

 

TxPickListener picker = new TxPickListener();//add it as a member of your class
picker.IgnorPickOfTransientObjects = false;
picker.PickLevel = TxPickLevel.Component;
picker.Picked += picker_Picked;
picker.Deactivated += picker_Deactivated;

void picker_Deactivated(object sender, TxPickListener_DeactivatedEventArgs args)
{
      picker.Picked -= picker_Picked;
      picker.Deactivated -= picker_Deactivated;
}