⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 interp_cycles.cc

📁 Source code for an Numeric Cmputer
💻 CC
📖 第 1 页 / 共 4 页
字号:
/********************************************************************* Description: interp_cycles.cc**   The bulk of the functions here control how canned cycles are*   interpreted.** Author:* License: GPL Version 2* System: Linux*    * Copyright (c) 2004 All rights reserved.** Last change:* $Revision: 1.10 $* $Author: cradek $* $Date: 2006/03/21 02:42:31 $********************************************************************/#include <unistd.h>#include <stdio.h>#include <stdlib.h>#include <math.h>#include <string.h>#include <ctype.h>#include <sys/types.h>#include <sys/stat.h>#include "rs274ngc.hh"#include "rs274ngc_return.hh"#include "interp_internal.hh"/****************************************************************************//*! convert_cycle_g81Returned Value: int (INTERP_OK)Side effects: See belowCalled by:   convert_cycle_xy   convert_cycle_yz   convert_cycle_zxFor the XY plane, this implements the following RS274/NGC cycle, whichis usually drilling:1. Move the z-axis only at the current feed rate to the specified bottom_z.2. Retract the z-axis at traverse rate to clear_z.See [NCMS, page 99].CYCLE_MACRO has positioned the tool at (x, y, r, a, b, c) when this starts.For the XZ and YZ planes, this makes analogous motions.*/int Interp::convert_cycle_g81(CANON_PLANE plane, //!< selected plane                                               double x,  //!< x-value where cycle is executed                              double y,  //!< y-value where cycle is executed                              double clear_z,    //!< z-value of clearance plane                                   double bottom_z)   //!< value of z at bottom of cycle   {  cycle_feed(plane, x, y, bottom_z);  cycle_traverse(plane, x, y, clear_z);  return INTERP_OK;}/****************************************************************************//*! convert_cycle_g82Returned Value: int (INTERP_OK)Side effects: See belowCalled by:   convert_cycle_xy   convert_cycle_yz   convert_cycle_zxFor the XY plane, this implements the following RS274/NGC cycle, whichis usually drilling:1. Move the z_axis only at the current feed rate to the specified z-value.2. Dwell for the given number of seconds.3. Retract the z-axis at traverse rate to the clear_z.CYCLE_MACRO has positioned the tool at (x, y, r, a, b, c) when this starts.For the XZ and YZ planes, this makes analogous motions.*/int Interp::convert_cycle_g82(CANON_PLANE plane, //!< selected plane                                               double x,  //!< x-value where cycle is executed                              double y,  //!< y-value where cycle is executed                              double clear_z,    //!< z-value of clearance plane                                   double bottom_z,   //!< value of z at bottom of cycle                                double dwell)      //!< dwell time                      {  cycle_feed(plane, x, y, bottom_z);  DWELL(dwell);  cycle_traverse(plane, x, y, clear_z);  return INTERP_OK;}/****************************************************************************//*! convert_cycle_g83Returned Value: int (INTERP_OK)Side effects: See belowCalled by:   convert_cycle_xy   convert_cycle_yz   convert_cycle_zxFor the XY plane, this implements the following RS274/NGC cycle,which is usually peck drilling:1. Move the z-axis only at the current feed rate downward by delta or   to the specified bottom_z, whichever is less deep.2. Rapid back out to the clear_z.3. Rapid back down to the current hole bottom, backed off a bit.4. Repeat steps 1, 2, and 3 until the specified bottom_z is reached.5. Retract the z-axis at traverse rate to clear_z.CYCLE_MACRO has positioned the tool at (x, y, r, a, b, c) when this starts.The rapid out and back in causes any long stringers (which are commonwhen drilling in aluminum) to be cut off and clears chips from thehole.For the XZ and YZ planes, this makes analogous motions.*/int Interp::convert_cycle_g83(CANON_PLANE plane, //!< selected plane                                               double x,  //!< x-value where cycle is executed                              double y,  //!< y-value where cycle is executed                              double r,  //!< initial z-value                                              double clear_z,    //!< z-value of clearance plane                                   double bottom_z,   //!< value of z at bottom of cycle                                double delta)      //!< size of z-axis feed increment   {  static char name[] = "convert_cycle_g83";  double current_depth;  double rapid_delta;  /* Moved the check for negative Q values here as a sign     may be used with user defined M functions     Thanks to Billy Singleton for pointing it out... */  CHK((delta <= 0.0), NCE_NEGATIVE_OR_ZERO_Q_VALUE_USED);  rapid_delta = G83_RAPID_DELTA;  if (_setup.length_units == CANON_UNITS_MM)    rapid_delta = (rapid_delta * 25.4);  for (current_depth = (r - delta);       current_depth > bottom_z; current_depth = (current_depth - delta)) {    cycle_feed(plane, x, y, current_depth);    cycle_traverse(plane, x, y, clear_z);    cycle_traverse(plane, x, y, current_depth + rapid_delta);  }  cycle_feed(plane, x, y, bottom_z);  cycle_traverse(plane, x, y, clear_z);  return INTERP_OK;}/****************************************************************************//*! convert_cycle_g84Returned Value: int   If the spindle is not turning clockwise, this returns     NCE_SPINDLE_NOT_TURNING_CLOCKWISE_IN_G84.   Otherwise, it returns INTERP_OK.Side effects: See belowCalled by:   convert_cycle_xy   convert_cycle_yz   convert_cycle_zxFor the XY plane, this implements the following RS274/NGC cycle,which is right-hand tapping:1. Start speed-feed synchronization.2. Move the z-axis only at the current feed rate to the specified bottom_z.3. Stop the spindle.4. Start the spindle counterclockwise.5. Retract the z-axis at current feed rate to clear_z.6. If speed-feed synch was not on before the cycle started, stop it.7. Stop the spindle.8. Start the spindle clockwise.CYCLE_MACRO has positioned the tool at (x, y, r, a, b, c) when this starts.The direction argument must be clockwise.For the XZ and YZ planes, this makes analogous motions.*/int Interp::convert_cycle_g84(CANON_PLANE plane, //!< selected plane                                                  double x,  //!< x-value where cycle is executed                                 double y,  //!< y-value where cycle is executed                                 double clear_z,    //!< z-value of clearance plane                                      double bottom_z,   //!< value of z at bottom of cycle                                   CANON_DIRECTION direction, //!< direction spindle turning at outset                             CANON_SPEED_FEED_MODE mode)        //!< the speed-feed mode at outset      {  static char name[] = "convert_cycle_g84";  CHK((direction != CANON_CLOCKWISE),      NCE_SPINDLE_NOT_TURNING_CLOCKWISE_IN_G84);#if 0  START_SPEED_FEED_SYNCH();  cycle_feed(plane, x, y, bottom_z);  STOP_SPINDLE_TURNING();  START_SPINDLE_COUNTERCLOCKWISE();  cycle_feed(plane, x, y, clear_z);  if (mode != CANON_SYNCHED)    STOP_SPEED_FEED_SYNCH();  STOP_SPINDLE_TURNING();  START_SPINDLE_CLOCKWISE();#endif  return INTERP_OK;}/****************************************************************************//*! convert_cycle_g85Returned Value: int (INTERP_OK)Side effects:   A number of moves are made as described below.Called by:   convert_cycle_xy   convert_cycle_yz   convert_cycle_zxFor the XY plane, this implements the following RS274/NGC cycle,which is usually boring or reaming:1. Move the z-axis only at the current feed rate to the specified z-value.2. Retract the z-axis at the current feed rate to clear_z.CYCLE_MACRO has positioned the tool at (x, y, r, ?, ?) when this starts.For the XZ and YZ planes, this makes analogous motions.*/int Interp::convert_cycle_g85(CANON_PLANE plane, //!< selected plane                                               double x,  //!< x-value where cycle is executed                              double y,  //!< y-value where cycle is executed                              double clear_z,    //!< z-value of clearance plane                                   double bottom_z)   //!< value of z at bottom of cycle   {  cycle_feed(plane, x, y, bottom_z);  cycle_feed(plane, x, y, clear_z);  return INTERP_OK;}/****************************************************************************//*! convert_cycle_g86Returned Value: int   If the spindle is not turning clockwise or counterclockwise,   this returns NCE_SPINDLE_NOT_TURNING_IN_G86.   Otherwise, it returns INTERP_OK.Side effects:   A number of moves are made as described below.Called by:   convert_cycle_xy   convert_cycle_yz   convert_cycle_zxFor the XY plane, this implements the RS274/NGC following cycle,which is usually boring:1. Move the z-axis only at the current feed rate to bottom_z.2. Dwell for the given number of seconds.3. Stop the spindle turning.4. Retract the z-axis at traverse rate to clear_z.5. Restart the spindle in the direction it was going.CYCLE_MACRO has positioned the tool at (x, y, r, a, b, c) when this starts.For the XZ and YZ planes, this makes analogous motions.*/int Interp::convert_cycle_g86(CANON_PLANE plane, //!< selected plane                                                  double x,  //!< x-value where cycle is executed                                 double y,  //!< y-value where cycle is executed                                 double clear_z,    //!< z-value of clearance plane                                      double bottom_z,   //!< value of z at bottom of cycle                                   double dwell,      //!< dwell time                                                      CANON_DIRECTION direction) //!< direction spindle turning at outset{  static char name[] = "convert_cycle_g86";  CHK(((direction != CANON_CLOCKWISE) &&       (direction != CANON_COUNTERCLOCKWISE)),      NCE_SPINDLE_NOT_TURNING_IN_G86);  cycle_feed(plane, x, y, bottom_z);  DWELL(dwell);  STOP_SPINDLE_TURNING();  cycle_traverse(plane, x, y, clear_z);  if (direction == CANON_CLOCKWISE)    START_SPINDLE_CLOCKWISE();  else    START_SPINDLE_COUNTERCLOCKWISE();  return INTERP_OK;}/****************************************************************************//*! convert_cycle_g87Returned Value: int   If the spindle is not turning clockwise or counterclockwise,   this returns NCE_SPINDLE_NOT_TURNING_IN_G87.   Otherwise, it returns INTERP_OK.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -