cancel
Showing results for 
Search instead for 
Did you mean: 

Question to TxManipulator

Experimenter
Experimenter

Hi,

 

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? Smiley Happy 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 ...

5 REPLIES

Re: Question to TxManipulator

Siemens Pioneer Siemens Pioneer
Siemens Pioneer

Hi.

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.

Re: Question to TxManipulator

Siemens Phenom Siemens Phenom
Siemens Phenom

Hi MasterSim,

 

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.

 

Best Regards,

Diana

Re: Question to TxManipulator

Creator
Creator
Hi DianaG,
 
can you give us a small example?
 
Regards
 
Henry

Re: Question to TxManipulator

Creator
Creator
TxManipulator class is represent an temporary graphic element in 3D View, and it is not saved when cell update or save in psz. Example, in kinematic editor, when user define line for joint, there is a yellow line display in 3D View, this is TxManipulator element.

TxManipulator element is a container, user must add graphic element into it for display in 3D View
PS expose some common graphic element for user to display in 3D View (line, point, cone, sphere ...)

Here is example code for create simple TxManipulator element which display line joint

//Create
TxManipulatorCreationData creationData = new TxManipulatorCreationData(name, new TxTransformation());
TxManipulator manipulator = TxApplication.ActiveDocument.PhysicalRoot.CreateManipulator(creationData);

TxVector p1, p2;
TxJoint j; // Assume you already get this variable value
j.GetAxisJoints(out p1, out p2);
TxManipulatorLineElementData lineData = new TxManipulatorLineElementData(new TxTransformation(), pt, p2);
lineData.Pickable = false; //User can not pick in 3D
lineData.Color = TxColor.TxColorLightBlue;

manipulator.AddElement(lineData);
TxApplication.RefereshDisplay();

// Delete when done
//manipulator.Delete();

Re: Question to TxManipulator

Creator
Creator

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 txapi_support@siemens.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.