Material dimensions setup?

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
Dacicusan
Active Member
Posts: 49
Joined: Sat Oct 14, 2017 1:44 am

Material dimensions setup?

Post by Dacicusan » Fri Jan 28, 2022 7:47 pm

I was searching for a way to determine the material sizes in mm, like x=3050, y=1220, z=18 but I can't find any way to do this. My CNC machine needs to have this dimensions in the header like:

Code: Select all

H DX=3050 DY=1220 DZ=18
It is possible to determine somehow this values?

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

Re: Material dimensions setup?

Post by CVH » Sat Jan 29, 2022 4:54 am

Dacicusan wrote:
Fri Jan 28, 2022 7:47 pm
My CNC machine needs to have this dimensions in the header
What is send as the header can be included in ....

Code: Select all

this.header = [...]
That are always literal things between quotes and may also include variables.
Lines are separated by commas. It is in fact a script array, a list.

As example a snippet from Emc2MM.js:

Code: Select all

    // G21: Millimeter
    // G64 P#: Tolerance. Fine tune system for best compromise between speed and accuracy
    this.header = [
        "%",
        "(FILE: [FILENAME])",
        "G21",
        "G64 P0.025"
    ];
Dacicusan wrote:
Fri Jan 28, 2022 7:47 pm
It is possible to determine somehow this values?
Please elaborate 'determination', on what are those values based?
I would call this the stock size of what I have mounted on my machine bed.
The CAM output has no references for that.
My CNC doesn't even care if that is too large, too small or just air. :lol:

Using user defined values is yet another story.
For that you also need to expand the configuration dialog.
As example see the initConfigDialog section in GCodeBase.js among others.

Regards,
CVH
Last edited by CVH on Tue Feb 01, 2022 11:18 am, edited 1 time in total.

Dacicusan
Active Member
Posts: 49
Joined: Sat Oct 14, 2017 1:44 am

Re: Material dimensions setup?

Post by Dacicusan » Tue Feb 01, 2022 10:53 am

CVH wrote:
Sat Jan 29, 2022 4:54 am
Dacicusan wrote:
Fri Jan 28, 2022 7:47 pm
My CNC machine needs to have this dimensions in the header
Please elaborate 'determination', on what are those values based?

I need to say to the machine what is the thickness of the material I am cutting from! And I can't find any way to determine this in Qcad/CAM.

I want to cut a board of 18mm thickness. How to write this information in the header of the cnc program?

I get-it that needs to be included in the "this.header" but what is the variable and how to determine the variable to display the thickness material information?

It is not the same if I make a groove of 17mm deep into a 18mm board or a 3mm board. And the machine needs to know this information because it is referencing from the TOP part of the material, so if I apply a 17mm cut into a 3mm sheet the machine will cut the bed of the machine.

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

Re: Material dimensions setup?

Post by CVH » Tue Feb 01, 2022 11:02 am

Dacicusan wrote:
Tue Feb 01, 2022 10:53 am
but what is the variable and how to determine the variable to display the thickness material information?
CVH wrote:
Sat Jan 29, 2022 4:54 am
The CAM output has no references for that.
I'm pretty sure you didn't have to define the material size or thickness anywhere in the drawing.
QCAD can't invent things.

As I mentioned, that can be set in the configuration dialog.
For that, you need to expand the dialog box with the required fields so that you can enter them.

Regards,
CVH

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

Re: Material dimensions setup?

Post by andrew » Tue Feb 01, 2022 11:14 am

Here's a minimalistic example post processor demonstrating how you can add an input field for the thickness in the CAM configuration dialog and then use that value in your header:

Code: Select all

include("GCodeMM.js");

function MyGCode(cadDocumentInterface, camDocumentInterface) {
    GCodeMM.call(this, cadDocumentInterface, camDocumentInterface);

    // register variable (this.thickness will be output for the [THICKNESS] placeholder:
    this.registerVariable("thickness", "THICKNESS", true, "", 0);

    // define header to contain placeholder for thickness:
    this.header = [ "# Thickness: [THICKNESS]" ];    
}

MyGCode.prototype = new GCodeMM();

MyGCode.displayName = "My G-Code [mm]";

MyGCode.prototype.writeFile = function(fileName) {
    // set variable to value from CAM config dialog
    // "MyThickness" corresponds to the objectName of the GUI element:
    this.thickness = this.getGlobalOption("MyThickness", "0.0");

    return GCodeMM.prototype.writeFile.call(this, fileName);
};

MyGCode.prototype.initConfigDialog = function(dialog) {
    var group = dialog.findChild("GroupCustom");
    var vBoxLayout = group.layout();

    // add row:
    var hBoxLayout = new QHBoxLayout(null);
    vBoxLayout.addLayout(hBoxLayout, 0);

    // add label:
    var lThickness = new QLabel(qsTr("Thickness:"));
    hBoxLayout.addWidget(lThickness, 0,0);

    // add text input field:
    var leThickness = new RMathLineEdit();
    leThickness.objectName = "MyThickness";
    hBoxLayout.addWidget(leThickness, 0,0);

    // add next row...
};
I hope that helps.

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

Re: Material dimensions setup?

Post by CVH » Tue Feb 01, 2022 11:42 am

Dacicusan wrote:
Tue Feb 01, 2022 10:53 am
It is not the same if I make a groove of 17mm deep into a 18mm board or a 3mm board. And the machine needs to know this information because it is referencing from the TOP part of the material, so if I apply a 17mm cut into a 3mm sheet the machine will cut the bed of the machine
I do understand ... Rather common is to define your Z=zero at the top of the material.
Cutting 17mm deep is then cutting at Z-17.
With 3mm material one should not create paths 17mm deep, unless one uses a spoilerboard. :lol:
I really don't see the issue there yours is said to reference 'the TOP'.

This is machine related, professional CNC may reference on the bed surface and at/near a certain machine home position.
In those cases you need the stock sizing and the place where it is positioned.
One can do a lot with Machine vs Work coordinates and the multitude of Offset methods.
G10-G92-G54 ... and where you zero your machine.

Regards,
CVH

Dacicusan
Active Member
Posts: 49
Joined: Sat Oct 14, 2017 1:44 am

Re: Material dimensions setup?

Post by Dacicusan » Tue Feb 01, 2022 12:18 pm

andrew wrote:
Tue Feb 01, 2022 11:14 am
Here's a minimalistic example post processor demonstrating how you can add an input field for the thickness in the CAM configuration dialog and then use that value in your header:

Code: Select all

include("GCodeMM.js");

function MyGCode(cadDocumentInterface, camDocumentInterface) {
    GCodeMM.call(this, cadDocumentInterface, camDocumentInterface);

    // register variable (this.thickness will be output for the [THICKNESS] placeholder:
    this.registerVariable("thickness", "THICKNESS", true, "", 0);

    // define header to contain placeholder for thickness:
    this.header = [ "# Thickness: [THICKNESS]" ];    
}

MyGCode.prototype = new GCodeMM();

MyGCode.displayName = "My G-Code [mm]";

MyGCode.prototype.writeFile = function(fileName) {
    // set variable to value from CAM config dialog
    // "MyThickness" corresponds to the objectName of the GUI element:
    this.thickness = this.getGlobalOption("MyThickness", "0.0");

    return GCodeMM.prototype.writeFile.call(this, fileName);
};

MyGCode.prototype.initConfigDialog = function(dialog) {
    var group = dialog.findChild("GroupCustom");
    var vBoxLayout = group.layout();

    // add row:
    var hBoxLayout = new QHBoxLayout(null);
    vBoxLayout.addLayout(hBoxLayout, 0);

    // add label:
    var lThickness = new QLabel(qsTr("Thickness:"));
    hBoxLayout.addWidget(lThickness, 0,0);

    // add text input field:
    var leThickness = new RMathLineEdit();
    leThickness.objectName = "MyThickness";
    hBoxLayout.addWidget(leThickness, 0,0);

    // add next row...
};
I hope that helps.
I'm lost. I dont know what to do with this piece of code.

It is there any documentation on how to write a post-processor for Gcad/CAM? I read this tutorial, but don't explains where and how to make changes.

I made a Vectric post-processor for a MasterWood machine, but that was easy, just needed to change some parameters and make some adjustments.

As I see, this needs serious programming skills and there is no tutorial that can explain where and what to change.

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

Re: Material dimensions setup?

Post by andrew » Tue Feb 01, 2022 12:59 pm

QCAD/CAM is designed to be extremely flexible / customizable. Post processors are indeed pieces of code (JavaScript) which means that pretty much anything can be done with them that is technically doable.

It also means that you do need to have at least a basic understanding of JavaScript to make minor adjustments and some basic programming skills for more involved adjustments.

Any kind of tutorial would quickly get out of hand and turn into a full programming / JavaScript tutorial as it really depends on what you need to adjust / add.

I can offer you to to implement your post processor, based on your requirements on a contract basis. Feel free to contact me for a quote if you are interested in this service.

Claudiosp
Junior Member
Posts: 21
Joined: Tue Feb 11, 2020 4:17 pm

Re: Material dimensions setup?

Post by Claudiosp » Thu Aug 04, 2022 7:38 pm

H DX=3050 DY=1220

Code: Select all

this.header = [
"H DX=[X_MAX] DY=[Y_MIN] DZ=[THICKNESS] ",
];
XILOG import dxf.

Post Reply

Return to “QCAD/CAM”