Canned drilling cycle

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
n_spect_r
Active Member
Posts: 36
Joined: Tue Jun 18, 2019 12:09 pm

Canned drilling cycle

Post by n_spect_r » Thu Sep 15, 2022 2:01 pm

I have been playing with a custom post for our Mazak nexus machines, which so far is working pretty good. We frequently drill hole patterns, and as the machines are equipped with canned cycles, G73, G81, G82, G83, I prefer to use the canned cycles. I have come up with a work around. Attached is the post and 2 programs that drill the same hole pattern. The first is the straight G code and the second is canned cycles. To get this output, I enter a zero value for Safe Z (a) and Cut Depth (c), then add the canned line. Due to the edited post, I also have to add the initial Z start move. This might help someone else out.
Attachments
Mazak.js
(2.16 KiB) Downloaded 52 times
DRILL_TEST_2.nc
(422 Bytes) Downloaded 49 times
DRILL_TEST.nc
(538 Bytes) Downloaded 52 times

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

Re: Canned drilling cycle

Post by CVH » Fri Sep 16, 2022 12:52 am

Hi,

I read that this.firstPointMoveZ and this.pointMoveZ are meant for drilling.
In GCodeBase.js they fall back on common Z moves.
It should then be possible to add the canned cycles as 'PointMoves' :wink:

Regards,
CVH

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

Re: Canned drilling cycle

Post by n_spect_r » Fri Sep 16, 2022 3:01 pm

Not sure how to go about that, but that would be awesome. Will play with it.

Thanks.

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

Re: Canned drilling cycle

Post by CVH » Fri Sep 16, 2022 8:06 pm

n_spect_r wrote:
Fri Sep 16, 2022 3:01 pm
Not sure how to go about that
At this point this.pointMoveZ export a simple G1 in Z ...
That could be a G73, G81, G82, G83 instead.

Canned cycles need some extra parameters.
There are examples to add parameters to the postprocessor dialog.

Regards,
CVH

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

Re: Canned drilling cycle

Post by n_spect_r » Sat Sep 17, 2022 11:57 am

Where do I look for these examples? I have the tutorial page on making postprocessors, can't say that I understand it but I am working on it.

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

Re: Canned drilling cycle

Post by CVH » Sat Sep 17, 2022 3:03 pm

n_spect_r wrote:
Sat Sep 17, 2022 11:57 am
Where do I look for these examples?
GCodeBase already adds one extra field to the postprocessor dialog.
See the GCodeBase.prototype.initConfigDialog function.
It is the "Always write G1" option.

Your postprocessor may overwrite this function with a specific one.
We also need to register the extra parameters so that we may include them by placeholders in the export.

With a textual search I find more than 10 occurencies of '.initConfigDialog'.

Regards,
CVH

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

Re: Canned drilling cycle

Post by n_spect_r » Mon Sep 19, 2022 5:37 pm

Thanks for the feedback. I've never done any java programming so it's a bit of a learning curve. I did add this section to my custom post and have a G73 check box. Which is pretty cool. Now trying to figure out how to get the output I want. One step at a time.

GCodeBase.prototype.initConfigDialog = function(dialog) {
// add options for laser on / off:
var group = dialog.findChild("GroupCustom");
group.title = qsTr("G-Code");

// get QVBoxLayout:
var vBoxLayout = group.layout();

// add checkbox to force G1:
var hBoxLayout = new QHBoxLayout(null);
vBoxLayout.addLayout(hBoxLayout, 0);

var cbAlwaysWriteG1 = new QCheckBox(qsTr("Always write G1"));
cbAlwaysWriteG1.objectName = "AlwaysWriteG1";
hBoxLayout.addWidget(cbAlwaysWriteG1, 0,0);

var cbG73 = new QCheckBox(qsTr("G73"))
cbG73.checked - true;
cbG73.objectName = "G73";
vBoxLayout.addWidget(cbG73, 0,0);


};

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

Re: Canned drilling cycle

Post by n_spect_r » Sat Sep 24, 2022 1:26 pm

Been trying to understand the processes involved here. In order to get this to export a G73 code, I believe there should be a change in the CamExporterV2. And while this file is referenced, I can't seem to locate it. Possibly something embedded in the software?

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

Re: Canned drilling cycle

Post by andrew » Mon Sep 26, 2022 2:56 pm

n_spect_r wrote:
Sat Sep 24, 2022 1:26 pm
In order to get this to export a G73 code, I believe there should be a change in the CamExporterV2.
No, CamExporterV2 does not define any G-Code output at all. This is the code that iterates through toolpaths and calls into your post processor to export to G-Code. CamExporterV2.js is indeed embedded into QCAD/CAM.

To replace the whole drill cycle, you'd have to filter out the toolpath part that is the Z move for the drilling and ignore all other drill toolpath entities:

Code: Select all

Mazak.prototype.writeEntity = function() {
    var drillToolPath = this.getToolpathOption("CamDrillToolpathFlag", "0")==="1";
    var toolDown = this.currentEntity.getCustomProperty("QCAD", "CamToolDown", "0")==="1";
    var rapidMove = this.currentEntity.getCustomProperty("QCAD", "CamRapidMove", "0")==="1";
    var zMove = this.currentEntity.getCustomProperty("QCAD", "CamZMove", "0")==="1";

    if (drillToolPath) {
        if (toolDown) {
            // write canned cycle for entity that represents the Z move down:
            this.writeBlockFromString("[N] G73 [Z!] R0.25 Q0.11 F5.1  (CANNED CYCLE LINE ADDED)");
        }
        else if (rapidMove && !zMove) {
            // write X/Y rapid move to drill position:
            GCodeBase.prototype.writeEntity.call(this);
        }

        // ignore all other drill path entities
    }
    else {
        // anything else is handled as usual:
        GCodeBase.prototype.writeEntity.call(this);
    }
};
You also might want to remove the last line of the toolpath header ([N] G0 [X] [Y]) as this is handled as part of the drill toolpath.

Post Reply

Return to “QCAD/CAM”