comma as decimal separator in cnc code

Discussions around the CAM Add-On of QCAD.

Moderator: andrew

Forum rules

Always indicate your operating system and QCAD version.

Indicate the post processor used.

Attach drawing files and screenshots.

Post one question per topic.

peter
Junior Member
Posts: 17
Joined: Sat Oct 03, 2015 11:27 am

comma as decimal separator in cnc code

Post by peter » Sat Oct 03, 2015 11:42 am

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
Last edited by peter on Sat Oct 03, 2015 1:41 pm, edited 3 times in total.

User avatar
andrew
Site Admin
Posts: 9019
Joined: Fri Mar 30, 2007 6:07 am

Re: comma as decimal separator in code constructor

Post by andrew » Sat Oct 03, 2015 11:50 am

Please elaborate. What do you mean by code constructor? Do you have an example or screenshot? Thanks

peter
Junior Member
Posts: 17
Joined: Sat Oct 03, 2015 11:27 am

Re: comma as decimal separator in cnc code

Post by peter » Sat Oct 03, 2015 1:53 pm

is it possible to modify a CamExporter.js to get decimal comma?
CAM configuration dialog
Attachments
dialog.jpg
dialog.jpg (70.08 KiB) Viewed 38961 times

User avatar
andrew
Site Admin
Posts: 9019
Joined: Fri Mar 30, 2007 6:07 am

Re: comma as decimal separator in cnc code

Post by andrew » Sat Oct 03, 2015 5:56 pm

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.

peter
Junior Member
Posts: 17
Joined: Sat Oct 03, 2015 11:27 am

Re: comma as decimal separator in cnc code

Post by peter » Sat Oct 03, 2015 8:00 pm

Thank you, very pleasant!

User avatar
andrew
Site Admin
Posts: 9019
Joined: Fri Mar 30, 2007 6:07 am

Re: comma as decimal separator in cnc code

Post by andrew » Tue Oct 06, 2015 12:38 pm

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

peter
Junior Member
Posts: 17
Joined: Sat Oct 03, 2015 11:27 am

Re: comma as decimal separator in cnc code

Post by peter » Wed Oct 07, 2015 5:17 pm

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
Last edited by peter on Wed Oct 07, 2015 7:00 pm, edited 1 time in total.

User avatar
andrew
Site Admin
Posts: 9019
Joined: Fri Mar 30, 2007 6:07 am

Re: comma as decimal separator in cnc code

Post by andrew » Wed Oct 07, 2015 6:57 pm

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.
Attachments
Tnc145.js
Replaces file scripts/Cam/CamConfigurations/Tnc145.js
(2.41 KiB) Downloaded 1077 times

peter
Junior Member
Posts: 17
Joined: Sat Oct 03, 2015 11:27 am

Re: comma as decimal separator in cnc code

Post by peter » Wed Oct 07, 2015 7:23 pm

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
Attachments
Test TNC.dxf
(100.07 KiB) Downloaded 1072 times

User avatar
andrew
Site Admin
Posts: 9019
Joined: Fri Mar 30, 2007 6:07 am

Re: comma as decimal separator in cnc code

Post by andrew » Wed Oct 07, 2015 10:49 pm

I've attached another update with forced output of L for every linear move.
Attachments
Tnc145.js
(2.48 KiB) Downloaded 1045 times

peter
Junior Member
Posts: 17
Joined: Sat Oct 03, 2015 11:27 am

Re: comma as decimal separator in cnc code

Post by peter » Thu Oct 08, 2015 4:54 am

"L " for linear moves works fine now.

Line3 is still missed as output
3 L X+0,000 Y+0,000 R0 F9999 M13
Attachments
TNC145 dev.JPG
TNC145 dev.JPG (120.61 KiB) Viewed 38738 times

User avatar
andrew
Site Admin
Posts: 9019
Joined: Fri Mar 30, 2007 6:07 am

Re: comma as decimal separator in cnc code

Post by andrew » Thu Oct 08, 2015 9:45 am

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
Attachments
Tnc145.js
(2.73 KiB) Downloaded 1052 times

peter
Junior Member
Posts: 17
Joined: Sat Oct 03, 2015 11:27 am

Re: comma as decimal separator in cnc code

Post by peter » Thu Oct 08, 2015 1:32 pm

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?

User avatar
andrew
Site Admin
Posts: 9019
Joined: Fri Mar 30, 2007 6:07 am

Re: comma as decimal separator in cnc code

Post by andrew » Thu Oct 08, 2015 1:37 pm

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.

peter
Junior Member
Posts: 17
Joined: Sat Oct 03, 2015 11:27 am

Re: comma as decimal separator in cnc code

Post by peter » Thu Oct 08, 2015 5:01 pm

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
Attachments
35.JPG
35.JPG (40.88 KiB) Viewed 38701 times

Post Reply

Return to “QCAD/CAM”