i checked the forum for TxManipulator Class.
I already programmed some Manipulators for testing the functionality.
But there are some Questions:
- what is the use of a TxManipulator? sry but i don´t get the sense till now ...
- is it possible to move a manipulator with the mouse in the 3D window?
- is the Placement Manipulator and FastPlacement in Basic a TxManipulator?
- is it possible to create own FastPlacement or something like that with the TxManipulator?
Thx for your replies ...
Manipulator are those temprorary that we use in order to get input from the user - e.g. when executing the Placement Manipulator command, the user can input his selection either by the dialog, or by the manipulator that appears in the graphic viewer (so, the answer for your second question is yes, the placement manipulator is a type of manipulator)..
The usage of this class is for those scenario when you want to create your own command, with your own manipulator.
The TxManipulator implements ITxLocatableObject, so you can change its location in the scene, changing the AbsoluteLocation property will move the object. To move an object in Graphic Viewer with the mouse, you need to handle the TxGraphicViewer static events - MouseDown, MouseMove and MouseUp, then you can implement your own logic. Check also PointScreenCoordinates, PointWorldCoordinates, PickSingleObject methods of TxGraphicViewer class.
I had these problems in the past, and i still have it.
First i tried to use the EngeneeringInternalExtension, which gave me a pretty good way of getting the indicies of each manipulator element. But on a undetermined number of indicies, i've got the wrong index.
So i've made a request to email@example.com about that problem.
If you look into DnSectionCommands.dll, there is a pretty good example how to use it, unfourtunately it is an internal *.dll
The person told me, that there is no garanty this .dll will be exposed in future releases.
And I've got a solution to use the txpicklistener.
Answer from txapi_support:
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 TxManipulatorElementGraphicsData;
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
Then in the init method of you class configure the listener:
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;
I've tried that, but unfourtunatley it will not recognize my mouseclicks on my Manipulator elements.
Even if is set it to pickable=true.