Cam Export

Discussions around the CAM Add-On of QCAD version 3

Moderator: andrew

Cam Export

Postby jthornton » Fri Oct 25, 2013 6:08 pm

When I press the Cam Export button I see "Command: camexport" on the command line but nothing happens. I looked at GCode.js and it has an include for CamExporter.js but that file is not found.

JT
jthornton
Full Member
 
Posts: 66
Joined: Fri Oct 25, 2013 1:31 pm

Re: Cam Export

Postby andrew » Fri Oct 25, 2013 6:46 pm

Thanks for your report. This has been fixed in the latest release (3.4.2):
http://www.qcad.org/en/qcad-downloads-trial
User avatar
andrew
Site Admin
 
Posts: 2599
Joined: Fri Mar 30, 2007 6:07 am

Re: Cam Export

Postby jthornton » Sat Oct 26, 2013 11:50 am

Thank you very much for that rapid fix.

First thing I see when trying this is the units are wrong, camexport converts the drawing units (inch) to mm.

Next I don't see a way to specify the starting point when cutting an arc.

I have a lot of experience with CAD CAM and CNC machining and I'm willing to help this project as much as I can.

JT
jthornton
Full Member
 
Posts: 66
Joined: Fri Oct 25, 2013 1:31 pm

Re: Cam Export

Postby andrew » Sat Oct 26, 2013 12:04 pm

jthornton wrote:First thing I see when trying this is the units are wrong, camexport converts the drawing units (inch) to mm.


CAM export is defined through machine configurations. Machine configurations are JavaScript files which are stored in scripts/Cam/CamConfigurations

You can choose which configuration to use in the CAM export dialog (top left).
The default configuration is "GCode" which indeed converts to millimeters. "GCodeInch" is based on "GCode" but generates output in inches.
In other words, the output unit does not depend on your drawing but is defined in the machine configuration file.

jthornton wrote:Next I don't see a way to specify the starting point when cutting an arc.


QCAD/CAM is at this point meant to fully automatically create GCode from drawings. This makes sense for example if you are LASER cutting 5000 tiny contours and specifying any kind of additional information for each contour is not feasible.

For use cases with only one or two contours, it might make sense to define additional parameters (tool radius correction, cutting direction, starting point, etc). This is generally already possible with custom properties assigned to entities in QCAD which are then interpreted by a machine configuration, but this process will be refined in future versions.
User avatar
andrew
Site Admin
 
Posts: 2599
Joined: Fri Mar 30, 2007 6:07 am

Re: Cam Export

Postby jthornton » Sat Oct 26, 2013 12:13 pm

The files I have in scripts/Cam/CamConfigurations are:
ADT_HC4500.js
GCode.js
GCode.ui
GCodeLayer.ui

I don't have GCodeInch.js. Can I just copy GCode.js and make changes? I've all ready tried to copy GCode.js and rename it and it shows up but I don't get any output.

I've figured out how to start a new machine configuration file... now to figure out how to make it not convert to mm.

Thanks
JT
jthornton
Full Member
 
Posts: 66
Joined: Fri Oct 25, 2013 1:31 pm

Re: Cam Export

Postby andrew » Sat Oct 26, 2013 12:27 pm

Please accept my apologies, I didn't realize that this was not included in the package. I've attached GCodeInch.js - simply save it to your directory scripts/Cam/CamConfigurations.
Attachments
GCodeInch.js
(211 Bytes) Downloaded 72 times
User avatar
andrew
Site Admin
 
Posts: 2599
Joined: Fri Mar 30, 2007 6:07 am

Re: Cam Export

Postby jthornton » Sat Oct 26, 2013 1:00 pm

Thanks, but the global options are still in mm. I see GCodeInch.js includes GCode.js can I override the global options in GCodeInch.js?

A couple of notes, you need to be able to specify the file extension for example I use LinuxCNC and the extension is ngc. Can you override the getFileExtesions in the GCodeInch.js? What is the strategy for changing things for different machine configurations?

Thanks
JT
jthornton
Full Member
 
Posts: 66
Joined: Fri Oct 25, 2013 1:31 pm

Re: Cam Export

Postby andrew » Sat Oct 26, 2013 1:31 pm

jthornton wrote:Thanks, but the global options are still in mm.


Please explain what you mean by 'global options' - is that something in the QCAD preferences, in the G-Code output file or in your machine configuration?

jthornton wrote:I see GCodeInch.js includes GCode.js can I override the global options in GCodeInch.js?


The idea is to base your own configuration on an existing one by deriving your own class from an existing class in object oriented programming terms.

I've attached an example configuration called 'JThornton' which is derived from 'GCode' and flips the output (invert Y axis) which I understand is necessary for your machine.

jthornton wrote:A couple of notes, you need to be able to specify the file extension for example I use LinuxCNC and the extension is ngc. Can you override the getFileExtesions in the GCodeInch.js?


Yes, better even in your own configuration 'JThornton.js'. I've also added that setting to your configuration.

jthornton wrote:What is the strategy for changing things for different machine configurations?


If you have multiple, similar machines, you might want to create a base configuration for all of them with common settings, and then derive from that for the other machines.
Attachments
JThornton.js
(613 Bytes) Downloaded 64 times
User avatar
andrew
Site Admin
 
Posts: 2599
Joined: Fri Mar 30, 2007 6:07 am

Re: Cam Export

Postby jthornton » Sat Oct 26, 2013 1:44 pm

Thanks so much for the example file that helps me out a lot with the syntax, I'll study that for a while. I program in Python so I have to brush up on JS a bit.

What I mean by global options is in the GCode.js file and shows up on the GCode.ui when you pick cam export.

Code: Select all
GCode.prototype.initGlobalOptionWidget = function(w) {
    switch (w.objectName) {
    case "ZSafety":
        w.addItems(["200", "150", "100", "50"]);
        w.setEditText("100");
        break;
    case "ZClear":
        w.addItems(["1", "2", "3"]);
        w.setEditText("2");
        break;
    case "ZCutting":
        w.addItems(["-1", "-2", "-3"]);
        w.setEditText("-2");
        break;
    }
};



Thanks
JT
jthornton
Full Member
 
Posts: 66
Joined: Fri Oct 25, 2013 1:31 pm

Re: Cam Export

Postby andrew » Sat Oct 26, 2013 1:59 pm

jthornton wrote:What I mean by global options is in the GCode.js file and shows up on the GCode.ui when you pick cam export.


I understand now, thanks.

To change those, you could overwrite the function initGlobalOptionWidget in your configuration, for example:

Code: Select all
JThornton.prototype.initGlobalOptionWidget = function(w) {
    switch (w.objectName) {
    case "ZSafety":
        w.addItems(["2", "5", "10"]);         // available options in combo box
        w.setEditText("10");                    // preselected default option
        break;
    case "ZClear":
        w.addItems(["0.25", "0.5", "1"]);
        w.setEditText("0.25");
        break;
    case "ZCutting":
        w.addItems(["-0.125", "-0.25", "-0.5"]);
        w.setEditText("-0.125");
        break;
    }
};
User avatar
andrew
Site Admin
 
Posts: 2599
Joined: Fri Mar 30, 2007 6:07 am

Re: Cam Export

Postby jthornton » Sat Oct 26, 2013 2:03 pm

Andrew,

Thanks so much for the example.

JT
jthornton
Full Member
 
Posts: 66
Joined: Fri Oct 25, 2013 1:31 pm

Re: Cam Export

Postby andrew » Sat Jan 11, 2014 9:33 am

Jim: I've split the question you've added to this topic into a new topic at:
viewtopic.php?f=74&t=2741
User avatar
andrew
Site Admin
 
Posts: 2599
Joined: Fri Mar 30, 2007 6:07 am


Return to QCAD 3 CAM Add-On

Who is online

Users browsing this forum: No registered users and 0 guests