Please check UC.Readkey function

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

Please check UC.Readkey function

Postby shad » Sun Nov 05, 2017 7:12 am

Hello Balazs!
Please check UC.Readkey function.
I had situation with empty key value in profile file.
Key was without value:
Code: Select all
OxySlideOffset =

When I try to read this key it's return nothing. I was sure ReadKey function return defaul value. For example this function must return "0" string in any case:
Code: Select all
string value = UC.Readkey("PlasmaOxyPinMapping", "OxySlideOffset", "0");

Or I am wrong?
-- Andrew
UC400ETH
UC300ETH-5LPT
NEURON Lite THC
http://neuroncnc.com/
shad
 
Posts: 333
Joined: Thu Sep 15, 2016 5:23 pm

Re: Please check UC.Readkey function

Postby Dan911 » Sun Nov 05, 2017 9:20 am

Testing I've done with Read/Write key... is Readkey never looks at the value you input and just writes value of key your reading. If that value is empty it will return empty. If you want a default value for a key you need to write it there.

Dan
Dan911
 
Posts: 613
Joined: Mon Oct 31, 2016 1:22 am
Location: USA

Re: Please check UC.Readkey function

Postby cncdrive » Sun Nov 05, 2017 10:26 am

Hi Andrew,

If the key is defined in the profile file, but the value is empty then the Readkey function will return an empty string.
The Readkey function returns the default value only if the key is not defined.

If you don't allow empty value then simply test the read value for empty string and if it matches then give it a different value or do your exception routine.
cncdrive
Site Admin
 
Posts: 5183
Joined: Tue Aug 12, 2014 11:17 pm

Re: Please check UC.Readkey function

Postby shad » Tue Nov 07, 2017 5:29 pm

Hello!
Thank you for explain.
Balazs, please do not forgot about function in the API for turn on moveback on arc lost future independent from the THC ON/OFF state.
-- Andrew
UC400ETH
UC300ETH-5LPT
NEURON Lite THC
http://neuroncnc.com/
shad
 
Posts: 333
Joined: Thu Sep 15, 2016 5:23 pm


Return to Plugins

Who is online

Users browsing this forum: No registered users and 5 guests