cancel
Showing results for 
Search instead for 
Did you mean: 

.NET API (C#) creating a pick listener

Valued Contributor
Valued Contributor

Hi all,

 

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: handler.PNG

 

 

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. 

 

Best Regards,

 

Pim

23 REPLIES

Re: .NET API (C#) creating a pick listener

Legend
Legend

Hi Pim,

 

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);

 

Or

 

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!

 

Regards,

Patrick

 

 

Re: .NET API (C#) creating a pick listener

Valued Contributor
Valued Contributor

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.

 

Best Regards,

 

Pim

Re: .NET API (C#) creating a pick listener

Valued Contributor
Valued Contributor

Hello Patrick,

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..

Best Regards,

Pim

Re: .NET API (C#) creating a pick listener

Legend
Legend

Hi Pim,

 

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.

 

Regards,

 

Patrick

 

 

Re: .NET API (C#) creating a pick listener

Siemens Phenom Siemens Phenom
Siemens Phenom
Patrick is, as always, right ;-)

Just a hint:
Even to deploy your dll on other machines it’s not necessary to use CommandReg.exe.
Just copy both, xml and dll.

-----------------
Siemens Industry Software GmbH & Co. KG; Anschrift: Franz-Geuer-Str. 10, 50823 Köln;
Kommanditgesellschaft: Sitz der Gesellschaft: Köln; Registergericht: Amtsgericht Köln, HRA 28227;
Geschäftsführung und persönlich haftender Gesellschafter: Siemens Industry Software Management GmbH;
Geschäftsführer: Urban August, Daniel Trebes; Sitz der Gesellschaft: Köln; Registergericht: Amtsgericht Köln, HRB 70858

Re: .NET API (C#) creating a pick listener

Valued Contributor
Valued Contributor

Great, thank you Patrick and Guido for your answers!

 

Pim

Re: .NET API (C#) creating a pick listener

Valued Contributor
Valued Contributor

Hi Patrick,

 

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?

 

Best Regards,

 

Pim

Re: .NET API (C#) creating a pick listener

Siemens Phenom Siemens Phenom
Siemens Phenom

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.

Re: .NET API (C#) creating a pick listener

Valued Contributor
Valued Contributor

Thank you, I didnt knew about that. I working with PS 12.0, and visual studio express 2010. I'm going to try this with PS 12.1!