Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.

Post processor help: How to get WCS origin's X, Y and Z values

isamiBDSPX
Participant

Post processor help: How to get WCS origin's X, Y and Z values

isamiBDSPX
Participant
Participant

Hi everyone! 

I'm having a little bit of trouble getting my post processor to write a simple line of code like:

G10 L2 P1 X0. Y0. Z-381.926 (G54 WCS)

That line, on a Fanuc control will set the G54 WCS.

 

In the part I'm working right now, the WCS origin on my setup is set at (X=0, Y=0, Z=-381.926)

 

When I dump the information I can get this:

 

currentSection.fcsOrigin=(1.7859e-13, 1.10939e-13, 381.926)

 

which are the X, Y and Z values that I'm looking for, well sort of.

 

I have three problems:

 1. I don't know how to access the individual values.

 2. Even though my WCS origin is at X=0 and Y=0, I get a scientific notation of a number that's very close to zero but not exactly zero (X= 1.7859e-13, Y= 1.10939e-13). 

 3. I always get the values inverted. What I mean is that they are presented as if they are multiplied by -1. Why?

 

Any ideas on how to get my post to write this line of code?

G10 L2 P1 X0. Y0. Z-381.926

 

G10 L2 P1 will always be the same, but the X, Y and Z coordinates will change whenever I change the WCS origin.

Thanks in advance.

 

Best,

Isami

 

 

0 Likes
Reply
Accepted solutions (1)
311 Views
3 Replies
Replies (3)

seth.madore
Community Manager
Community Manager

Is it ALWAYS that same exact line of code?


Seth Madore
Customer Advocacy Manager - Manufacturing
0 Likes

isamiBDSPX
Participant
Participant
G10L2P1 is always the same
but the X,Y and Z values depend on where I've established my WCS origin which changes on every part.
0 Likes

isamiBDSPX
Participant
Participant
Accepted solution

I've found the solution. Once I've discovered the WCS is stored in a Vector Object everything was very straight forward.

This is the code I needed:

 

  var setupWCSorigin = getSection(0).fcsOrigin.negated;
  var setupWCS = getSection(0).workOffset;
  gAbsIncModal.reset();
  writeBlock(
    gAbsIncModal.format(90),
    gFormat.format(10),
    "L2P" + (1 + setupWCS),
    "X"+xyzFormat.format(setupWCSorigin.x),
    "Y"+xyzFormat.format(setupWCSorigin.y),
    "Z"+xyzFormat.format(setupWCSorigin.z),
    formatComment("G" + (54 + setupWCS) + " WCS")
  );
  writeBlock(gFormat.format(11));

 

 The vector object logically has the x, y and z attributes, problem 1 solved.

 xyzFormat takes care of the scientific notation, problem 2 solved.

The vector object also has the negated attribute which, as its name implies, gives you the negated vector, problem 3 solved

 

With that code, on a FANUC control, I can have the program update automatically the WCS.

For example:

G90 G10 L2 P2 X56. Y-284. Z-395.926 (G55 WCS)

 

This will update the G55 WCS to those coordinates which is the origin of my Setup. You can update other WCS changing the P value. (P1 = G54, P2 = G55, P3 = G56, P4 = G57, P5 = G58, P6 = G59)

 

I found this very useful to have a relatively accurate position of the WCS before probing the part to have the exact location of the WCS. 

 

Hope this can help others!

 

Cheers,

Isami

 

1 Like