GCode toolchanging sequence!

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.

Post Reply
Sprung
Junior Member
Posts: 11
Joined: Thu Jun 10, 2021 11:35 am

GCode toolchanging sequence!

Post by Sprung » Wed Jun 23, 2021 9:52 am

Hello Andrew,
i am using the G-code (Offset)[mm] postprocessor with a minor adaption, only the header and footer is adapted.
The question:
My machine has an automatic toolchanger(Isel CV4030). As you see, at the beginning of the G-Code the Code starts not with changing the tool (N40) but starts to move to the saftey height and than moves to the first drill coordiante. As i am using G90 in the header this is critical because my machine starts after toolchanging at a stoppoint of the toolchanging move.
So what i need is to start with toolchanging and then move to the first coordinate, after that the coordinates are modal. If i set the machine with the right tool so that no toolchanging is necessary, the code is fine. But when i have a job with different tools iam always running in to this issue.
How to solve it?

Output of Drilltoolpath:
N10 G40 G69 G71 G90 G94 G97
N20 G0 Z3
N30 G0 X15 Y0
N40 T2 M6
N50 S3300 M03
N60 G0 Z2
N70 G1 Z-2 F33
N80 Z2
.
.
.
etc.

thanks,
Matura

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

Re: GCode toolchanging sequence!

Post by andrew » Mon Jun 28, 2021 9:23 am

This is a bit involved to change.
We will add a tool change mode to configure if the tool change is written before or after the first move.

Sprung
Junior Member
Posts: 11
Joined: Thu Jun 10, 2021 11:35 am

Re: GCode toolchanging sequence!

Post by Sprung » Wed Jul 07, 2021 8:55 am

Hi Andrew,
can you give me a timeframe when this feature will be implemented?

greetings
Matura

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

Re: GCode toolchanging sequence!

Post by andrew » Wed Jul 07, 2021 8:34 pm

This has been implemented for the next release and will be included in the next (snapshot) release (in 1-2 weeks).

Essentially, you can set the tool change mode in your constructor to either one of:

Code: Select all

// tool change before moving to safety Z level:
this.toolChangeMode = CamExporterV2.FirstMoveMode.BeforeFirstZMove

// tool change after Z move to safety level and before first X/Y move:
this.toolChangeMode = CamExporterV2.FirstMoveMode.BeforeFirstXYMove

// tool change after first X/Y move:
this.toolChangeMode = CamExporterV2.FirstMoveMode.AfterFirstXYMove;

n_spect_r
Active Member
Posts: 44
Joined: Tue Jun 18, 2019 12:09 pm

Re: GCode toolchanging sequence!

Post by n_spect_r » Sat May 28, 2022 1:25 am

Running LinuxMint 20, 64 bit. Qcadcam 3.25.2
I have the same issue and trying to figure out how to make this work. I wrote a post for our machine, tried adding these lines in the post, no luck.
Can you show an example of where and how it is placed.
Here is a generated code with a tool change. I want the tool to rapid to .25, which it does after the change but the first tool changes after the move and does not rapid to .25. Also attached is my post. I am trying to find a way to add a decimal to the feed rate. Our machine interprets a number without a decimal as a thousandth.
Thanks. I love the software, been using it quite a bit and making manual edits but there has to be an easier way.


(square.nc -- Fri 27 May 2022 08:18:35 PM EDT)
N10 G17 G20 G40 G90
N20 G56
N30 G0 Z2.0000
N40 G0 Z0.2500
N50 M6 T1 G43 H1
N60 M03 S8000 M08
N70 G1 Z-0.2000 F10
N80 X0.0000 Y-11.1000 F45
N90 X-15.6000
N100 Y0.0000
N110 X0.0000
N120 Z0.2500
N130 G0 Z2.0000


N140 M6 T2 G43 H2
N150 M03 S12000 M08
N160 G0
N170 G0 Z0.2500
N180 G1 Z-0.1000 F6
N190 X-3.4899 Y-7.7051 F20
N200 X-11.1359
N210 Y-2.0665
N220 X-3.4899
N230 Z0.2500
N240 G0 Z2.0000
N250 M30

include("GCodeBase.js");
// Constructor of our class:
function MYCODE2(documentInterface, newDocumentInterface) {
// Call constructor of base class:
GCodeBase.call(this, documentInterface, newDocumentInterface);
this.decimals = 4;
this.unit = RS.Inch;
this.options = { trailingZeroes:true };
this.outputOffsetPath = true;

this.header = [
"([FILENAME] -- [DATETIME])",
"[N] G17 G20 G40 G90",
"[N] G56",
]



this.toolHeader = [
"[N] M6 [T] G43 H[T#]",
"[N] M03 [S] M08",
]

// rapid moves:

this.rapidMove = "[N] G0 [Z]";



}

MYCODE2.prototype = new GCodeBase();
MYCODE2.displayName = "MYCODE2";

CVH
Premier Member
Posts: 3364
Joined: Wed Sep 27, 2017 4:17 pm

Re: GCode toolchanging sequence!

Post by CVH » Sat May 28, 2022 6:01 am

n_spect_r wrote:
Sat May 28, 2022 1:25 am
I am trying to find a way to add a decimal to the feed rate.
F10 to F45, that would probably be in inch/minute ... But then even 45 thousandths/minute would be very slow :wink:

There 'MYCODE2' is derived from 'GCodeBase' you need to override the variable registration for feedrate:

Code: Select all

this.registerVariable("feedRate",            "F",                    false, "F", 0);
Where the zero is the number of decimals.

TIP: Do not change this line in 'GCodeBase' as that script is overwritten each update.
Simply include a copy of that line in your post called 'MYCODE2'.

Regards,
CVH

n_spect_r
Active Member
Posts: 44
Joined: Tue Jun 18, 2019 12:09 pm

Re: GCode toolchanging sequence!

Post by n_spect_r » Sat May 28, 2022 1:27 pm

Thank you, that worked for the decimals after feed rate. This is inches per minute. It's not realistic, I just threw in some numbers for an example.
I also found that it will not place a decimal if the value is zero 10.0 will export as 10 and not 10.0.
Now I just need to get a tool change before any movement and we're golden.

(square.nc -- Sat 28 May 2022 08:22:27 AM EDT)
N10 G17 G20 G40 G90
N20 G56
N30 G0 Z2.0000
N40 G0 Z0.2500
N50 M6 T1 G43 H1
N60 M03 S10000 M08
N70 G1 Z-0.2000 F10.5
N80 X0.0000 Y2.0000 F40.3
N90 X2.0000
N100 Y0.0000
N110 X0.0000
N120 Z0.2500
N130 G0 Z2.0000
N140 M6 T2 G43 H2
N150 M03 S12000 M08
N160 G0
N170 G0 Z0.2500
N180 G1 Z-0.1000 F10.5
N190 X0.6820 Y1.6131 F45.5
N200 X1.5001
N210 Y0.7859
N220 X0.6820
N230 Z0.2500
N240 G0 Z2.0000
N250 M30

include("GCodeBase.js");
// Constructor of our class:
function MYCODE2(documentInterface, newDocumentInterface) {
// Call constructor of base class:
GCodeBase.call(this, documentInterface, newDocumentInterface);
this.registerVariable("feedRate", "F", false, "F", 2);
this.decimals = 4;
this.unit = RS.Inch;
this.options = { trailingZeroes:true };
this.outputOffsetPath = true;

this.header = [
"([FILENAME] -- [DATETIME])",
"[N] G17 G20 G40 G90",
"[N] G56",
]



this.toolHeader = [
"[N] M6 [T] G43 H[T#]",
"[N] M03 [S] M08",
]

// rapid moves:

this.rapidMove = "[N] G0 [Z]";



}

MYCODE2.prototype = new GCodeBase();
MYCODE2.displayName = "MYCODE2";

n_spect_r
Active Member
Posts: 44
Joined: Tue Jun 18, 2019 12:09 pm

Re: GCode toolchanging sequence!

Post by n_spect_r » Mon May 30, 2022 2:53 pm

I want to say thanks for anyone who had input on this. I bought the latest version and things are working pretty good. There are some items I'd still like to work out, but they are not critical items. When the tool is done with cuts, the Z move to clearance is still in G1, an easy edit, I like to go into G0 for the Z exits. And in this sample program, I am cutting a spiral hole using a P number to indicate the number of spirals. This post will be used primarily on a Mazak Nexus and also on an old Bridgeport converted to LinuxCNC. Both of these will spiral down with the P number. I've been doing this for a long time and it's easy enough. Having a built in option to spiral holes would be nice. We had an issue once where a tool offset did not automatically load, so it's my policy to always add a G43. The Mazak did not like it on the same line as the tool change, and it needed some sort of speed and move. This line in the tool header solved that problem. "[N] G0 G43 H[T#] G53 Z0.0", When I get this done to where I like it, you are welcome to include it in builds as a Mazak post. And I am looking for a way to add a parenthetical value after the tool change; M6 T3 (.5 mill). Again, this is not a critical item, a replace all does it while editing.

include("GCodeBase.js");
// Constructor of our class:
function MYCODE2(documentInterface, newDocumentInterface) {
// Call constructor of base class:
GCodeBase.call(this, documentInterface, newDocumentInterface);
this.registerVariable("feedRate", "F", false, "F", 2);
// tool change before moving to safety Z level:
this.toolChangeMode = CamExporterV2.FirstMoveMode.BeforeFirstZMove;
this.decimals = 4;
this.unit = RS.Inch;
this.options = { trailingZeroes:true };
this.outputOffsetPath = true;

this.header = [
"([FILENAME] -- [DATETIME])",
"[N] G17 G20 G40 G90",
"[N] G56",
]


this.toolHeader = [
"[N] M6 [T]",
"[N] G0 G43 H[T#] G53 Z0.0",
"[N] M03 [S] M08",
]

// rapid moves:

this.rapidMove = "[N] G0 [Z]";

// header / footer before / after output:
this.footer = [
"[N] G53 Z0.0",
"[N] G53 X-25.5 Y0.0",
"[N] M30",
]

}

MYCODE2.prototype = new GCodeBase();
MYCODE2.displayName = "MYCODE2";

(TEST PART.nc -- Mon 30 May 2022 09:24:01 AM EDT)
N10 G17 G20 G40 G90
N20 G56
N30 M6 T3
N40 G0 G43 H3 G53 Z0.0
N50 M03 S1000 M08
N60 G0 Z2.0000
N70 G0
N80 G0 Z0.2500
N90 G1 Z-0.1429 F12.1
N100 X0.0000 Y-0.0000 F78.2
N110 Y-1.0000
N120 X-3.0000
N130 Y0.0000
N140 X0.0000
N150 X0.3800
N160 Z0.2500
N170 G0
N180 G1 Z-0.2857 F12.1
N190 X0.0000 Y-0.0000 F78.2
N200 Y-1.0000
N210 X-3.0000
N220 Y0.0000
N230 X0.0000
N240 X0.3800
N250 Z0.2500
N260 G0
N270 G1 Z-0.4286 F12.1
N280 X0.0000 Y-0.0000 F78.2
N290 Y-1.0000
N300 X-3.0000
N310 Y0.0000
N320 X0.0000
N330 X0.3800
N340 Z0.2500
N350 G0
N360 G1 Z-0.5714 F12.1
N370 X0.0000 Y-0.0000 F78.2
N380 Y-1.0000
N390 X-3.0000
N400 Y0.0000
N410 X0.0000
N420 X0.3800
N430 Z0.2500
N440 G0
N450 G1 Z-0.7143 F12.1
N460 X0.0000 Y-0.0000 F78.2
N470 Y-1.0000
N480 X-3.0000
N490 Y0.0000
N500 X0.0000
N510 X0.3800
N520 Z0.2500
N530 G0
N540 G1 Z-0.8571 F12.1
N550 X0.0000 Y-0.0000 F78.2
N560 Y-1.0000
N570 X-3.0000
N580 Y0.0000
N590 X0.0000
N600 X0.3800
N610 Z0.2500
N620 G0
N630 G1 Z-1.0000 F12.1
N640 X0.0000 Y-0.0000 F78.2
N650 Y-1.0000
N660 X-3.0000
N670 Y0.0000
N680 X0.0000
N690 X0.3800
N700 Z0.2500
N710 G0 Z2.0000
N720 M6 T4
N730 G0 G43 H4 G53 Z0.0
N740 M03 S12000 M08
N750 G0
N760 G0 Z0.2500
N770 G1 Z-0.1000 F10.1
N780 X-0.2500 Y-0.2500 F60.2
N790 Y-0.7500
N800 X-1.0000
N810 Y-0.2500
N820 X-0.2500
N830 X-0.0500
N840 Z0.2500
N850 G0
N860 G1 Z-0.1000 F10.1
N870 X-2.0000 F60.2
N880 Y-0.7500
N890 X-2.7500
N900 Y-0.2500
N910 X-2.0000
N920 X-1.8000
N930 Z0.2500
N940 G0
N950 G1 Z-0.1000 F10.1
N960 X-1.5000 Y0.0000 F60.2
N970 Y-1.0000
N980 Y-1.2000
N990 Z0.2500

N1000 X-1.5 Y-0.3125
N1010 G3 X-1.5 Y-0.3125 Z-1.1 I0.0 J-0.1875 P15
N1020 GO Z0.25
N1030 Z2.0
N1040 G0 Z2.0000
N1050 G53 Z0.0
N1060 G53 X-25.5 Y0.0
N1070 M30

Post Reply

Return to “QCAD/CAM”