Page 1 of 1
Use blocks name in post processor to customize G-codes
Posted: Thu Jun 10, 2021 6:35 pm
by UKR
Hi 4 all!
Is it possible use blocks name in post processor to customize G-codes?
I need to extract saved block names as name for details - to make some special tag comments in generated G-code. This tags will use laser machine
Re: Use blocks name in post processor to customize G-codes
Posted: Fri Jun 11, 2021 6:38 am
by andrew
Yes, you can access the complete QCAD and Qt API from post processors.
For example, to get a list of all block names as ECMAScript array, you can use this code:
Code: Select all
var blockNames = this.cadDocument.getBlockNames();
Re: Use blocks name in post processor to customize G-codes
Posted: Fri Jun 11, 2021 8:15 am
by UKR
Yes, you can access the complete QCAD and Qt API from post processors.
For example, to get a list of all block names as ECMAScript array, you can use this code:
We need, that post processor process named blocks (outer contours) in this way
1) First cut named blocks that located inside another named blocks
2) After - process other named blocks, but never must be situation that we cut inner contours of another named block, before current block is completely cutted with all inner contours
3) Before every named block (named outer contour), we must insert this text in G-Code -
;#*Part_xxx
where Part_xxx mean extracted name of block
We need this for extra detail routines by our CNC laser machine
Thanks a lot for help
Re: Use blocks name in post processor to customize G-codes
Posted: Fri Jun 11, 2021 8:42 am
by andrew
This is quite different from how QCAD/CAM usually processes toolpaths.
Are your drawings already prepared in that way or are you creating new drawings this way?
If you are creating new drawings, I would suggest to drop the use of blocks for toolpaths and instead create QCAD/CAM toolpaths using the appropriate toolpath names (instead of the block name). You can insert the toolpath name in your G-Code where needed.
You can either create a separate toolpath for inner contours to make sure they are cut before outer contours, or you can let QCAD/CAM handle this can simply create a single toolpath containing outer and inner contours. QCAD/CAM will automatically process inner toolpaths first.
Re: Use blocks name in post processor to customize G-codes
Posted: Sun Jun 13, 2021 11:31 am
by UKR
Are your drawings already prepared in that way or are you creating new drawings this way?
We plan to adopt QCAD/CAM to full cycle use begin from
1) making drawings of details
2) (if necessary) multiply county of some details
3) Make nesting on the same (98%) size sheets
4) Cut it by generated G-Codes on our Laser CNC Machine
instead create QCAD/CAM toolpaths using the appropriate toolpath names
It is great, because we use some different parameters for laser (speed, power) in depend on material and other
But I don't understand clearly - Is it possible to assign names to details (contours) and extract it while forming G-Codes - with know entry point and known exit point (when cutting of current detail is complete).
We will use this to attach stickers with id code or make direct graving on every detail.
P.S. As I understand, Tab is inserted on contour only manually? Is it possible to insert tab automatically for every side / or by every xxx mm's of details contour?
Thanks for help
Re: Use blocks name in post processor to customize G-codes
Posted: Mon Jun 14, 2021 6:53 am
by andrew
UKR wrote: ↑Sun Jun 13, 2021 11:31 am
Is it possible to assign names to details (contours) and extract it while forming G-Codes
Yes, every toolpath has a name which can be output into G-Code or can be used otherwise in your post processor.
UKR wrote: ↑Sun Jun 13, 2021 11:31 am
with know entry point and known exit point (when cutting of current detail is complete).
If your contours are polylines, you can force QCAD/CAM to use the start of the polyline as start point.
UKR wrote: ↑Sun Jun 13, 2021 11:31 am
We will use this to attach stickers with id code or make direct graving on every detail.
You can attach any kind of additional information to toolpath by extending the toolpath dialog. This is all possible from within your post processor.
UKR wrote: ↑Sun Jun 13, 2021 11:31 am
P.S. As I understand, Tab is inserted on contour only manually? Is it possible to insert tab automatically for every side / or by every xxx mm's of details contour?
That's something you'd have to implement in the post processor (not straightforward). You could also copy a tab and then paste it along a polyline at given intervals (
Edit > Paste along Entity).
Re: Use blocks name in post processor to customize G-codes
Posted: Tue Jun 15, 2021 3:47 pm
by UKR
That's something you'd have to implement in the post processor (not straightforward).
Thanks a lot for help. I'm diving in QCad very quick and deep
I have found nice small CAM postprocessor guide (
https://qcad.org/en/qcad-cam-postprocessor), but no information on developer guide
https://qcad.org/doc/qcad/latest/developer/
We need to extract extra info about CAM toolpath's - as example - total cutting length, length of rapid moves between contours (laser not work), length of details contours (CAM Tool PATHS lengths - when laser works)