[solved] How to obtain the reverse Z value in Postprocessor?

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
artisanicview
Active Member
Posts: 33
Joined: Sat Jun 19, 2010 6:23 pm

[solved] How to obtain the reverse Z value in Postprocessor?

Post by artisanicview » Wed Jun 12, 2024 4:19 pm

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?

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

Re: How to obtain the reverse Z value in Postprocessor?

Post by CVH » Thu Jun 13, 2024 2:54 am

Hi,
Plunging into material is then not in the negative direction but in the positive direction ... :shock:
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 ... :wink:

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

artisanicview
Active Member
Posts: 33
Joined: Sat Jun 19, 2010 6:23 pm

Re: How to obtain the reverse Z value in Postprocessor?

Post by artisanicview » Thu Jun 13, 2024 10:08 am

Hi CVH.
Most drivers setup let you configure this or you need to swap wires.
I do use a professional machine, so rewiring things is out of question. Everything needs to be done on post.
Zsafe of for example +30 must be handled as Zsafe = -30 ... :?
No problem, this is handled by the "SET ZFAST=20.00", parameter in the header of the program.

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});
I also tryed:

Code: Select all

this.registerVariable("zPosition",           "Z",                    true, "Z=", "DEFAULT", "{factor: -1}");
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:

Code: Select all

this.registerVariable("zPosition",           "Z",                    true, "Z=", "DEFAULT", {factor: -1});

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

Re: [solved] How to obtain the reverse Z value in Postprocessor?

Post by CVH » Thu Jun 13, 2024 9:25 pm

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. :wink:

Does this also mean that this is solved:
https://www.qcad.org/rsforum/viewtopic.php?f=74&t=10879

Regards,
CVH

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

Re: [solved] How to obtain the reverse Z value in Postprocessor?

Post by CVH » Fri Jun 14, 2024 8:10 am

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. :wink:

Regards,
CVH

Post Reply

Return to “QCAD/CAM”