[solved] How to obtain the reverse Z value in Postprocessor?
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.
-
- Active Member
- Posts: 33
- Joined: Sat Jun 19, 2010 6:23 pm
[solved] How to obtain the reverse Z value in Postprocessor?
Hi. I do work on a postprocessor for an SCM machine and I do need to invert all the "Z" values and I can't find a way to do so. More precisely I do need the positive numbers like Z=20.00 to became Z=-20.00 and the Z=-15.50 to became Z=15.50. How I can invert this values?
-
- Premier Member
- Posts: 4939
- Joined: Wed Sep 27, 2017 4:17 pm
Re: How to obtain the reverse Z value in Postprocessor?
Hi,
Plunging into material is then not in the negative direction but in the positive direction ...
This should be possible but it sounds more that your Z actuator is working in reverse.
Most drivers setup let you configure this or you need to swap wires.
As example: I have a negated step count per mm on my Y axis because it is a Moving Bed and not a Gantry setup.
And as it came I had to swap 2 of the 4 wires of my Z stepping motor because plunging had to be moving downwards ...
Re-configuring your setup or swapping wires is more natural or logical unless that diving into material is really upwards.
Have a look at EssiPlasmaMM.js
There the zPosition is registered as:
- ID: "Z"
- always: true
- prefix: "Z"
- decimals: "DEFAULT"
- options: {factor: 10, sign: true}
I presume that a factor of -1 and not forcing the sign (can be omitted) should do the trick.
Remind that anything related to Z should be inverted.
Zsafe of for example +30 must be handled as Zsafe = -30 ...
See GCodeBase.js for an extensive list unless already overruled by your postprocessor.
Do not change this in a standard included postprocessor, this may be overwritten on each update.
Include it in a custom Postprocessor, in your case probably based on SCM.js.
Give your custom Postprocessor a practical and distinguishable filename and displayName.
Regards,
CVH
Plunging into material is then not in the negative direction but in the positive direction ...

This should be possible but it sounds more that your Z actuator is working in reverse.
Most drivers setup let you configure this or you need to swap wires.
As example: I have a negated step count per mm on my Y axis because it is a Moving Bed and not a Gantry setup.
And as it came I had to swap 2 of the 4 wires of my Z stepping motor because plunging had to be moving downwards ...

Re-configuring your setup or swapping wires is more natural or logical unless that diving into material is really upwards.
Have a look at EssiPlasmaMM.js
There the zPosition is registered as:
- ID: "Z"
- always: true
- prefix: "Z"
- decimals: "DEFAULT"
- options: {factor: 10, sign: true}
I presume that a factor of -1 and not forcing the sign (can be omitted) should do the trick.
Remind that anything related to Z should be inverted.
Zsafe of for example +30 must be handled as Zsafe = -30 ...

See GCodeBase.js for an extensive list unless already overruled by your postprocessor.
Do not change this in a standard included postprocessor, this may be overwritten on each update.
Include it in a custom Postprocessor, in your case probably based on SCM.js.
Give your custom Postprocessor a practical and distinguishable filename and displayName.
Regards,
CVH
-
- Active Member
- Posts: 33
- Joined: Sat Jun 19, 2010 6:23 pm
Re: How to obtain the reverse Z value in Postprocessor?
Hi CVH.
I do made some adjustments in the post to the zPosition line and looks like this:
I also tryed:
but still nothing changed. I do get the same old values, not the reverse ones. Any other ideas?
P.S. Fixed. The working syntax is:
I do use a professional machine, so rewiring things is out of question. Everything needs to be done on post.Most drivers setup let you configure this or you need to swap wires.
No problem, this is handled by the "SET ZFAST=20.00", parameter in the header of the program.Zsafe of for example +30 must be handled as Zsafe = -30 ...
I do made some adjustments in the post to the zPosition line and looks like this:
Code: Select all
this.registerVariable("zPosition", "Z", true, "Z=", "DEFAULT", "DEFAULT", {factor: -1});
Code: Select all
this.registerVariable("zPosition", "Z", true, "Z=", "DEFAULT", "{factor: -1}");
P.S. Fixed. The working syntax is:
Code: Select all
this.registerVariable("zPosition", "Z", true, "Z=", "DEFAULT", {factor: -1});
-
- Premier Member
- Posts: 4939
- Joined: Wed Sep 27, 2017 4:17 pm
Re: [solved] How to obtain the reverse Z value in Postprocessor?
Nice that you found it out yourself, wasn't at home.
A variable registration exist indeed of 6 parts at max.
The options object is not mandatory, it is (always) between curly brackets and without quotation marks.
Does this also mean that this is solved:
https://www.qcad.org/rsforum/viewtopic.php?f=74&t=10879
Regards,
CVH
A variable registration exist indeed of 6 parts at max.
The options object is not mandatory, it is (always) between curly brackets and without quotation marks.

Does this also mean that this is solved:
https://www.qcad.org/rsforum/viewtopic.php?f=74&t=10879
Regards,
CVH
-
- Premier Member
- Posts: 4939
- Joined: Wed Sep 27, 2017 4:17 pm
Re: [solved] How to obtain the reverse Z value in Postprocessor?
Hi,
I even think there is another way ...
When you define block code like "G1 [X] [Y] [Z]"
Then there are 3 tags that you can add: ! , # and -
(I know, this is a figurative example, QCAD/CAM never combines motions in X/Y with those in Z)
[X!] would mean 'write always even when not changed'.
[Y#] means never include the prefix and write always.
[Z-] will negate the value.
Perhaps this is more practical ...
Off course you don't negate an already negated zPosition registered with a factor -1.
Regards,
CVH
I even think there is another way ...
When you define block code like "G1 [X] [Y] [Z]"
Then there are 3 tags that you can add: ! , # and -
(I know, this is a figurative example, QCAD/CAM never combines motions in X/Y with those in Z)
[X!] would mean 'write always even when not changed'.
[Y#] means never include the prefix and write always.
[Z-] will negate the value.
Perhaps this is more practical ...
Off course you don't negate an already negated zPosition registered with a factor -1.

Regards,
CVH