- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
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
Fusion