Tweaking Post Processor for manual tool changes

Tweaking Post Processor for manual tool changes

Anonymous
Not applicable
4,152 Views
9 Replies
Message 1 of 10

Tweaking Post Processor for manual tool changes

Anonymous
Not applicable

I am using a Roland MDX-540 for prototyping. We have to manually change the tool as we don't have an ATC. The problem with the Roland post is that when it comes to needing a tool change, it does a G28 move then gets stuck (i.e. just sits there spinning). We change the tool and touch it off but then we can't continue the program. This basically means we have to post for each tool. I've tried to have a poke around in the post but I am stuck... Ideally, when it comes to a tool change- 

 

  1. Move to G28 safe position (which it seems to do currently at whatever my clearance height is set at). 
  2. Turn off spindle and move to top of machine Z-axis travel (and ideally middle of machine X-axis)
  3. Action an M01 optional stop (so I can hopefully resume the program after tool change?)
  4. {change tool and touch off} 
  5. Hit cycle start and resume the program. 

If at all possible it would be great to get this to happen automatically in the post as its going to be something we have to do every time we run a program and adding manualNC is fine but obviously introduces a risk of forgetting! 

 

I have included the latest official post & a very basic CAM part with a tool change. 

 

Thanks in advance for any help/advice. 

0 Likes
Accepted solutions (1)
4,153 Views
9 Replies
Replies (9)
Message 2 of 10

boopathi.sivakumar
Autodesk
Autodesk

@Anonymous 

Did you tried using the post properties use toolchanger to set to false

Toolchange.png

Check it also if you attach some codes how you want if it has any toolchange then it will easy to tell where to change the post to get it right 

 


Boopathi Sivakumar
Principal Technology Consultant

0 Likes
Message 3 of 10

Anonymous
Not applicable

Thanks for the response, in response to your question, I do have 'Use Tool Changer' disabled as you mentioned. Looking at an export of that very simple program I attached before, I do get an M0 at the end of the operation before a tool change however I would like it do do the axis move to a position both away from

the workpiece and easy to access for changing the tool. It also currently doesn't stop the spindle so I have to do this on the control. 

 

I've attached the code outputted from that program with this post as it is currently. 

 

Thanks 

 

%
O00001001
(T3  D=6. CR=0. - ZMIN=-5. - FLAT END MILL)
(T6  D=10. CR=0. - ZMIN=0. - FLAT END MILL)
G90 G94 G17
G21
G91
G28 Z0.
G90
(FACE1)
(T6  D=10. CR=0. - FLAT END MILL)
(10X10MM FLAT END MILL - 2 FLUTE)
M0
S10000 M3
G54
G0 X55.5 Y-46.562
G43 Z15. H6
G0 Z5.
G1 Z0. F3000.
X50.
X0.
G2 Y-38.218 J4.172
G1 X50.
G3 Y-29.875 J4.172
G1 X0.
G2 Y-21.532 J4.172
G1 X50.
G3 Y-13.188 J4.172
G1 X0.
G2 Y-4.845 J4.172
G1 X50.
X55.
G0 Z15.
G91
G28 Z0.
G90
(2D CONTOUR1)
(T3  D=6. CR=0. - FLAT END MILL)
(6X25MM SLOT DRILL)
M0
S12000 M3
G54
G0 X32. Y-25.
G43 Z10. H3
G0 Z5.
G1 Z1. F1500.
Z-5.
G3 X18. I-7. F3000.
X32. I7.
G0 Z10.
G91
G28 Z0.
G90
M5
G91
G28 X0. Y0.
G90
M30
%

 

 

 

 

0 Likes
Message 4 of 10

Stuart-H
Collaborator
Collaborator

The operation of the m6 tool change is done in the m6 macro not the post

 

note it lower case m6 if it’s caps it will not work

 

for dazthegaz tool change that will get you started

 

the m6 macro can move the head to a place of your choice stop the spindle ect

 

 

 

Mac Studio M1Max and MacBook Pro M1
Message 5 of 10

Stuart-H
Collaborator
Collaborator

have a look at this one yes its not hat you need as it has a probe section but its very easy to follow 

Mac Studio M1Max and MacBook Pro M1
Message 6 of 10

Stuart-H
Collaborator
Collaborator

Forgot to say it’s your controller that handles the nuts and bolts for tool changes that’s where the m6 macro normally lives , they have to be specific for your controller and hardware 

Mac Studio M1Max and MacBook Pro M1
Message 7 of 10

Anonymous
Not applicable

Thanks, that makes sense- so as I only get an m06 generated if I tick enable 'use tool changer' in post settings, I guess you are saying I need to enable the tool changer then amend the m06 to do what I want it to do? I had a look through the post and found what I think is the m06 macro. I'm not quite sure what I do with it as it doesn't appear to be similar to your probe code you posted with terms like 'mc.mcAxisSetPos...' 

 

I may have overshot how much is related to the m06 but I think this is everything associated? 

 

function onSection() {
  var insertToolCall = isFirstSection() ||
    currentSection.getForceToolChange && currentSection.getForceToolChange() ||
    (tool.number != getPreviousSection().getTool().number);
  
  retracted = false; // specifies that the tool has been retracted to the safe plane
  var newWorkOffset = isFirstSection() ||
    (getPreviousSection().workOffset != currentSection.workOffset); // work offset changes
  var newWorkPlane = isFirstSection() ||
    !isSameDirection(getPreviousSection().getGlobalFinalToolAxis(), currentSection.getGlobalInitialToolAxis()) ||
    (currentSection.isOptimizedForMachine() && getPreviousSection().isOptimizedForMachine() &&
      Vector.diff(getPreviousSection().getFinalToolAxisABC(), currentSection.getInitialToolAxisABC()).length > 1e-4) ||
    (!machineConfiguration.isMultiAxisConfiguration() && currentSection.isMultiAxis()) ||
    (!getPreviousSection().isMultiAxis() && currentSection.isMultiAxis() ||
      getPreviousSection().isMultiAxis() && !currentSection.isMultiAxis()); // force newWorkPlane between indexing and simultaneous operations
  if (insertToolCall || newWorkOffset || newWorkPlane) {
    
    // retract to safe plane
    writeRetract(Z);
    zOutput.reset();
  }

  if (hasParameter("operation-comment")) {
    var comment = getParameter("operation-comment");
    if (comment) {
      writeComment(comment);
    }
  }
  
  if (properties.showNotes && hasParameter("notes")) {
    var notes = getParameter("notes");
    if (notes) {
      var lines = String(notes).split("\n");
      var r1 = new RegExp("^[\\s]+", "g");
      var r2 = new RegExp("[\\s]+$", "g");
      for (line in lines) {
        var comment = lines[line].replace(r1, "").replace(r2, "");
        if (comment) {
          writeComment(comment);
        }
      }
    }
  }
  
  if (insertToolCall) {
    forceWorkPlane();
    
    onCommand(COMMAND_COOLANT_OFF);
  
    if (properties.useToolChanger) {
      if (!isFirstSection() && properties.optionalStop) {
        onCommand(COMMAND_OPTIONAL_STOP);
      }
    }
  
    if (tool.number > 99) {
      warning(localize("Tool number exceeds maximum value."));
    }
    
    if (properties.useToolChanger) {
      writeBlock("T" + toolFormat.format(tool.number), mFormat.format(6));
    } else {
      var comment = "T" + toolFormat.format(tool.number) + "  " +
        "D=" + xyzFormat.format(tool.diameter) + " " +
        localize("CR") + "=" + xyzFormat.format(tool.cornerRadius);
      if ((tool.taperAngle > 0) && (tool.taperAngle < Math.PI)) {
        comment += " " + localize("TAPER") + "=" + taperFormat.format(tool.taperAngle) + localize("deg");
      }
      comment += " - " + getToolTypeName(tool.type);
      writeComment(comment);
    }
    if (tool.comment) {
      writeComment(tool.comment);
    }
    var showToolZMin = false;
    if (showToolZMin) {
      if (is3D()) {
        var numberOfSections = getNumberOfSections();
        var zRange = currentSection.getGlobalZRange();
        var number = tool.number;
        for (var i = currentSection.getId() + 1; i < numberOfSections; ++i) {
          var section = getSection(i);
          if (section.getTool().number != number) {
            break;
          }
          zRange.expandToRange(section.getGlobalZRange());
        }
        writeComment(localize("ZMIN") + "=" + zRange.getMinimum());
      }
    }

    if (!properties.useToolChanger) {
      onCommand(COMMAND_STOP);
    }
  }
  
  if (insertToolCall ||
      isFirstSection() ||
      (rpmFormat.areDifferent(spindleSpeed, sOutput.getCurrent())) ||
      (tool.clockwise != getPreviousSection().getTool().clockwise)) {
    if (spindleSpeed < 1) {
      error(localize("Spindle speed out of range."));
    }
    if (spindleSpeed > 99999) {
      warning(localize("Spindle speed exceeds maximum value."));
    }
    writeBlock(
      sOutput.format(spindleSpeed), mFormat.format(tool.clockwise ? 3 : 4)
    );
  }

 

0 Likes
Message 8 of 10

engineguy
Mentor
Mentor
Accepted solution

@Anonymous 

 

Unless I am badly mistaken it seems to be doing pretty much everything you need already, the only thing missing that I can see is the M5 spindle stop command, if eveything else is OK for you then try the small modification in your PP as in the image below, all it does is produce the M5 spindle stop right after the machine has moved to the G28 Z0 position which depending on how you have your control setup should be the highest point of your Z axis travel (Machine Z Home).

The M0 now activates and you are able to change tool.

Add Stop Spindle.jpg

Just add the line 457 as above.

Here is the code as generated with the above modification for your sample file 🙂

%
O00001001
($PROGRAM.PARTNAME)
(T3 D=6. CR=0. - ZMIN=-5. - FLAT END MILL)
(T6 D=10. CR=0. - ZMIN=0. - FLAT END MILL)
G90 G94 G17
G21
G91
G28 Z0.
G90
(FACE1)
M5
(T6 D=10. CR=0. - FLAT END MILL)
(10X10MM FLAT END MILL - 2 FLUTE)
M0
S10000 M3
G54
G0 X55.5 Y-46.562
G43 Z15. H6
G0 Z5.
G1 Z0. F3000.
X50.
X0.
G2 Y-38.218 J4.172
G1 X50.
G3 Y-29.875 J4.172
G1 X0.
G2 Y-21.532 J4.172
G1 X50.
G3 Y-13.188 J4.172
G1 X0.
G2 Y-4.845 J4.172
G1 X50.
X55.
G0 Z15. Clearance Height as set in your "Heights" tab
G91
G28 Z0. Machine moves to Z "Home" position, (most machines would have the G91 on the same line as the G28 Z0)
G90  Control goes back to "Absolute" after the G91 G28 Z0 "Home" move
(2D CONTOUR1)
M5 Now you get the Spindle Stop command, spindle stops
(T3 D=6. CR=0. - FLAT END MILL)
(6X25MM SLOT DRILL)
M0 Machine stops and you do you tool change
S12000 M3
G54
G0 X32. Y-25.
G43 Z10. H3
G0 Z5.
G1 Z1. F1500.
Z-5.
G3 X18. I-7. F3000.
X32. I7.
G0 Z10.
G91
G28 Z0.
G90
M5
G91
G28 X0. Y0.
G90
M30
%

Don`t know if that is exactly what you need but at least you can give it a try without major modifications to your PP 🙂 🙂

 

Regards

rob

Message 9 of 10

Anonymous
Not applicable

Apologies for the slow reply. I have just amended the post as you suggested and ran a test post out (not on the machine yet as I am stuck at home) but it generates the M5 exactly as you suggested- thanks so much. One final question if you don't mind?... Does that M5 automatically create a stop on the machine that is resumed with cycle start? 

 

Thanks again.

0 Likes
Message 10 of 10

engineguy
Mentor
Mentor

@Anonymous 

 

No, it doesn`t, M5 is only a stop spindle command, it doesn`t actually stop the machine.

M codes for spindle operation are:-

M3 start spindle go clockwise

M4 start spindle go counter clockwise

M5 stop spindle.

Further down the code there is an M0, that is the stop machine command and you will see that after the M0 there is a new spindle speed S12000 and an M3 so when the "cycle start" is operated the M3 starts the spindle at the programmed rpm, the S****#.

So yes, after the machine and spindle stop and you have changed your tool pressing the cycle start should re-start the programm running.

Assuming that you have already set your tool length offset correctly then all should be well 🙂 🙂 🙂

 

Regards

Rob

0 Likes