comma as decimal separator in cnc code

Discussions around the CAM Add-On of QCAD.

Moderator: andrew

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

Re: comma as decimal separator in cnc code

Post by andrew » Thu Oct 08, 2015 8:27 pm

Makes sense, yes. Update attached.

Changes:
- always prepare for cutting before defining arc center (CC)
Attachments
Tnc145.js
(2.76 KiB) Downloaded 427 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 » Fri Oct 09, 2015 11:23 am

andrew, it works fine, thank you so much!
first move is executed on Z level 0 but should be Z Clear?

1 TOOL DEF 01 L+ R+0.6
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 L Z-0,300 R0 F30 M
16 CC X-0,814 Y-1,027
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
K-3353 engraved within 7mm diameter.txt
(1.69 KiB) Downloaded 462 times
K-3353 engrave works fine.JPG
K-3353 engrave works fine.JPG (47.29 KiB) Viewed 15393 times
35 engrave works fine.JPG
35 engrave works fine.JPG (27.18 KiB) Viewed 15395 times
Last edited by peter on Fri Oct 09, 2015 12:26 pm, edited 1 time in total.

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

Re: comma as decimal separator in cnc code

Post by andrew » Fri Oct 09, 2015 12:14 pm

peter wrote:our first move seems to be executed on Z level 0 but should be Z Clear?
Can you correct the first 4 lines of the program and post them, so I can update the configuration, 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 » Fri Oct 09, 2015 3:35 pm

1 TOOL DEF 01 L+ R+0.6
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
'
'

andrew, I am not shure, it may be perfect as it is, it looks like original TNC145 header syntax, I have to find it out on the machine.

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

Re: comma as decimal separator in cnc code

Post by peter » Mon Oct 12, 2015 11:42 am

behavior of TNC is perfect with the actual header syntax, moving 3 L X+1,272 Y+0,400 R0 F9999 M13 with holding last Z level, then 4 L Z-0,300 R0 F30 M

to get program input to TNC145 without error. there must be

1 TOOL DEF 01 L+ R+0.6 >>>>>>>>> 1 TOOL DEF 01 L+0 R+0.6 <<<<<<<<<<<<<< L+0
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 >>>>>>>>> 13 L Z+1,000 R0 F9999 M13 <<<<<<<<<<<<<< without F30
14 L X-1,350 R0 F9999 M13
15 L Z-0,300 R0 F30 M
Last edited by peter on Mon Oct 12, 2015 11:53 am, edited 1 time in total.

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

Re: comma as decimal separator in cnc code

Post by andrew » Mon Oct 12, 2015 11:49 am

OK, great. Thanks for the confirmation.

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

Re: comma as decimal separator in cnc code

Post by peter » Mon Oct 12, 2015 11:58 am

13 L Z+1,000 R0 F9999 M13 F30 >>>>>>>>> 13 L Z+1,000 R0 F9999 M13 <<<<<<<<<<<<<< without F30

feedrate is set twice in one line is not perfect at the moment (manually edited with no problem)

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

Re: comma as decimal separator in cnc code

Post by andrew » Mon Oct 12, 2015 12:22 pm

OK, update attached.
Attachments
Tnc145.js
(2.79 KiB) Downloaded 423 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 » Mon Oct 12, 2015 3:16 pm

thank you, I've just checked CAM output file, looks perfect, fine! Machine test result will be posted later, an other question, for output file extension *.cnc instead of *.nc how to manage, please?

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

Re: comma as decimal separator in cnc code

Post by andrew » Mon Oct 12, 2015 3:21 pm

peter wrote:an other question, for output file extension *.cnc instead of *.nc how to manage, please?
Add this to your configuration:
Tnc145.prototype.getFileExtensions = function() {
    return ["cnc"];
};
Attachments
Tnc145.js
(2.86 KiB) Downloaded 412 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 » Mon Oct 12, 2015 3:36 pm

andrew, thank you for your great job, QCADCAM 3.11.0 is fine for me, looks very good in work results!

olly
Full Member
Posts: 61
Joined: Wed Jan 25, 2012 1:28 pm

Re: comma as decimal separator in cnc code

Post by olly » Sat Nov 28, 2015 6:58 pm

Good point!

This will be interesting for my TNC 430 to engrave Labels
I try to extend TNC 415 to TNC 430
Extension .cnc to .h no problem!

TrueType etc. is nice with QCad CAM ;-)
Normal contours and holes I process with my own software
Is it possible to disable layers, in my case useful for "CAM-Labels" not for the rest! (one complete CAD-file) ?

TOOL CALL with "GRAV" (comes from a Tool table) corrupts the script !
Solution for inserting " ?

is it possible to catch the filename SCHRIFT.DXF or alternativ the name of the Layer to feed the first and last line
to complete the CNC-file?

0 BEGIN PGM SCHRIFT MM
1 TOOL CALL "GRAV" Z S2500
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
10 END PGM SCHRIFT MM

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

Re: comma as decimal separator in cnc code

Post by andrew » Mon Nov 30, 2015 9:20 am

olly wrote:Is it possible to disable layers, in my case useful for "CAM-Labels" not for the rest! (one complete CAD-file) ?
Yes, simply hide those layers in the layer list (eye icon) before exporting to CAM.
olly wrote:TOOL CALL with "GRAV" (comes from a Tool table) corrupts the script !
Solution for inserting " ?
Quotes have to be escaped in JavaScript strings:
this.writeLine("TOOL CALL \"GRAV\" Z S2500");
is it possible to catch the filename SCHRIFT.DXF or alternativ the name of the Layer to feed the first and last line
to complete the CNC-file?
File name of exported file: this.fileName
File name of drawing file: this.document.getFileName()
Layer name of current layer:
var entity = this.getEntity();
var layerId = entity.getLayerId();
var layer = this.document.queryLayer(layerId);
var layerName = layer.getName();

olly
Full Member
Posts: 61
Joined: Wed Jan 25, 2012 1:28 pm

Re: comma as decimal separator in cnc code

Post by olly » Mon Nov 30, 2015 10:15 pm

Andrew thanks for your hints
one Step is to go

this.writeLine("BEGIN PGM "+this.document.getFileName()+"MM");
here I got NullString

this.writeLine("BEGIN PGM "+this.fileName+"MM");
here the complete path will be returned

OSX 10.11

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

Re: comma as decimal separator in cnc code

Post by andrew » Tue Dec 01, 2015 8:27 am

olly wrote:this.writeLine("BEGIN PGM "+this.document.getFileName()+"MM");
here I got NullString
This would indicate that the drawing has not been saved and therefore does not have a file name.
this.writeLine("BEGIN PGM "+this.fileName+"MM");
here the complete path will be returned
Yes. If you need to get the file name only, use new QFileInfo(this.fileName).fileName().

Post Reply

Return to “QCAD/CAM”