Postprocessor header to move to safe Z

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
lagnat
Junior Member
Posts: 24
Joined: Mon Dec 07, 2020 4:58 pm

Postprocessor header to move to safe Z

Post by lagnat » Thu Dec 24, 2020 11:09 pm

I added G0 [ZS] to my header however it seems like ZS isn't defined and I just end up with G0. I would like to make sure the bit is at a safe spot before starting the spindle. Is there a way to make that work?

Thanks!

Code: Select all

    this.header = [
        .. stuff removed for brevity ..
        "[N] G0 [ZS]",  // Safe Z
        "[N] M3",       // Start spindle
    ];

CVH
Premier Member
Posts: 3418
Joined: Wed Sep 27, 2017 4:17 pm

Re: Postprocessor header to move to safe Z

Post by CVH » Fri Dec 25, 2020 6:18 am

Hi,
I think you need to provide more info on the postprocessor.
lagnat wrote:
Thu Dec 24, 2020 11:09 pm
I added G0 [ZS] to my header
I would include such before any M6/M3 or in 'this.toolHeader' ... if ZS is defined of course. :wink:

If I follow the basic setup explained here:
https://qcad.org/en/qcad-cam-postprocessor

Then the second code block is what you mean: 'rapidMoveZ | Rapid move to safety level.'
And some simple testing reveals this is the Safety level (for tool changes and start / end) in the CAM Configuration.
Presumed to be ZS.

Now it gets ambiguous ...
'rapidMoveZ' is also the code block for 'Rapid move down to clearance level (hovering above material).'
Presumed to be ZU.

What with a toolchange is not explained in detail.

When I use the standard "G-Code (G41/G42) [mm]" postprocessor (= GCodeMM.js)
What is based on GCodeBase.js, what registers both the variable ZS and ZU.
And although both don't occur again in the scripts files:

The second G-code line is this 'Rapid move to safety level' :?

Regards,
CVH

Arctic_Eddie
Active Member
Posts: 28
Joined: Sat Dec 12, 2020 5:23 pm
Location: St. Petersburg, Florida

Re: Postprocessor header to move to safe Z

Post by Arctic_Eddie » Fri Dec 25, 2020 2:06 pm

Try setting the value of ZS in MenuBar/CAM Configuration/Z Levels/Safety level. If you want to use the same value for all jobs then put it directly in the header.

Arctic_Eddie
Active Member
Posts: 28
Joined: Sat Dec 12, 2020 5:23 pm
Location: St. Petersburg, Florida

Re: Postprocessor header to move to safe Z

Post by Arctic_Eddie » Fri Dec 25, 2020 2:35 pm

I found two references to zSafety in C:\Program Files\QCADCAM\scripts\Cam\CamConfigurations\GCode.js.

CVH
Premier Member
Posts: 3418
Joined: Wed Sep 27, 2017 4:17 pm

Re: Postprocessor header to move to safe Z

Post by CVH » Fri Dec 25, 2020 3:49 pm

Arctic_Eddie wrote:
Fri Dec 25, 2020 2:35 pm
I found two references to zSafety in C:\Program Files\QCADCAM\scripts\Cam\CamConfigurations\GCode.js.
@ Ed,
Hate to disappoint you but ...
- 4x in CamConfigurations are like

Code: Select all

    case "ZSafety":
        w.addItems(["2", "1", "0.5"]);
        w.setEditText("0.5");
        break;
What initiate the dropdown box entries. Remark the capital Z.
- The one in GCode.ui is the dropdown box itself.
- The one in GCode.js reads the value set by the UI or returns 100.

Code: Select all

/**
 * \return Z level to be used to retreat to safety level.
 */
 GCode.prototype.getSafetyZLevel = function() {
    return parseFloat(this.getGlobalOption("ZSafety", 100.0));
};
On top, GCode.js is the base class

Code: Select all

/**
 * \class GCode
 * This is the base class for all G-Code derived configurations.
 * Constructor of class GCode.
 */
But GCodeBase.js is that too

Code: Select all

/**
 * This is a base class for G-Code configurations.
 * 
 * Do not edit this class. 
 * Instead, create your own derivation as shown in GodeMM.js, GCodeIN.js, ...
 */
Ah, the difference is :
GCode.js includes "scripts/Cam/CamExport/CamExporter.js"
GCodeBase.js includes "scripts/Cam/CamExportV2/CamExporterV2.js"

22 postprocessors include "GCodeBase.js"
None include "GCode.js" but there are some in qcadcamscripts.dll

.....
Last edited by CVH on Mon Dec 28, 2020 5:33 am, edited 1 time in total.

CVH
Premier Member
Posts: 3418
Joined: Wed Sep 27, 2017 4:17 pm

Re: Postprocessor header to move to safe Z

Post by CVH » Fri Dec 25, 2020 4:03 pm

......

But than I stumbled on
Tnc430MM.js .... what includes "GCodeBase.js" .... what registers [ZS] and no [ZS!]

Code: Select all

    this.header = [
        "[N#] BEGIN PGM [PROGRAM_NAME] MM",
        "[N#] BLK FORM 0.1 Z X[X_MIN] Y[Y_MIN] Z[Z_MIN]",
        "[N#] BLK FORM 0.2 X[X_MAX] Y[Y_MAX] Z[Z_MAX]",
        "[N#] L [ZS!] R0 FMAX",
    ];
    this.footer = [
        "[N#] L [ZS!] R0 FMAX M5 M30",
        "[N#] END PGM [PROGRAM_NAME] MM"
    ];
    
@ lagnat, you could try that.

So a fairly odd quest and no immediate solution.

Regards,
CVH

lagnat
Junior Member
Posts: 24
Joined: Mon Dec 07, 2020 4:58 pm

Re: Postprocessor header to move to safe Z

Post by lagnat » Fri Dec 25, 2020 4:26 pm

Arctic_Eddie wrote:
Fri Dec 25, 2020 2:06 pm
If you want to use the same value for all jobs then put it directly in the header.
That's what I ended up doing, but it would be nice if it could honor ZS.

Post Reply

Return to “QCAD/CAM”