comma as decimal separator in cnc code
Moderator: andrew
comma as decimal separator in cnc code
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 Z0,300 R0 F30 M
5 CC X+0,000 Y+0,000
6 C X100,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
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 Z0,300 R0 F30 M
5 CC X+0,000 Y+0,000
6 C X100,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
Last edited by peter on Sat Oct 03, 2015 1:41 pm, edited 3 times in total.
Re: comma as decimal separator in code constructor
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
is it possible to modify a CamExporter.js to get decimal comma?
CAM configuration dialog
CAM configuration dialog
 Attachments

 dialog.jpg (70.08 KiB) Viewed 12925 times
Re: comma as decimal separator in cnc code
Yes, QCAD/CAM is configured through JavaScript. A comma for X values could for example be forced by overriding getXCode:peter wrote:is it possible to modify a CamExporter.js to get decimal comma?
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
Thank you, very pleasant!
Re: comma as decimal separator in cnc code
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 email after purchase or by following our detailed instructions at:
http://www.qcad.org/en/customerarea
You can access your update using the direct link sent to you via email after purchase or by following our detailed instructions at:
http://www.qcad.org/en/customerarea
Re: comma as decimal separator in cnc code
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 Z0,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
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 Z0,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
Last edited by peter on Wed Oct 07, 2015 7:00 pm, edited 1 time in total.
Re: comma as decimal separator in cnc code
Line one is part of the two line fixed header:
I've also attached the updated configuration file with R+0,05 for your reference.
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.
 Attachments

 Tnc145.js
 Replaces file scripts/Cam/CamConfigurations/Tnc145.js
 (2.41 KiB) Downloaded 322 times
Re: comma as decimal separator in cnc code
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 Z0,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
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 Z0,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
 Attachments

 Test TNC.dxf
 (100.07 KiB) Downloaded 320 times
Re: comma as decimal separator in cnc code
I've attached another update with forced output of L for every linear move.
 Attachments

 Tnc145.js
 (2.48 KiB) Downloaded 301 times
Re: comma as decimal separator in cnc code
"L " for linear moves works fine now.
Line3 is still missed as output
3 L X+0,000 Y+0,000 R0 F9999 M13
Line3 is still missed as output
3 L X+0,000 Y+0,000 R0 F9999 M13
 Attachments

 TNC145 dev.JPG (120.61 KiB) Viewed 12702 times
Re: comma as decimal separator in cnc code
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
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
 Attachments

 Tnc145.js
 (2.73 KiB) Downloaded 321 times
Re: comma as decimal separator in cnc code
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?
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
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
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 Z0,300 R0 F30 M
5 L X+0,272 R0 F30 M
6 L Y0,533 R0 F30 M
7 CC X+0,737 Y1,136
8 C X+0,806 Y0,378 DR R0 F30 M
9 CC X+0,745 Y1,018
10 C X+1,206 Y1,467 DR R0 F30 M
11 CC X+0,777 Y1,046
12 C X+0,250 Y1,333 DR R0 F30 M
13 L Z+1,000 R0 F9999 M13 F30
14 L X1,350 R0 F9999 M13
15 CC X0,814 Y1,027 <<<<<<<<<<<<<<<<
16 L Z0,300 R0 F30 M <<<<<<<<<<<<<<<<
17 C X0,817 Y1,644 DR+ R0 F30 M
18 CC X0,817 Y1,122
19 C X0,817 Y0,600 DR+ R0 F30 M
20 CC X0,817 Y0,078
21 C X0,817 Y+0,444 DR+ R0 F30 M
22 CC X0,813 Y0,139
23 C X1,350 Y+0,089 DR+ R0 F30 M
24 L Z+1,000 R0 F9999 M30
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 Z0,300 R0 F30 M
5 L X+0,272 R0 F30 M
6 L Y0,533 R0 F30 M
7 CC X+0,737 Y1,136
8 C X+0,806 Y0,378 DR R0 F30 M
9 CC X+0,745 Y1,018
10 C X+1,206 Y1,467 DR R0 F30 M
11 CC X+0,777 Y1,046
12 C X+0,250 Y1,333 DR R0 F30 M
13 L Z+1,000 R0 F9999 M13 F30
14 L X1,350 R0 F9999 M13
15 CC X0,814 Y1,027 <<<<<<<<<<<<<<<<
16 L Z0,300 R0 F30 M <<<<<<<<<<<<<<<<
17 C X0,817 Y1,644 DR+ R0 F30 M
18 CC X0,817 Y1,122
19 C X0,817 Y0,600 DR+ R0 F30 M
20 CC X0,817 Y0,078
21 C X0,817 Y+0,444 DR+ R0 F30 M
22 CC X0,813 Y0,139
23 C X1,350 Y+0,089 DR+ R0 F30 M
24 L Z+1,000 R0 F9999 M30
 Attachments

 35.JPG (40.88 KiB) Viewed 12665 times