Page 1 of 3

comma as decimal separator in cnc code

Posted: Sat Oct 03, 2015 11:42 am
by peter
to get comma as decimal separator in cnc code, how to manage it, please?

1 TOOL DEF 01 L+0 R+0,05
2 TOOL CALL 01 Z S 2000
3 L X+100,000 Y+0,000 R0 F9998 M13
4 L Z-0,300 R0 F30 M
5 CC X+0,000 Y+0,000
6 C X-100,000 Y+0,000 DR+ R0 F30 M
7 CC X+0,000 Y+0,000
8 C X+100,000 Y+0,000 DR+ R0 F30 M
9 L Z+1,000 R0 F9999 M30

Re: comma as decimal separator in code constructor

Posted: Sat Oct 03, 2015 11:50 am
by andrew
Please elaborate. What do you mean by code constructor? Do you have an example or screenshot? Thanks

Re: comma as decimal separator in cnc code

Posted: Sat Oct 03, 2015 1:53 pm
by peter
is it possible to modify a CamExporter.js to get decimal comma?
CAM configuration dialog

Re: comma as decimal separator in cnc code

Posted: Sat Oct 03, 2015 5:56 pm
by andrew
peter wrote:is it possible to modify a CamExporter.js to get decimal comma?
Yes, QCAD/CAM is configured through JavaScript. A comma for X values could for example be forced by overriding getXCode:
Tnc145.prototype.getXCode = function(value) {
    var ret = GCode.prototype.getXCode.call(this, value);
    return ret.replace(".", ",");
};
I'm happy to assist you with creating a complete configuration for Tnc145 next week.

Re: comma as decimal separator in cnc code

Posted: Sat Oct 03, 2015 8:00 pm
by peter
Thank you, very pleasant!

Re: comma as decimal separator in cnc code

Posted: Tue Oct 06, 2015 12:38 pm
by andrew
peter: You can now download the latest QCAD/CAM release 3.11.0 which contains a configuration called 'Tnc145'. This should be seen as a starting point for a configuration for your machine. Please test and get back to me with feedback, so I can make the necessary adjustments.

You can access your update using the direct link sent to you via e-mail after purchase or by following our detailed instructions at:
http://www.qcad.org/en/customer-area

Re: comma as decimal separator in cnc code

Posted: Wed Oct 07, 2015 5:17 pm
by peter
adrew: Thank you, it looks already very fine, really!

nice
'
this.useComma = true;
this.trailingZeros = true;
'
1 TOOL DEF 01 L+0 R+0.05
2 TOOL CALL 01 Z S 2000
3 L Z-0,300 R0 F30 M
4 X+22,478 Y+65,333 R0 F30 M -> 4 L X+22,478 Y+65,333 R0 F30 M
5 X+44,817 Y+76,059 R0 F30 M -> 5 L X+44,817 Y+76,059 R0 F30 M
6 CC X+22,829 Y+121,854
7 C X+72,183 Y+133,887 DR+ R0 F30 M
8 L X+51,279 Y+219,625 R0 F30 M
9 L Z+1,000 R0 F9999 M30

Re: comma as decimal separator in cnc code

Posted: Wed Oct 07, 2015 6:57 pm
by andrew
Line one is part of the two line fixed header:
this.writeLine("TOOL DEF 01 L+0 R+0.05");
this.writeLine("TOOL CALL 01 Z S 2000");
You can simply adjust that to whatever exact contents you need for the first two lines.

I've also attached the updated configuration file with R+0,05 for your reference.

Re: comma as decimal separator in cnc code

Posted: Wed Oct 07, 2015 7:23 pm
by peter
andrew, I am sorry, I was wrong with my earlier statement concerning R+0.05 it is really not used with comma, TNC 145 accepts R+0.05

but in Line 4 and Line 5 of code example "L " as the leading letter is needed.
Just now I produced the following code with another well prepared and really working postprocessor:

1 TOOL DEF 01 L+ R+0.05
2 TOOL CALL 01 Z S 2000
3 L X+0,000 Y+0,000 R0 F9998 M13
4 L Z-0,300 R0 F30 M
5 L X+22,478 Y+65,333 R0 F30 M
6 L X+44,817 Y+76,059 R0 F30 M
7 CC X+22,829 Y+121,854
8 C X+72,183 Y+133,887 DR+ R0 F30 M
9 L X+51,279 Y+219,625 R0 F30 M
10 L Z+1,000 R0 F9999 M30

it seems we are missing relevant content in line 3 of example above

Re: comma as decimal separator in cnc code

Posted: Wed Oct 07, 2015 10:49 pm
by andrew
I've attached another update with forced output of L for every linear move.

Re: comma as decimal separator in cnc code

Posted: Thu Oct 08, 2015 4:54 am
by peter
"L " for linear moves works fine now.

Line3 is still missed as output
3 L X+0,000 Y+0,000 R0 F9999 M13

Re: comma as decimal separator in cnc code

Posted: Thu Oct 08, 2015 9:45 am
by andrew
I've attached an update.

Changes:
- Changed first line of header from "TOOL DEF 01 L+0 R+0,05" to "TOOL DEF 01 L+ R+0,05"
- Force first move, even if it's to 0,0

Re: comma as decimal separator in cnc code

Posted: Thu Oct 08, 2015 1:32 pm
by peter
andrew, it works fine, thank you for your help, absolutely great job!
If we need your help for a other untested sequence, I would like to come back here and ask you, please?

Re: comma as decimal separator in cnc code

Posted: Thu Oct 08, 2015 1:37 pm
by andrew
Sure, no problem. Be sure to also look at the file Tnc145.js. Many things can be adjusted easily, even with limited JavaScript or QCAD/CAM expertise.

Re: comma as decimal separator in cnc code

Posted: Thu Oct 08, 2015 5:01 pm
by peter
next days we will test this on MIKRON TNC145, thank you so far!

after moving to a next contour happens a little error

1 TOOL DEF 01 L+ R+0,05
2 TOOL CALL 01 Z S 2000
3 L X+1,272 Y+0,400 R0 F9999 M13
4 L Z-0,300 R0 F30 M
5 L X+0,272 R0 F30 M
6 L Y-0,533 R0 F30 M
7 CC X+0,737 Y-1,136
8 C X+0,806 Y-0,378 DR- R0 F30 M
9 CC X+0,745 Y-1,018
10 C X+1,206 Y-1,467 DR- R0 F30 M
11 CC X+0,777 Y-1,046
12 C X+0,250 Y-1,333 DR- R0 F30 M
13 L Z+1,000 R0 F9999 M13 F30
14 L X-1,350 R0 F9999 M13
15 CC X-0,814 Y-1,027 <<<<<<<<<<<<<<<<
16 L Z-0,300 R0 F30 M <<<<<<<<<<<<<<<<
17 C X-0,817 Y-1,644 DR+ R0 F30 M
18 CC X-0,817 Y-1,122
19 C X-0,817 Y-0,600 DR+ R0 F30 M
20 CC X-0,817 Y-0,078
21 C X-0,817 Y+0,444 DR+ R0 F30 M
22 CC X-0,813 Y-0,139
23 C X-1,350 Y+0,089 DR+ R0 F30 M
24 L Z+1,000 R0 F9999 M30