Help with postprocessors

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.

jvalencia
Full Member
Posts: 51
Joined: Mon Jun 29, 2015 8:26 pm

Help with postprocessors

Post by jvalencia » Fri Jun 09, 2017 6:54 pm

I've tested the GCodeOffsetMM postprocessor with my cnc software, UCCNC and it just works. My machine is a Stepcraft 2 840.

I'm modding it a bit to add an initial travel to homing positions, and also an ending travel.

But I see there is already a hardcoded "G0 [ZH]" somewhere that is printed before the footer (and it's not mine).

For example:

Code: Select all

N130 G1 X70.0494 Y0.8703
N140 Z5
N150 G0 Z20
N160 M30
GCodeBase doesn't have it, so I suspect it's in the CamExporterV2.js script, but I can't find any information about it.

Any idea about this?

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

Re: Help with postprocessors

Post by andrew » Sat Jun 10, 2017 5:09 pm

At the end of the last toolpath, a rapid move to the safety level is exported, that's correct.

If you don't want this, you could re-implement exportToolUpSafety as follows:

Code: Select all

MyGCode.prototype.exportToolUpSafety = function(toolName) {
    var nextToolpathBlock = Cam.getNextToolpathBlock(this.currentToolpathBlock);
    if (isNull(nextToolpathBlock)) {
        // last tool path:
        // do nothing or do something else:
        // ...
    }
    else {
        // not the last toolpath (i.e. tool change):
        // call implementation of base class to retreat to safety level:
        GCodeBase.prototype.exportToolUpSafety.call(this, toolName);
    }
};

jvalencia
Full Member
Posts: 51
Joined: Mon Jun 29, 2015 8:26 pm

Re: Help with postprocessors

Post by jvalencia » Sun Jun 11, 2017 8:22 am

thanks!

jvalencia
Full Member
Posts: 51
Joined: Mon Jun 29, 2015 8:26 pm

Re: Help with postprocessors

Post by jvalencia » Sun Jun 11, 2017 12:26 pm

Andrew I've also found that my files start with G0 Z100, even though I have that value set to 20 (CAM configuration dialog).

Also, the footer isn't working properly, it's not expanding the variables.

Code: Select all

	this.header = [
		"[N] G0 [ZH]",
		"[N] G0 [XH] [YH]"
	];

	this.footer = [
		"[N] G0 [XH] [YH]",
		"[N] M30"
	];
Results in a single G0 command in the footer. It works for the header though.

Code: Select all

N10 G0 Z100
N20 G0 X0 Y0
N30 T1 M6
N40 M03
N50 G0 Z20
N60 G0 X9.9 Y9.1
N70 G0 Z2
N80 G1 Z-4 F12
N90 X40.3 Y45
N100 X81.4 Y14.5
N110 Z2
N120 G0 Z20
N130 G0
N140 M30
Untitled.jpg
Untitled.jpg (58.02 KiB) Viewed 23036 times

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

Re: Help with postprocessors

Post by andrew » Mon Jun 12, 2017 7:00 am

jvalencia wrote:Andrew I've also found that my files start with G0 Z100, even though I have that value set to 20 (CAM configuration dialog).
Please attach the DXF file, so I can try to reproduce the problem here, thanks.
Also, the footer isn't working properly, it's not expanding the variables.
XH, YH are not repeated if they are used twice with the same values. You can force them being written by using a bang (!) after the variable name:
[N] G0 [XH!] [YH!]

jvalencia
Full Member
Posts: 51
Joined: Mon Jun 29, 2015 8:26 pm

Re: Help with postprocessors

Post by jvalencia » Mon Jun 12, 2017 7:26 pm

I'm able to reproduce the bug.

It's because of my G0 [ZH] on the header. It takes the original 100 value and ignores my current value.

I'm attaching the postprocessor too.

And got some segmentation faults when clicking the Cam Configuration button.

This is part of the output:

Code: Select all

19:10:23: Debug:    cached exporter
19:10:23: Debug:    cached exporter
Warning:  RTransaction::commit: last cycle not closed
Warning:  toolpath block has no property 'CamZSafety'
19:10:23: Debug:    CamExporterV2.prototype.setZCuttingLevelOverride:  -4
Warning:  RSpatialIndex::queryNearestNeighbor: no result
Warning:  CamExporterV2.prototype.getToolpathOption: current toolpath block is NULL
Warning:  toolpath block has no property 'CamZSafety'
Warning:  toolpath block has no property 'CamSpindleSpeed'
19:10:23: Debug:    writing:  RLine(RShape(address: "0xa108ee0"), startPoint: RVector(0, 0, 20, true), endPoint: RVector(17.4104, 24.4344, 20, true))
19:10:23: Debug:    writing:  RLine(RShape(address: "0xa11d840"), startPoint: RVector(17.4104, 24.4344, 20, true), endPoint: RVector(17.4104, 24.4344, 5, true))
19:10:23: Debug:    writing:  RLine(RShape(address: "0x9936d00"), startPoint: RVector(17.4104, 24.4344, 5, true), endPoint: RVector(17.4104, 24.4344, -4, true))
19:10:23: Debug:    writing:  RLine(RShape(address: "0xa100cc0"), startPoint: RVector(17.4104, 24.4344, -4, true), endPoint: RVector(49.2056, 60.0312, -4, true))
19:10:23: Debug:    writing:  RLine(RShape(address: "0x800a620"), startPoint: RVector(49.2056, 60.0312, -4, true), endPoint: RVector(104.502, 64.0056, -4, true))
19:10:23: Debug:    writing:  RLine(RShape(address: "0xf3d2b10"), startPoint: RVector(104.502, 64.0056, -4, true), endPoint: RVector(135.087, 33.7656, -4, true))
19:10:23: Debug:    writing:  RLine(RShape(address: "0x99a31a0"), startPoint: RVector(135.087, 33.7656, -4, true), endPoint: RVector(135.087, 33.7656, 5, true))
19:10:23: Debug:    writing:  RLine(RShape(address: "0xf1c7b00"), startPoint: RVector(135.087, 33.7656, 5, true), endPoint: RVector(135.087, 33.7656, 20, true))
19:10:35: Debug:    RGLES3DPlugin::initScriptExtensions
19:10:49: Debug:    creating exporter
19:10:49: Debug:    cached exporter
19:10:49: Debug:    cached exporter
19:10:49: Debug:    cached exporter
19:10:49: Debug:    cached exporter
19:10:53: Debug:    cached exporter
19:11:00: Debug:    cached exporter
19:11:04: Debug:    cached exporter
19:11:04: Debug:    cached exporter
19:11:04: Debug:    cached exporter
19:11:06: Debug:    cached exporter
19:11:06: Debug:    cached exporter
Warning:  RTransaction::commit: last cycle not closed
Warning:  toolpath block has no property 'CamZSafety'
19:11:07: Debug:    CamExporterV2.prototype.setZCuttingLevelOverride:  -4
19:11:07: Debug:    this.xFirstPosition: 21.328799999999998
19:11:07: Debug:    exporter: RFileExporterAdapter(0x83d0b80)
19:11:07: Debug:    this.yFirstPosition: 23.95360000000001
Warning:  RSpatialIndex::queryNearestNeighbor: no result
19:11:09: Debug:    cached exporter
/home/tigre/qcad/qcad: line 8:  4941 Segmentation fault      (core dumped) LD_LIBRARY_PATH="$DIR" "$binary" "$@"

QCAD has failed to start.

Please use the offscreen platform plugin for headless systems
(without a running X11 server):
/home/tigre/qcad/qcad -platform offscreen

In addition, you might have to override the default Qt style
to prevent the loading of a native desktop style (such as GTK):
/home/tigre/qcad/qcad -style plastique
tigre@xubuntu:~$ 

Attachments
UCCNC.js
(353 Bytes) Downloaded 792 times
Untitled.txt
(212 Bytes) Downloaded 804 times
untitled.dxf
(118.32 KiB) Downloaded 793 times

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

Re: Help with postprocessors

Post by andrew » Mon Jun 12, 2017 7:31 pm

I can see that you are using QCAD/CAM 3.17.0. Please update to the latest version 3.17.1 and try to reproduce. Just to make sure we're on the same page, thanks.

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

Re: Help with postprocessors

Post by andrew » Mon Jun 12, 2017 7:33 pm

You can change your footer to (see my previous post above):

Code: Select all

    this.footer = [
        "[N] G0 [XH!] [YH!]",
        "[N] M30"
    ];

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

Re: Help with postprocessors

Post by andrew » Mon Jun 12, 2017 8:12 pm

I can confirm that ZH uses the default value (100) when used in the header. This problem has been fixed for the next release.

Bug report at:
http://www.qcad.org/bugtracker/index.ph ... sk_id=1593

jvalencia
Full Member
Posts: 51
Joined: Mon Jun 29, 2015 8:26 pm

Re: Help with postprocessors

Post by jvalencia » Tue Jun 13, 2017 6:55 pm

Great, thanks!

[XH!] [YH!] worked.

I've seen the changelog and Mach3 support is coming. That's great news, most amateur cnc machines run some sort of Mach3 compatible software, like mine.

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

Re: Help with postprocessors

Post by andrew » Tue Jun 13, 2017 9:22 pm

The Mach3 post processor currently just adds a header to make sure coordinates are interpreted as absolute and I/J as relative, etc. I've attached it, in case you want to give it a go (tested against QCAD/CAM 3.17.1).

If you are aware of other useful codes for the header or footer or other Mach3 specifics, please let me know and I'll update the post processor accordingly. Thanks.
Attachments
Mach3MM.zip
(491 Bytes) Downloaded 798 times

jvalencia
Full Member
Posts: 51
Joined: Mon Jun 29, 2015 8:26 pm

Re: Help with postprocessors

Post by jvalencia » Fri Jun 16, 2017 5:05 pm

I can share a file generated by V-Carve mach3 postprocessor. The header is the same as yours, but the footer adds an M09, M30 and "%".

My cnc controller, UCCNC, ignores many of the codes, but still works with mach3 code.
Attachments
fresa4mm.txt
(56.83 KiB) Downloaded 842 times

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

Re: Help with postprocessors

Post by andrew » Tue Jun 20, 2017 8:10 am

Thanks. I've attached an example of how you can adjust the footer.

Edit: This also fixes G40 (must be on separate line for Mach3).
Attachments
Mach3MM.zip
(652 Bytes) Downloaded 801 times

wdfortee
Junior Member
Posts: 10
Joined: Fri Mar 23, 2018 3:18 pm

Re: Help with postprocessors

Post by wdfortee » Fri Mar 23, 2018 3:24 pm

I'm currently using version 3.19 and am still seeing the "G0 Z100" appear after my custom header. I checked the bug tracker listed above and it lists "Closed". Has this not been included in the current version or am I doing something wrong to set my Z home?

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

Re: Help with postprocessors

Post by andrew » Fri Mar 23, 2018 4:39 pm

Please attach your post processor file (JS), your drawing file (DXF) and your output file (CNC, NC, ...).

For all support requests, please:
- indicate the operating system you are using and the version thereof
- indicate the exact version of QCAD/CAM you are using (see Help > About or QCAD/CAM > About QCAD/CAM)
- attach original drawing files (DXF, DWG, ...) if appropriate
- attach exported files (SVG, PNG, PDF, ...) if appropriate
- include screenshots if appropriate
- if there is an error message, indicate the exact message or include a screenshot of the message

Please be as specific as possible in describing your problem, so we can help you efficiently, thanks.

Post Reply

Return to “QCAD/CAM”