Learning ECMAScript
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.
Always indicate your operating system and QCAD version.
Indicate the post processor used.
Attach drawing files and screenshots.
Post one question per topic.
Learning ECMAScript
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).
Re: Learning ECMAScript
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:
To dive more into the more typical post processors, this document is a starting point:
https://qcad.org/en/qcad-cam-postprocessor
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 421 times
Re: Learning ECMAScript
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.
Re: Learning ECMAScript
I understand. This would definitely require a significant amount of work by an experienced programmer with some QCAD API knowledge.