Use blocks name in post processor to customize G-codes

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
UKR
Newbie Member
Posts: 4
Joined: Thu Jun 10, 2021 6:23 pm

Use blocks name in post processor to customize G-codes

Post by UKR » Thu Jun 10, 2021 6:35 pm

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

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

Re: Use blocks name in post processor to customize G-codes

Post by andrew » Fri Jun 11, 2021 6:38 am

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();

UKR
Newbie Member
Posts: 4
Joined: Thu Jun 10, 2021 6:23 pm

Re: Use blocks name in post processor to customize G-codes

Post by UKR » Fri Jun 11, 2021 8:15 am

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

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

Re: Use blocks name in post processor to customize G-codes

Post by andrew » Fri Jun 11, 2021 8:42 am

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.

UKR
Newbie Member
Posts: 4
Joined: Thu Jun 10, 2021 6:23 pm

Re: Use blocks name in post processor to customize G-codes

Post by UKR » Sun Jun 13, 2021 11:31 am

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

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

Re: Use blocks name in post processor to customize G-codes

Post by andrew » Mon Jun 14, 2021 6:53 am

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).

UKR
Newbie Member
Posts: 4
Joined: Thu Jun 10, 2021 6:23 pm

Re: Use blocks name in post processor to customize G-codes

Post by UKR » Tue Jun 15, 2021 3:47 pm

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)

Post Reply

Return to “QCAD/CAM”