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

📄 interp_inverse.cc

📁 Source code for an Numeric Cmputer
💻 CC
字号:
/********************************************************************* Description: interp_inverse.cc**   Derived from a work by Thomas Kramer** Author:* License: GPL Version 2* System: Linux*    * Copyright (c) 2004 All rights reserved.** Last change:* $Revision: 1.7 $* $Author: alex_joni $* $Date: 2006/03/20 21:15:40 $********************************************************************/#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 "interp_return.hh"#include "interp_internal.hh"/****************************************************************************//*! inverse_time_rate_arcReturned Value: int (INTERP_OK)Side effects: a call is made to SET_FEED_RATE and _setup.feed_rate is set.Called by:  convert_arc2  convert_arc_comp1  convert_arc_comp2This finds the feed rate needed by an inverse time move. The moveconsists of an a single arc. Most of the work here is in finding thelength of the arc.*/int Interp::inverse_time_rate_arc(double x1,     //!< x coord of start point of arc                                            double y1,     //!< y coord of start point of arc                                            double z1,     //!< z coord of start point of arc                                            double cx,     //!< x coord of center of arc                                                 double cy,     //!< y coord of center of arc                                                 int turn,      //!< turn of arc                                                              double x2,     //!< x coord of end point of arc                                              double y2,     //!< y coord of end point of arc                                              double z2,     //!< z coord of end point of arc                                              block_pointer block,   //!< pointer to a block of RS274 instructions                                 setup_pointer settings)        //!< pointer to machine settings             {  double length;  double rate;  length = find_arc_length(x1, y1, z1, cx, cy, turn, x2, y2, z2);  rate = MAX(0.1, (length * block->f_number));  SET_FEED_RATE(rate);  settings->feed_rate = rate;  return INTERP_OK;}/****************************************************************************//*! inverse_time_rate_arc2Returned Value: int (INTERP_OK)Side effects: a call is made to SET_FEED_RATE and _setup.feed_rate is set.Called by: convert_arc_comp2This finds the feed rate needed by an inverse time move inconvert_arc_comp2. The move consists of an extra arc and a mainarc. Most of the work here is in finding the lengths of the two arcs.All rotary motion is assumed to occur on the extra arc, as done byconvert_arc_comp2.All z motion is assumed to occur on the main arc, as done byconvert_arc_comp2.*/int Interp::inverse_time_rate_arc2(double start_x,       //!< x coord of last program point, extra arc center x                                  double start_y,       //!< y coord of last program point, extra arc center y                                  int turn1,    //!< turn of extra arc                                                                  double mid_x, //!< x coord of end point of extra arc                                                  double mid_y, //!< y coord of end point of extra arc                                                  double cx,    //!< x coord of center of main arc                                                      double cy,    //!< y coord of center of main arc                                                      int turn2,    //!< turn of main arc                                                                   double end_x, //!< x coord of end point of main arc                                                   double end_y, //!< y coord of end point of main arc                                                   double end_z, //!< z coord of end point of main arc                                                   block_pointer block,  //!< pointer to a block of RS274 instructions                                           setup_pointer settings)       //!< pointer to machine settings                      {  double length;  double rate;  length =    (find_arc_length     (settings->current_x, settings->current_y, settings->current_z,      start_x, start_y, turn1, mid_x, mid_y,      settings->current_z) + find_arc_length(mid_x, mid_y,                                             settings->current_z,                                             cx, cy, turn2, end_x,                                             end_y, end_z));  rate = MAX(0.1, (length * block->f_number));  SET_FEED_RATE(rate);  settings->feed_rate = rate;  return INTERP_OK;}/****************************************************************************//*! inverse_time_rate_asReturned Value: int (INTERP_OK)Side effects: a call is made to SET_FEED_RATE and _setup.feed_rate is set.Called by: convert_straight_comp2This finds the feed rate needed by an inverse time move inconvert_straight_comp2. The move consists of an extra arc and a straightline. Most of the work here is in finding the lengths of the arc andthe line.All rotary motion is assumed to occur on the arc, as done byconvert_straight_comp2.All z motion is assumed to occur on the line, as done byconvert_straight_comp2.*/int Interp::inverse_time_rate_as(double start_x, //!< x coord of last program point, extra arc center x                                double start_y, //!< y coord of last program point, extra arc center y                                int turn,       //!< turn of extra arc                                                                double mid_x,   //!< x coord of end point of extra arc                                                double mid_y,   //!< y coord of end point of extra arc                                                double end_x,   //!< x coord of end point of straight line                                            double end_y,   //!< y coord of end point of straight line                                            double end_z,   //!< z coord of end point of straight line                                            double AA_end,  //!< A coord of end point of straight line                                      double BB_end,  //!< B coord of end point of straight line                                      double CC_end,  //!< C coord of end point of straight line                                      block_pointer block,    //!< pointer to a block of RS274 instructions                                         setup_pointer settings) //!< pointer to machine settings                      {  double length;  double rate;  length =    (find_arc_length     (settings->current_x, settings->current_y, settings->current_z,      start_x, start_y, turn, mid_x, mid_y,      settings->current_z) + find_straight_length(end_x, end_y, end_z,                            AA_end, BB_end, CC_end,                            mid_x, mid_y, settings->current_z,                            AA_end, BB_end, CC_end));  rate = MAX(0.1, (length * block->f_number));  SET_FEED_RATE(rate);  settings->feed_rate = rate;  return INTERP_OK;}/****************************************************************************//*! inverse_time_rate_straightReturned Value: int (INTERP_OK)Side effects: a call is made to SET_FEED_RATE and _setup.feed_rate is set.Called by:  convert_straight  convert_straight_comp1  convert_straight_comp2This finds the feed rate needed by an inverse time straight move. Mostof the work here is in finding the length of the line.*/int Interp::inverse_time_rate_straight(double end_x,     //!< x coordinate of end point of straight line                                      double end_y,     //!< y coordinate of end point of straight line                                      double end_z,     //!< z coordinate of end point of straight line                                      double AA_end,    //!< A coordinate of end point of straight line/*AA*/                                      double BB_end,    //!< B coordinate of end point of straight line/*BB*/                                      double CC_end,    //!< C coordinate of end point of straight line/*CC*/                                      block_pointer block,      //!< pointer to a block of RS274 instructions                                        setup_pointer settings)   //!< pointer to machine settings               {  double length;  double rate;  length = find_straight_length(end_x, end_y, end_z,                                AA_end, BB_end, CC_end,                                settings->current_x, settings->current_y, settings->current_z,                                settings->AA_current, settings->BB_current, settings->CC_current);  rate = MAX(0.1, (length * block->f_number));  SET_FEED_RATE(rate);  settings->feed_rate = rate;  return INTERP_OK;}

⌨️ 快捷键说明

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