Learning ECMAScript

Discussions around the CAM Add-On of QCAD.

Moderator: andrew

Post Reply
ACM_Doug
Junior Member
Posts: 13
Joined: Mon Jan 25, 2021 5:31 pm

Learning ECMAScript

Post by ACM_Doug » Tue Mar 02, 2021 5:20 pm

What resources are available for learning ECMAScript? Specifically, I am interested in whether QCAD/CAM can be used to program an old laser that must use subroutines due to a limit on the size of the run memory (100kb).

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

Re: Learning ECMAScript

Post by andrew » Wed Mar 03, 2021 10:43 am

To trigger a subroutine for identical parts, I'd recommend using blocks in the drawing for the parts and block references for the various instances of parts. This way, the structure in CAD already reflects the desired structure in the G-Code. The post processor could then create subroutines for each such block and trigger the subroutine for each instance.

Since this is quite different from the usual QCAD/CAM post processor, I'd recommend to overwrite writeFile to gain full control over the output and processing. You could then simply iterate through all blocks and block instances and output relevant G-Code. Depending on your particular needs, this might be easier than trying to leverage more QCAD/CAM functionality such as optimization, tool radius offset, etc. If you do need such features, things get more involved.

The attached boilerplate post processor outputs something like:

Code: Select all

[relevant sub routine header for block 'block 1']
[relevant G-Code...]
[relevant sub routine footer]

[relevant sub routine call for block 'block 1' at 46,40]
[relevant sub routine call for block 'block 1' at 66,36]

To dive more into the more typical post processors, this document is a starting point:
https://qcad.org/en/qcad-cam-postprocessor
Attachments
MyGCodeSubMM.js
(1.98 KiB) Downloaded 27 times

ACM_Doug
Junior Member
Posts: 13
Joined: Mon Jan 25, 2021 5:31 pm

Re: Learning ECMAScript

Post by ACM_Doug » Fri Mar 12, 2021 7:17 pm

Thanks, Andrew. I appreciate your response but have to confess it went over my head. I would be interested in exploring QCAD/CAM to program our vintage Bystronic laser but not sure how I would ever get a post-processor configured.

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

Re: Learning ECMAScript

Post by andrew » Mon Mar 15, 2021 9:10 am

I understand. This would definitely require a significant amount of work by an experienced programmer with some QCAD API knowledge.

Post Reply

Return to “QCAD/CAM”