Macro to calculate circular feedrate

Macro to calculate circular feedrate

josh.cowley.ctd
Contributor Contributor
1,282 Views
4 Replies
Message 1 of 5

Macro to calculate circular feedrate

josh.cowley.ctd
Contributor
Contributor

Hi everyone, 

I am very new to creating macros and this went very quickly over my head so any help is greatly appreciated!

 

.I would like to create a macro that would look at the active toolpath, pull the tool dia, number of flutes of tool, rpm, and IPT, then ask me for the dia of circle and then calculate actual feed rate needed to maintain the correct chip load at the cutting edge of tool, then input new value into the feed rate box of toolpath.

 

Basically I want to incorporate something like  this great little calc from guhring web site (WWW.guhring.com/tech/endmillcalc) for inside circular feed rate correction into an automated process inside PM 

 

Thank you very much for any help you can provide!

0 Likes
1,283 Views
4 Replies
Replies (4)
Message 2 of 5

Anonymous
Not applicable

In Heidenhain controllers similar function M109/M110 Feed rate for circular arcs: M109/M110/M111.

I create a simplified/limited calculator macro:

// Demo feedrate multiplier calculator for circle contouring
// It only works if active toolpath type 'Curve profile',calculated and path is full circle
IF NOT entity_exists('toolpath','') {
   RETURN
}
ENTITY TP=entity('toolpath','')
IF (NOT $TP.Computed) OR ($TP.Strategy !='curve_profile') {
   RETURN
}
DEACTIVATE WORKPLANE
DEACTIVATE TOOLPATH
ACTIVATE TOOLPATH $TP.Name
ACTIVATE PATTERN $TP.Pattern.Name
IF $TP.Statistics.CuttingMoves.Lengths.Linear != 0 {
   RETURN
}
REAL ARRAY limsT[] = toolpath_cut_limits($TP.Name)
IF round($TP.Statistics.CuttingMoves.Lengths.Arcs,2) != round(PI*($LimsT[1]-$LimsT[0]),2) {
// Not a circle
   RETURN
}
REAL TPX=round($LimsT[1]-$LimsT[0],3)
REAL TPY=round($LimsT[3]-$LimsT[2],3)
REAL TPZ=round($LimsT[5]-$LimsT[4],3)
IF $TPX != $TPY OR $TPZ !=0 {
   RETURN
}

REAL ARRAY limsP[] = $LimsT
IF NOT entity_exists('workplane','') {
   REAL ARRAY tmp[]= limits(Pattern)
   $LimsP=$tmp
} ELSE {
   REAL ARRAY tmp[] = limits_workplane_rel(entity('pattern', ''), entity('workplane', ''))
   $LimsP=$tmp
}
REAL PX=round($LimsP[1]-$LimsP[0],3)
REAL PY=round($LimsP[3]-$LimsP[2],3)
IF $PX != $PY {
   RETURN
}

REAL Ratio=1
IF $PX < $TPX {
// Outer path
// Calculate with nominal size (ignore curve thickness)
   $Ratio=($PX+$TP.Tool.Diameter)/$PX
// Calculate with REAL size (include curve thickness)
// ver1.
   $Ratio=$TPX/($TPX-$TP.Tool.Diameter)
// ver2.
   $Ratio=$TPX /($PX+2*$Tp.CurveThickness)
} ELSE {
// Inner path
// Calculate with nominal size (ignore curve thickness)
   $Ratio=($PX-$TP.Tool.Diameter)/$PX
// Calculate with REAL size (include curve thickness)
// ver1.
   $Ratio=$TPX /($TPX+$Tp.Tool.Diameter)
// ver2.
   $Ratio=$TPX /($PX-2*+$Tp.CurveThickness)
}
MESSAGE INFO 'Feedrate multiplier '+round($Ratio,4)
Message 3 of 5

Anonymous
Not applicable

I modify Fanuc generic PP for emulate Heidenhain M109.
Steps in AMPPU:
1. Copy/paste Feed Rate parameter to User Parameters, then rename "Feed Rate Calculated".
2. Replace Feed Rate parameter with Feed Rate Calculated in Move Linear and Circular Move XY commands.
3. Add Script function to Move Linear command:

function MoveLinear()
{
   if ((GetParam("%p(Feed Rate Calculated)%") != GetParam("%p(Feed Rate)%")) ){
      SetParam("%p(Feed Rate Calculated)%",GetParam("%p(Feed Rate)%"));
   }
   return StandardResponse();
}

4. Add Script function to Circular Move XY:

function CircularMoveXY()
{
   if ((GetParam("%p(Cutter Compensation Mode)%") == "LEFT") || (GetParam("%p(Cutter Compensation Mode)%") == "RIGHT")) {
      if (((GetParam("%p(Motion Mode)%") == "CW") && (GetParam("%p(Cutter Compensation Mode)%") == "LEFT")) || ((GetParam("%p(Motion Mode)%") == "CCW") && (GetParam("%p(Cutter Compensation Mode)%") == "RIGHT"))) {
         // Outer path
         var Ratio=(GetParam("%p(Arc Radius)%")+GetParam("%p(Tool Diameter)%")/2)/GetParam("%p(Arc Radius)%");
         // Limit max. feedrate to 150%
         Ratio=Math.min(1.5,Ratio);
         var FeedRateCalculated=Math.min(Ratio*GetParam("%p(Feed Rate)%"),GetParam("%p(Max Cutting Rate)%"));
         SetParam("%p(Feed Rate Calculated)%",FeedRateCalculated);
       } else {
         // Inner path
         var Ratio=(GetParam("%p(Arc Radius)%")-GetParam("%p(Tool Diameter)%")/2)/GetParam("%p(Arc Radius)%");
         // Limit min. feedrate to 20%
         Ratio=Math.max(0.2,Ratio);
         var FeedRateCalculated=Ratio*GetParam("%p(Feed Rate)%");
         SetParam("%p(Feed Rate Calculated)%",FeedRateCalculated);
       }
   } else {
      if ((GetParam("%p(Feed Rate Calculated)%") != GetParam("%p(Feed Rate)%")) ){
         SetParam("%p(Feed Rate Calculated)%",GetParam("%p(Feed Rate)%"));
      }
  }
  return StandardResponse();
}

The test contour:

Inner + OuterInner + Outer

The resultThe result

This is not a fully tested industrial strength solution, only experiment.

Message 4 of 5

thaont.cnc
Advocate
Advocate

Hi karbidhegyu!

You can share post processor

 

0 Likes
Message 5 of 5

Anonymous
Not applicable

Modification: new 'udp_AtBottom' user parameter, if it is set to "TRUE" it will only slow down on the inner arcs, keep the original feed rate on the outer arcs.

AtBottom.JPG

 

0 Likes