Im working with the .NET API. My goal is to let the user click in the graphical viewer in PS, by clicking the coordinates (4 * 4 matrix) will be useble in the .NET application (C# in my case).
I created the follow piece of code for a pick listener:
Now, my question is: where do I specify my code for when the Picked event is being raised? Because the Picked event is being raised when the handler receives a Pick. So, something or somebody should call LogicOnEvent()...
I need to store the selected Location in an object of TxTransformation.
the way I do it is something like this:
first create a new picklistener:
TxPickListener txpicklistener = new TxPickListener();
with e.g. a button click event, you can raise the picklistener:
txpicklistener.Picked += new TxPickListener_PickedEventHandler(this.PickListener);
You can stop the picklistener by the following code line:
txpicklistener.Picked -= new TxPickListener_PickedEventHandler(this.PickListener);
than use a something like this to handle the clicked location:
private void PickListener(object sender, TxPickListener_PickedEventArgs args)
TxTransformation txTransformation = args.Location as TxTransformation;
I hope you can work with the little code snippets!
Thank you Patrick for your reply!
I'm going to try your solution in the next few days, I will let you know how it worked out.
I have a question about updating your command. When you have registered your command and you make a change in your code. Does the CommandReg overwrite the old files? Couldnt find anything about making changes to your project in the API manual..
with CommandReg only the XML file in the emPower/DotNetExternalApplications directory is created with some content for the function you want to register.
If you do any changes in your code, only the dll file in emPower/DotNetCommands changes or need to be changed.
It isn´t required to run the CommandReg all the time.
To get back to the PickListener subject. I found out that you can add the Tecnomatix.Engineering.Ui dll to the visual studio toolbox, there is a location ``picker'' delivered with that toolbox. When I try to build my project I'm getting the error: AxNFCONTROLSLib, could not load file or assembly. To use the Ui.dll I'm pointing at the eMPower32 folder, because my version of Process Simulate is 64bit.
The AxNFCONTROLSLib is located in the eMPower folder, tried to copy paste this, but that isnt working out. Any suggestions on what I could do to fix this?
For development purpose, it is recommended to use a Process Simulate 32 bits installation, at least up to Tecnomatix 12.1. In 12.1, together with Visual Studio 2013, it is now possible to develop on top of a PS 64bit installation.