plugin - debug issue

This is where you talk about Plugins. How they are made and how they work, show examples.

Re: plugin - debug issue

Postby shad » Sun Sep 18, 2016 4:04 pm

I think function double Getfielddouble(bool isAS3, int labelnumber); not working, because always return zero.
I am use string Getfield(bool isAS3, int fieldnumber); and void Setfieldtext(bool isAS3, string val, int fieldnumber);
One thing - during the conversion double values to/from string is required to specify IFormat provider. For example
UC.Setfieldtext(true, TargetArcVoltage.ToString("#,0.00",System.Globalization.CultureInfo.InvariantCulture), 2700);
Otherwise an exception occurs. Just decimal point for different culture can be "," or "."
-- Andrew
UC400ETH
UC300ETH-5LPT
NEURON Lite THC
http://neuroncnc.com/
shad
 
Posts: 332
Joined: Thu Sep 15, 2016 5:23 pm

Re: plugin - debug issue

Postby cncdrive » Sun Sep 18, 2016 11:21 pm

I will have to check the Getfielddouble to see if it is really not working.

And you are right, you have to set the Cultureinfo for your numbers that is the only way you can be sure that the code will run properly on systems with any languages.
You can do it globally in your threads (place code to the beginning of the thread) with the following codes:

Thread.CurrentThread.CurrentUICulture = new CultureInfo("en-US", false);
Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US", false);

The UCCNC doing the same in all of it's threads, so it will always look for "en-US" formatted numbers,
and if you set the same then it will sure work OK and you then do not have to set the numbers formats always individually.
cncdrive
Site Admin
 
Posts: 4887
Joined: Tue Aug 12, 2014 11:17 pm

Re: plugin - debug issue

Postby shad » Mon Sep 19, 2016 8:45 am

Thank you!
-- Andrew
UC400ETH
UC300ETH-5LPT
NEURON Lite THC
http://neuroncnc.com/
shad
 
Posts: 332
Joined: Thu Sep 15, 2016 5:23 pm

Previous

Return to Plugins

Who is online

Users browsing this forum: No registered users and 1 guest