HELP w/FANUC Post

HELP w/FANUC Post

Anonymous
Not applicable
1,058 Views
8 Replies
Message 1 of 9

HELP w/FANUC Post

Anonymous
Not applicable

I have posted code that is spot drilling two holes in each part. After the first part, spindle returns to G53 Z0 to move over 2". How do I eliminate this form occuring?

0 Likes
1,059 Views
8 Replies
Replies (8)
Message 2 of 9

bob.schultz
Alumni
Alumni

The retract move is handled in the onSection function and will retract whenever the post determines that there is a tool change, or a change in the WCS or Work Plane.  The following code handles the retract.

if (insertToolCall || newWorkOffset || newWorkPlane || forceSmoothing) {
    
    // stop spindle before retract during tool change
    if (insertToolCall && !isFirstSection()) {
      onCommand(COMMAND_STOP_SPINDLE);
    }
    
    // retract to safe plane
    writeRetract(Z); // retract
    forceXYZ();

If you don't want the tool to fully retract when the WCS changes, you can make the following changes to the code.  In this example it will still retract when there is a tool change or the Work Plane changes (3+2 operations).

if (insertToolCall || newWorkOffset || newWorkPlane || forceSmoothing) {
    
    // stop spindle before retract during tool change
    if (insertToolCall && !isFirstSection()) {
      onCommand(COMMAND_STOP_SPINDLE);
    }
    
    if (insertToolCall || newWorkPlane) {  // insert this line
      // retract to safe plane
      writeRetract(Z); // retract
      forceXYZ();
    } // insert this line

 



Bob Schultz
Sr. Post Processor Developer

0 Likes
Message 3 of 9

Anonymous
Not applicable

Thank you for your help. It did post without the retracts but it will not post if I select Use Smoothing in my post properties. I get the following message. Could you help with this issue? I would be greatly appreciative. 

Information: Configuration: FANUC
Information: Vendor: Fanuc
Information: Posting intermediate data to 'C:\Users\Robert Chad Brown\AppData\Local\Fusion 360 CAM\nc\1001.nc'
Error: Failed to post process. See below for details.
...
Code page changed to '1252 (ANSI - Latin I)'
Start time: Monday, July 23, 2018 1:30:32 PM
Code page changed to '20127 (US-ASCII)'
Post processor engine: 4.2.1 41970
Configuration path: C:\Users\Robert Chad Brown\AppData\Roaming\Autodesk\Fusion 360 CAM\Posts\fanuc .3 .cps
Include paths: C:\Users\Robert Chad Brown\AppData\Roaming\Autodesk\Fusion 360 CAM\Posts
Configuration modification date: Monday, July 23, 2018 1:30:17 PM
Output path: C:\Users\Robert Chad Brown\AppData\Local\Fusion 360 CAM\nc\1001.nc
Checksum of intermediate NC data: 0f3aade5e3596b0e9e45c2428ce80bd4
Checksum of configuration: c973401d94d35a96134a80210f6531bf
Vendor url: http://www.fanuc.com
Legal: Copyright (C) 2012-2018 by Autodesk, Inc.
Generated by: Fusion 360 CAM 2.0.4285
...
Error: Error: Cannot cancel length compensation if the machine is not fully retracted.
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Stack dump:
validate(false,"Cannot cancel length compensation if the machine is not fully retracted.")@:2666
disableLengthCompensation()@C:\Users\Robert Chad Brown\AppData\Roaming\Autodesk\Fusion 360 CAM\Posts\fanuc .3 .cps:478
onSection()@C:\Users\Robert Chad Brown\AppData\Roaming\Autodesk\Fusion 360 CAM\Posts\fanuc .3 .cps:1111

Failed while processing onSection() for record 877.
Error: Failed to invoke function 'onSection'.
Error: Failed to invoke 'onSection' in the post configuration.
Error: Failed to execute configuration.
Stop time: Monday, July 23, 2018 1:30:32 PM
Post processing failed.

0 Likes
Message 4 of 9

bob.schultz
Alumni
Alumni

The setup of the Fanuc post requires that tool length compensation be canceled prior to initiating smoothing and the post also requires that the tool be retracted prior to canceling the tool length compensation (this is a safety feature, since the tool can plunge into the part if the tool has not been retracted first).

 

Not all Fanuc controls require that tool length compensation be canceled prior to initiating the smoothing mode, either due to the control model or type of smoothing being used.  If your control/smoothing mode does not require that tool length compensation be canceled first, then you can modify the following code in the post to remove this requirement.

 

function onSection() {
...
 if (insertToolCall || newWorkPlane) {
// retract to safe plane
writeRetract(Z); // retract
forceXYZ();
} if ((insertToolCall && !isFirstSection()) || forceSmoothing) { if (insertToolCall && !isFirstSection()) { // add this line disableLengthCompensation(); } // add this line setSmoothing(false); } ... ... function setSmoothing(mode) { if (mode == currentSmoothing) { return false; } // 1) Make sure G49 is called before the execution of G05.1 Q1 Rx // 2) G05.1 Q1 Rx must be engaged BEFORE G43-Tool Length Comp // 3) AICC and AIAPC need to be turned on and off for each tool // 4) AICC and AIAPC does not apply to canned drilling cycles // validate(!lengthCompensationActive, "Length compensation is active while trying to update smoothing."); // comment out this line

It is not recommended that you disable the retract move if you are using tool length compensation for tool changes for the reason mentioned above, just in case you completely removed the retract move in your version of the post.

 



Bob Schultz
Sr. Post Processor Developer

0 Likes
Message 5 of 9

DerekZCXVY
Contributor
Contributor

@bob.schultz  I have a similar issue and have followed your code but cant seem to figure it out. Would you be able to point me in the right direction? 

0 Likes
Message 6 of 9

bob.schultz
Alumni
Alumni

Hello @DerekZCXVY,

 

Your situation is a bit different, since you commented out or removed all calls to writeRetract, which means that the tool will never be fully retracted; not at tool changes, not when the rotary axes position changes, not at the end of the program.

 

First I will ask if you are sure that this is what you are expecting and is it safe on the machine?



Bob Schultz
Sr. Post Processor Developer

0 Likes
Message 7 of 9

DerekZCXVY
Contributor
Contributor

@bob.schultzThanks for the prompt reply. I believe so this came from the manufacture as is (outside of a couple minor tweaks such as programNameIsInteger made by me). I know javascript quite well and have been reading up on the post processor training guide. I think I see what you mean, within onClose, writeRetract for all axis's are commented out as well as in defineWorkPlane. Why would one disable writeRetract ? I see in the properties section one can enable G28, do you know how that relation works? Apologies for all the questions I am fascinated with this topic and trying to learn. The manufacture has not been much help since they dont support fusion 360 it appears that they took the Fanuc post processor from the fusion 360 library and modified it to work with there machines as more of a favor.

 

Back to the original question, yes I believe it is safe to do so. Within the onOpen function the B axis is limited to -100/100 degrees. That is the axis that could do the most damage but it being limited limits the potential damage quite a bit.  What do you think ? Should I enable writeRetract at least for the Z axis ? Outside of that what should I configure to put this error to bed?

 

Sorry for the long reply and thanks for looking into it ! Are there any other resources I can look into to learn more about post processor development ? I have been reading up on the post processor documentation and downloaded it as a .chm file as well as reading up on the PP training guide. Pretty cool stuff !

0 Likes
Message 8 of 9

bob.schultz
Alumni
Alumni

I would suggest that add the call to writeRetract back at the start of onSection at the very least.

    if ((insertToolCall && !isFirstSection()) || forceSmoothing) {
      writeRetract(Z); // <<< ADD THIS LINE
      disableLengthCompensation();
      setSmoothing(false);
    }

And also in the onClose function.

 

If you determine that that the tool does not have to be fully retracted to safely disable length compensation (G49), then you can remove the check to verify that it is retracted in the disableLengthCompensation function.

/** Disables length compensation if currently active or if forced. */
function disableLengthCompensation(force) {
  if (lengthCompensationActive || force) {
    // validate(retracted, "Cannot cancel length compensation if the machine is not fully retracted."); // <<< COMMENT OUT THIS LINE
    writeBlock(gFormat.format(49));
    lengthCompensationActive = false;
  }
}

 



Bob Schultz
Sr. Post Processor Developer

0 Likes
Message 9 of 9

DerekZCXVY
Contributor
Contributor

@bob.schultzThanks for the feedback. Yeah I never realized that I could just comment out that validate function, I feel pretty foolish. Tomorrow Ill go ahead and do some testing and act accordingly. Thanks again for the insight!

 

All the best,

 

DMC

0 Likes