CME-API Help¶
Introduction¶
CME-API is the replacement for Vericut Machine Developers Kit (DevKit). DevKit consisted of a licensed compiler and documentation on how to create and compile Vericut Macro Language (CML) programs. CML programs enabled the user to extend Vericut's control emulation with custom NC macros that emulate unique behavior of the customer's machine. The CML program has access to specific "exported" functions within Vericut. The compiler produced a Vericut Macro Executable (CME) file containing a compiled form of the CML program. The CME was then used by Vericut's control file to add customer-created NC macros to the control emulation.
The DevKit functionality is replaced by a new method for creating custom NC macros: the C Macro Extension – Application Programming Interface or CME–API.
Using CME-API, you can write a standard C, or C++, program which calls "exported" functions in Vericut (the exact same "exported" functions that were available to a DevKit CML program). He then compiles this program using Microsoft's Visual Studio 6.0 C++ compiler, into a standard Windows Dynamic Link Library (DLL). The DLL is loaded by Vericut at runtime, extending Vericut's control emulation with custom NC macros (exactly the same as a DevKit-created CME).
CME-API replacement has several advantages over DevKit:
-
CME-API uses an industry-standard language: C or C++
-
CME-API gives the developer access to all the full, rich features of C and C++
- CME-API enables the developer to use standard C, and C++, debugging tools
- CME-API runs much faster than a CME file
The CME-API functionality is available with a base Verification license, not as an optional module. Any Vericut user has access to it, but it does require using Microsoft Visual Studio 6.0 C++. CME-API is available only on Windows. There are no plans to port it to UNIX.
CME-API Documentation
This document is intended to describe using "exported" Vericut functions in a C program, compiling a CME-API DLL in Microsoft Visual Studio, and how to use the DLL in a Vericut simulation. It will also contain a document on how to convert a CML program to C.
This documentation is written for use by a software developer with a working knowledge of the C programming language and Microsoft Visual Studio. It is not intended to document the C programming language, nor how to use Microsoft's development environment. There are many fine books available on both these topics in libraries and book stores. There are also many college and university courses on the C and C++ programming languages.
CME-API Deliverable
The CME-API deliverable consists of an example C source file ( example1.c ), a library ( ( Vericut.lib ) , and header files ( cmeapi_defines.h, cmeapi_import.h, and cmeapi_types.h ) that provide access to available "exported" functions These files can all be found in the \windows\cmeapi directory of your Vericut installation.
Migration from DevKit to CME-API
Former DevKit users must modify their existing CML programs in order to create a new CME-API compatible DLL. They will have to convert their CML programs to C, and compile them using Microsoft's Visual Studio 6.0 C++ compiler. Fortunately the old CML language syntax is very similar to C. All the Vericut functions used by CME-API are exactly the same as those that were available to CML. End-users of CME-API must be an experienced C, or C++, programmer with sufficient knowledge of the C language syntax and the Microsoft Visual Studio development environment.
Convert a CMS file to C using the CME-API¶
This section describes the steps that are required to convert an existing DevKit CMS file to a C file that can be used with CME-API.
-
Change "text" to "char *", or "char [ ]".
-
Change "number" to "double"
- Change functions starting with "cfunc_" to start with "cmeapi_".
- Change function declarations to ANSI C declarations.
- Move local variables inside the function.
- Change "AXIS" to "CMEAPI_AXIS".
- Change prefix "RP2_" to "CMEAPI_ ". For example, RP2_POINT should be changed to CMEAPI_POINT.
- Change expressions, i.e. from lt to \<.
- Change string expressions to use C string functions
- Add "CMEAPI_" in front of some previous #defines
- Use the function cmeapi_register_macro( ) to define macros in Vericut instead of the name beginning with "cms_".
-
Define a function called cmeapi_init( ).
/* ************************************************************************** */
#define DllExport _declspec(dllexport)/* ************************************************************************** */
DllExport void cmeapi_init(void)
{
printf("cmeapi_init() Success!\n"); cmeapi_register_macro("UserCheckSpindle", cms_UserCheckSpindle);}
Build a DLL in Visual Studio Express C++¶
This section describes how to build a DLL in Visual Studio Express C++.
To build a DLL in Visual C++:
-
Start a New Workspace/Project for an Empty DLL
-
Add WIN_NT to the C/C++ preprocessor definitions
- Add Vericut.lib to Link library modules
- Add the C source code and header file, compile, & link
The following are the steps to required to configure Visual Studio Express C++ to work with the Vericut CME-API, and to build the example included with Vericut:
-
Launch Visual Studio Express > New > Project
-
General > Empty Project
-
Give the project a name – (e.g. vericut_cme)
- Store project on local drive – (e.g. c:\vericut_cme)
-
-
Locate the Tree on the left
-
Right Click on the Top Level [vericut_cme] > Add > Existing Item
-
Navigate to your Vericut directory - (e.g. c:\cgtech97\windows\cmeapi)
- Highlight all files > Click Add
-
-
Locate the Tree on the left
-
Right Click on the Top Level [vericut_cme] > Properties
-
Configuration Properties > General > Configuration Type > [Dynamic Library (.dll)]
- C/C++ > Preprocessor > Preprocessor Definitions > [WIN_NT]
- Linker > General > Additional Library Directories [c:\cgtech97\windows\cmeapi]
- Linker > Input > Additional Dependencies > Vericut.lib
-
-
Click OK to save properties
-
Build > Build Solution
- Results should be [Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped]
-
Launch Vericut
- Configuration > Adv. Options > Dev Kit CME [tab] > Browse to where the vericut_cme.dll was outputted (e.g. c:\vericut_cme\vericut_cme\debug vericut_cme.dll) > Click OK.
-
To confirm the DLL is being loaded, modify your vericut.bat file before launching Vericut.
- Change "%CGTECH_JRE%\bin\javaw" to "%CGTECH_JRE%\bin\java" (remove the "w") so that the dialog window stays open.
If the DLL is loaded successfully, you should see "cmeapi_init() Success!"
Registering Functions¶
Suppose you defined a function char *modify_input_str(char *) in C. The CME-API does not know about it until you notify the CME-API by "registering" it. The function does not have to be named modify_input_str, it can be named anything that you want, but it does have to have a "char *" as the input argument and a "char *" as the return argument.
If the function name is char *modify_input_str(char *) then add the following call in cmeapi_init():
cmeapi_register_modify_input_str(modify_input_str);
The following functions are provided to enable you to "register" three types of functions:
void cmeapi_register_start_init(vvFunc fptr);
Use the function void cmeapi_register_start_init(vvFunc fptr) to register your own function that is called at the start of initialization which has no input arguments and does not return anything: void fptr(void);
void cmeapi_register_modify_input_str(ccFunc fptr);
Use the function void cmeapi_register_modify_input_str(ccFunc fptr) to register your own function to modify the input string which has one one string input argument and returns the modified string: char *fptr(char *);
void cmeapi_register_modify_output_str(ccFunc fptr);
Use the function void cmeapi_register_modify_output_str(ccFunc fptr) to register your own function to modify the output string which has one string input argument and returns the modified string: char *fptr(char *);
Vericut Machine Simulation CMEAPI C-functions Reference¶
DllExport void cmeapi_init(void)
This function is called when the DLL is loaded. You must define this functions in your DLL.
void cmeapi_register_macro(char *name, void *(func_ptr))
Use this function to define a macro in Vericut. This function should be called in cmeapi_init()
The following is an example of code to needed to define, initialize, and register Macros in Vericut.
#include "cmeapi_import.h"
/* ************************************************************************** */
void UserTest(char *, char *, value)
{
printf("My UserTest macro was called\n");
}
/* ************************************************************************** */
DllExport void cmeapi_init(void)
{
printf("My cmeapi_init() was called\n");
cmeapi_register_macro("UserTest", UserTest);
}
The following functions were converted from the Vericut Macro Language:
void cmeapi_abort_processing();
Causes immediate, normal termination of machine code block processing.
void cmeapi_activate_head(tool_comp_name, spindle_comp_name, css_flag);
char *tool_comp_name;
char *spindle_comp_name;
double css_flag
Causes the specified tool head to become active. For example: if there is 2 heads on the machine (A and B). Activating "A", and then calling for a tool change would cause the tool to be connected to head A.
void cmeapi_add_nurbs_ctrl(xval, yval, zval, ivector, jvector, kvector, weight);
double xval;
double yval;
double zval;
double ivector;
double jvector;
double kvector;
double weight;
Add a control point to the NURBS structure.
See also:
void cmeapi_add_nurbs_knot(knot);
void cmeapi_add_nurbs_objdata(knot);
void cmeapi_convert_nurbs_2_apt(subsystem, xreg, yreg, zreg, sequence_no);
void cmeapi_free_nurbs_objdata(knot);
double cmeapi_nurbs_get_next_point(xval, yval, zval);
void cmeapi_set_nurbs_order(order);
void cmeapi_add_nurbs_knot(knot);
double knot;
Add a knot point to the NURBS structure.
See also:
void cmeapi_add_nurbs_ctrl(xval, yval, zval, ivector, jvector, kvector, weight);
void cmeapi_add_nurbs_objdata(knot);
void cmeapi_convert_nurbs_2_apt(subsystem, xreg, yreg, zreg, sequence_no);
void cmeapi_free_nurbs_objdata(knot);
double cmeapi_nurbs_get_next_point(xval, yval, zval);
void cmeapi_set_nurbs_order(order);.
void cmeapi_add_nurbs_objdata(knot);
double knot;
This function saves the current input data and associates it with the specified knot point. This is used by Optimization.
See also:
void cmeapi_add_nurbs_ctrl(xval, yval, zval, ivector, jvector, kvector, weight);
void cmeapi_add_nurbs_knot(knot);
void cmeapi_convert_nurbs_2_apt(subsystem, xreg, yreg, zreg, sequence_no);
void cmeapi_free_nurbs_objdata(knot);
double cmeapi_nurbs_get_next_point(xval, yval, zval);
void cmeapi_set_nurbs_order(order);
void cmeapi_anystrmatch(textstr1,textstr2);
This routine is passed any 2 "text" objects and returns "1" if they match, and "0" if they don't.
📝 NOTE: The comparison that is made is case insensitive.
double cmeapi_atan_depth(expression);
char *expression;
Returns the depth of the current expression after the ATAN. It is assumed that [ ] will be used as left and right precedence operators. The expression "ATAN [[[a/b]" has a current depth of 2. If ATAN is not present in the string, the depth will be set to 1.
double cmeapi_calculate_angular_rate(tolerance, angle, radius);
double tolerance;
double angle
double radius
Returns the percentage rate based on the number of chords used to represent an arc. The first argument is the rotary motion tolerance value. The second value is the angle of the arc endpoints. The third argument is the radius of the arc. The return value is the angular percentage rate.
double cmeapi_check_word_in_block(start, word, minval, maxval);
double start;
char *word;
double minval; /* Optional */
double maxval; /* Optional */
Returns the position number of the specified word in a block of machine code. It begins searching at start position in the block, trying to match the next word with an address greater than or equal to the minval and less than or equal to the maxval. Minval and maxval are optional range values. If maxval is not supplied, it matches only the word. It returns 0, if there is no word/address matched in the block.
An example using the block: N010G90G01X.1Y3
a = void cmeapi_check_word_in_block(1, "G");
b = void cmeapi_check_word_in_block(a+1, "G");
c = void cmeapi_check_word_in_block(1, "G", 0, 3);
d = void cmeapi_check_word_in_block(1, "G", 17, 19);
e = void cmeapi_check_word_in_block(1, "G", 1);
f = void cmeapi_check_word_in_block(1, "G", 2);
The value of "a" is 2, because G90 is first word "G". The value of "b" is 3, because start is 3, searching begins at G01. The value of "c" is 3, because G01 matches the word "G" and the address 01 is between 0 and 3. The value of "d" is 0, because there is no word "G" with an address that is between 17 and 19. The value of "e" is 3, because G01 matches the word "G" and the address 01 matches the minval 1. The value of "f" is 0, because there is no word "G" with an address equal to 2.
See also:
double cmeapi_current_command_number();
CMEAPI_VECTOR cmeapi_circle_normal(motion_plane, x_comp_name, y_comp_name, z_comp_name, subsystem);
double motion_plane;
char *x_comp_name;
char *y_comp_name;
char *z_comp_name;
char *subsystem;
Calculates the normal to the specified motion plane relative to the part.
void cmeapi_call_macro(macro_name, word, textstr, value);
char *macro_name;
char *word;
char *textstr;
double value;
This function calls a registered macro within the C source. The first argument specifies the name of the macro to be called. The remaining arguments are the standard arguments for a Word/Value macro.
char *cmeapi_cms_native(nt_string, ...);
Converts the specified string into a native text string. The first argument is the native text string, and the remaining arguments are the arguments to the native text string. The resultant string is returned.
void cmeapi_comp_tool_load(tool_number, tool_component_name)
double tool_number;
char *tool_component_name;
Loads a tool. The tool_number is specified in the first argument. If the tool_component_name is present, the tool will be loaded onto that component. If it is not present, the tool will be loaded onto the currently active tool component.
double cmeapi_comp_tool_side(comp_name, subsystem);
char *comp_name;
char *subsystem;
Returns 1 if the specified component is on the tool side of the machine, and returns 0 if it is not.
void cmeapi_connect_component(comp_name_1, comp_name2);
char *comp_name_1
char *comp_name_2
Disconnects component 1 from its parent component and connects it to component 2.
CMEAPI_VECTOR *cmeapi_convert_machine_vector(input);
CMEAPI_VECTOR *input;
Returns a vector converted from the input vector using the matrix calculated using the components from the part to the base.
See also:
void cmeapi_set_fixture_offset(char *, char *, double);
void cmeapi_set_tool_length_offset(z_offset);
void cmeapi_convert_nurbs_2_apt(subsystem, xreg, yreg, zreg, sequence_no);
char *subsystem;
char *xreg;
char *yreg;
char *zreg;
double sequence_no;
This function converts the previously defined NURBS curve into APT format, and prints the result to the "OUTPUT" location. The input arguments are the register names for the x, y, and z components, and the current sequence number.
See also:
void cmeapi_add_nurbs_ctrl(xval, yval, zval, ivector, jvector, kvector, weight);
void cmeapi_add_nurbs_knot(knot);
void cmeapi_add_nurbs_objdata(knot);
void cmeapi_free_nurbs_objdata(knot);
double cmeapi_nurbs_get_next_point(xval, yval, zval);
void cmeapi_set_nurbs_order(order);
double cmeapi_current_command_number();
Returns the position number of the current object. For example a block of N010G01X.1Y3, the N010 word/address is in the first object, the G01 word/address is the second object, and so on.
See also:
double cmeapi_check_word_in_block(start, word, minval, maxval);
void cmeapi_default_word(word);
Defines a default word to be used if a number is read without a corresponding word (during tokenizing).
void cmeapi_disable_all_macros();
Disables all macros from being called while tokenizing a block.
void cmeapi_edm_wire(show_wire_flag, wire_thickness)
double show_wire_flag;
double wire_thickness;
Sets 2 attributes associated with the wire. It is used while processing wire EDM jobs. Show_wire_flag specifies whether the wire should be shown with the machine simulation (1 for yes, and 0 for no), and the wire_thickness specifies the diameter of the wire.
📝 NOTE: The wire_thickness is currently being ignored by Machine Simulation. The wire will be drawn as a single pixel in width.
void cmeapi_free_nurbs();
Frees the data associated with a NURBS structure. This routine should be called after the processing of each NURBS statement.
See also:
void cmeapi_add_nurbs_ctrl(xval, yval, zval, ivector, jvector, kvector, weight);
void cmeapi_add_nurbs_knot(knot);
void cmeapi_add_nurbs_objdata(knot);
void cmeapi_convert_nurbs_2_apt(subsystem, xreg, yreg, zreg, sequence_no);
void cmeapi_free_nurbs_objdata(knot);
double cmeapi_nurbs_get_next_point(xval, yval, zval);
void cmeapi_set_nurbs_order(order);
void cmeapi_free_nurbs_objdata(knot);
double knot;
This function frees the data that was previously allocated by void cmeapi_add_nurbs_objdata().
See Also:
void cmeapi_add_nurbs_ctrl(xval, yval, zval, ivector, jvector, kvector, weight);
void cmeapi_add_nurbs_knot(knot);
void cmeapi_add_nurbs_objdata(knot);
void cmeapi_convert_nurbs_2_apt(subsystem, xreg, yreg, zreg, sequence_no);
double cmeapi_nurbs_get_next_point(xval, yval, zval);
void cmeapi_set_nurbs_order(order);
CMEAPI_VECTOR cmeapi_get_adj_tool_axis();
Returns the adjusted tool axis in its current position.
double cmeapi_get_alpha_nc_var(variable_name);
char *variable_name;
Returns the value for the NC variable, variable_name or a single entry from a numerical array variable, e.g. $AA_IM[20].
See also:
void cmeapi_get_nc_vars_list(dbl_array, start_index, end_index);
void cmeapi_set_alpha_nc_var(variable_name, value);
void cmeapi_set_nc_vars(nc_vars, start, end);
char *cmeapi_get_alpha_nc_var_string(variable_name);
char *variable_name;
Returns the text value of a specific variable or a single entry from a string array variable, e.g. $TC_CARR30[1].
double cmeapi_get_apt_7(parm1, parm2, parm3, parm4, parm5, parm6, parm7);
If the current tool is defined as a 7 parameter APT cutter, a value of 1 will be returned, and the 7 parameters will be returned in the 7 arguments. Otherwise a value of 0 will be returned.
double cmeapi_get_block_sequence();
Returns the current block sequence count (the total number of blocks that has been processed.
void cmeapi_get_c_3d_offset_parms(offset, i_present, j_present, k_present);
CMEAPI_VECTOR offset;
double i_present;
double j_present;
double k_present;
Returns the values associated with a 3 dimensional offset parameter structure.
CMEAPI_POINT *cmeapi_get_c_3d_vars(double);
double variable;
Returns the CMEAPI_POINT value of a specific variable. Supported variables include:
CMS_C_PART_NORMAL:
CMS_C_TOOL_VECTOR:
CMS_C_OFFSET_3D:
CMS_C_TOOL_MOTION_VECTOR:
CMS_C_LEADRATE:
CMS_C_CDC_OFF_ADJ_PT:
CMS_C_HEAD_VECTOR:
double cmeapi_get_c_array_vars(variable, index);
double variable;
double index;
Returns the value of a specific variable. This function is used with array variables. The indexed value into the specified array will be returned. Supported variables include:
CMS_C_BLOCK_NC_VACANT_VARS:
CMS_C_VAR_ARGUMENTS:
CMS_C_SEQ_LOOP_CNT:
CMS_C_SEQ_START:
CMS_C_ARGUMENTS:
CMS_C_SEQ_END:
CMS_C_SEQ_SUB:
CMS_C_SEQ_CALL:
CMS_C_BLOCK_NC_VARS:
CMS_C_MODAL_NC_VARS:
CMS_C_MODAL_NC_VACANT_VARS:
CMS_C_ROTATE_3D_MAT:
CMEAPI_AXIS *cmeapi_get_c_axis_vars(double);
double variable;
Returns the CMEAPI_AXIS value of a specific variable. Supported variables include:
CMS_C_INPUT_AXIS:
CMS_C_BASE_WORK_OFFSET:
CMS_C_TOOL_NOSE_VALUE:
CMS_C_TOOL_RETRACT_FLAG:
CMS_C_INPUT_MACHINE_ZERO:
CMS_C_INPUT_PROGRAM_ZERO:
CMS_C_INITIAL_SPINDLE_LOC:
CMS_C_MACH_REF_POINT:
CMS_C_SAV_SHIFT_OFFSET:
void cmeapi_get_c_circle_parms(i, j, k, r, i_present, j_present, k_present, r_present, pitch);
double i;
double j;
double k;
double r;
double i_present;
double j_present;
double k_present;
double r_present;
double pitch;
Returns the values associated with a circle parameter structure.
void cmeapi_get_c_fixture(double, double*);
double index;
CMEAPI_AXIS offset;
Returns the specified fixture offset.
void cmeapi_get_c_mirror(double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *);
double *xflag;
double *yflag;
double *zflag;
double *aflag;
double *bflag;
double *cflag;
double *xval;
double *yval;
double *zval;
double *aval;
double *bval;
double *cval;
Returns the values associated with a mirror structure.
double cmeapi_get_c_numeric_vars(variable);
double variable;
Returns the number value of a specific variable. Supported variables include:
CMS_C_LOOP_COUNT:
CMS_C_TCOUNT:
CMS_C_MOTION: TRUE/FALSE
CMS_CHANGE_CYCLE: TRUE/FALSE
CMS_C_SPINDLE_VALUE:
CMS_C_DWELL_TIME:
CMS_C_WHILE_COND: TRUE/FALSE
CMS_C_IF_COND: TRUE/FALSE
CMS_C_WORK_COORD_INDEX:
CMS_C_TURRET_INDEXING: TRUE/FALSE
CMS_C_CUTTER_COMP_MULTIPLIER:
CMS_C_ARGUMENT_INDEX:
CMS_C_VAR_ARGS_INDEX:
CMS_C_SUB_STARTING_SEQ:
CMS_C_TYPEII_ARG_COUNT:
CMS_C_OPTIMIZABLE_COUNT:
CMS_C_ABSINC: ABSOLUTE/INCREMENTAL
CMS_C_MOTION_TYPE: MOTION_RAPID/MOTION_LINEAR/MOTION_CW/MOTION_CCW/MOTION_HEL_CW/MOTION_HEL_CCW/MOTION_FROM/MOTION_THREAD/MOTION_NURBS/MOTION_POLY
CMS_C_PREV_NON_RAPID_MOTION: MOTION_RAPID/MOTION_LINEAR/MOTION_CW/MOTION_CCW/MOTION_HEL_CW/MOTION_HEL_CCW/MOTION_FROM/MOTION_THREAD/MOTION_NURBS/MOTION_POLY
CMS_C_UNITS: CTL_INCH/CTL_METRIC
CMS_C_CUTCOM_MODE: CUTCOM_OFF/CUTCOM_RAMPON/CUTCOM_RAMPOFF/CUTCOM_ON
CMS_C_MOTION_PLANE: XY_PLANE/ZX_PLANE/YZ_PLANE
CMS_C_CUTCOM_METHOD:
CMS_C_FEED_MODE: FEED_PER_MINUTE/FEED_PER_REVOLUTION/INVERSE_TIME
CMS_C_CUTTER_COMP_VALUE:
CMS_C_CUTTER_COMP_INDEX:
CMS_C_CUTTER_OFFSET_VALUE:
CMS_C_TOOL_LEN_COMP
CMS_C_TOOL_LEN_COMP_DIR:
CMS_C_TOOLNUM:
CMS_C_SPINDLE_SPEED:
CMS_C_D3_TOOL_OFFSET_FLAG: TRUE/FALSE
CMS_C_FEEDRATE:
CMS_C_NEW_OVERRIDE_FEEDRATE: TRUE/FALSE
CMS_C_CUR_WORK_COORD:
CMS_C_SUB_CALL: TRUE/FALSE
CMS_C_SEQ_NEST_LEVEL:
CMS_C_ROTARY_ABS_DIRECTION: ROTARY_POS_CCW/ROTARY_POS_CW/ROTARY_ALWAYS_CW/ROTARY_ALWAYS_CW/ROTARY_SHORTEST_DISTANCE/ROTARY_LINEAR
CMS_C_ACTIVE_TOOL_NUMBER:
CMS_C_TOOL_OFFSET_NUM:
CMS_C_CDC_OFF_ADJ: TRUE/FALSE
CMS_C_LOWER_GUIDE_H:
CMS_C_UPPER_GUIDE_H:
CMS_C_LOWER2REF_PLANE:
CMS_C_REF2UPPER_PLANE:
CMS_C_SHOW_WIRE: TRUE/FALSE
CMS_C_CYCLE_SUBROUTINE: TRUE/FALSE
CMS_C_CYCLE_SUBROUTINE_DEPTH:
CMS_C_DYN_3D_TOOL_OFFSET:
CMS_C_MILLINTMODE_FLAG: TRUE/FALSE
CMS_C_NC_MACRO_MOTION: TRUE/FALSE
CMS_C_W_TOOL_SIDE: TRUE/FALSE
CMS_C_Z_TOOL_SIDE: TRUE/FALSE
CMS_C_W_ZERO_TRACKING: PRIMARY/SECONDARY
CMS_C_Z_ZERO_TRACKING: PRIMARY/SECONDARY
CMS_C_TYPEII_STATE_INDEX:
CMS_C_PROBE_OFFSET_CNT:
CMS_C_PROBE_OFFSET_CNT:
CMS_C_RTCP: TRUE/FALSE
CMS_C_CYCLE_Z_AXIS: TRUE/FALSE
CMS_C_MULTI_AXIS_CYCLE: TRUE/FALSE
CMS_C_ROTATE_3D: TRUE/FALSE
CMS_C_APPLY_PIVOT_OFFSET: TRUE/FALSE
CMS_C_MULTIPLE_PASS: TRUE/FALSE
CMS_C_MULTIPASS_NEEDED: TRUE/FALSE
CMS_C_PASS_NUMBER:
CMS_C_MULTI_AXIS_MACHINE: TRUE/FALSE
CMS_C_MILLTURN: MILLING/TURNING/WIRE_EDM
CMS_C_MAX_TABLE_SPEED:
CMS_C_SURFACE_SPEED:
CMS_C_SPINDLE_MODE: SPINDLE_CSS/SPINDLE_RPM
CMS_C_PROGRAMMING_METHOD:
CMS_C_TURRET_TOOLS_LOADED:
CMS_C_EPSILON:
CMS_C_ANGLE_EPSILON:
CMS_C_TANGENT_EPSILON:
CMS_C_MAZAK_PART_LOADER_CNT:
void cmeapi_get_c_nurbs(opti_state, order, weight, knot, incre_knot, ctl_cnt, knot_cnt, start_pos);
double opti_state;
double order;
double weight;
double knot;
double incre_knot;
double ctl_cnt;
double knot_cnt;
CMEAPI_AXIS start_pos;
Returns the values associated with the current NURBS structure.
void cmeapi_get_c_poly(bx, ax, by, ay, bz, az, t);
double bx;
double ax;
double by;
double ay;
double bz;
double az;
double t;
Returns the values associated with a Siemens polynomial.
void cmeapi_get_c_precision(x_metric, x_inch, y_metric, y_inch, z_metric, z_inch);
double x_metric;
double x_inch;
double y_metric;
double y_inch;
double z_metric;
double z_inch;
Returns the format values associated with the X, Y, and Z words.
void cmeapi_get_c_probe_offset(double, double *, double *);
double index;
double id;
double offset[];
Returns the specified probe id and offset.
void cmeapi_get_c_program(old_axis, old_asign, old_bsign, old_csign, old_count, old_map, old_active, new_axis, new_asign, new_bsign, new_csign, new_count, new_map, new_active);
CMEAPI_AXIS old_axis;
double old_asign;
double old_bsign;
double old_csign;
CMEAPI_AXIS old_count;
CMEAPI_POINT old_map;
CMEAPI_AXIS new_active;
CMEAPI_AXIS new_axis;
double new_asign;
double new_bsign;
double new_csign;
CMEAPI_AXIS new_count;
CMEAPI_POINT new_map;
CMEAPI_AXIS new_active;
Returns the values associated with a program structure.
void cmeapi_get_c_rotate(flag, angle, angles, matrix_flag, plane, xyz_mode, axis_flags, position, specified_position, matrix);
double *flag;
double *angle;
double *angles[];
double *matrix_flag;
double *plane;
double *xyz_mode;
CMEAPI_AXIS *axis_flags;
CMEAPI_AXIS *position;
CMEAPI_POINT *specified_position;
double *matrix[];
Returns the values associated with a rotation structure.
char *cmeapi_get_c_text_vars(variable);
double variable:
Returns the text value of a specific variable. Supported variables include:
CMS_C_LABEL_NAME:
CMS_C_LAST_FEEDRATE_STATEMENT:
CMS_C_SUBROUTINE_NAME:
CMS_C_ACTIVE_TOOL_NAME:
CMS_C_ACTIVE_SPINDLE_NAME:
CMS_C_SPINDLE_DIR:
CMS_C_CYCLE_SUBROUTINE_NAME:
void cmeapi_get_c_typeII_arg(index, textstr, value, argtype);
double index;
char *textstr;
double value;
double argtype;
Returns the values associated with the specified typeII argument (the input argument that specifies which type II argument you want data on). If index is set to -1, the type II special argument is returned.
For example: (ABC, 5, 10+5, test; 1)
Index 1:
char *= "5"
value = 5
argtype = 1 (numeric argument)
Index 2:
char *= "10+5"
value = 15
argtype = 1
Index 3:
char *= "test"
value = 0
argtype = 2 (text argument)
Index -1:
char *= "1"
value = 1
argtype = 1 (???)
The special argument is the argument that comes after the ";".
void cmeapi_get_c_typeII_state(index, textstr);
double index;
char *textstr;
Returns the specified type II state.
void cmeapi_get_c_work_parms(values, present_flags);
CMEAPI_AXIS *values;
CMEAPI_AXIS *present_flags
Returns the values associated with a work parameter structure.
double cmeapi_get_comp_gage_length(char *);
char *tool_component;
Returns the length of the tool which is connected to the specified component as measured from the zero point of the tool to the gage_line. If a tool component is not specified, the current active tool component will be used.
📝 NOTE: This function was previously named double cmeapi_get_gage_length(char *).
CMEAPI_POINT *cmeapi_get_component_location(char *);
char *comp_register_name
Returns the location of the origin point of the specified component.
char *cmeapi_get_current_input_filename(void)
Returns full path name of active NC program file.
double cmeapi_get_file_id();
Returns the id associated with the current input file.
📝 NOTE: This function is now OBSOLETE.
void cmeapi_get_filenames(ctl_filename, job_filename, cme_filename, input_filename, output_filename, log_filename, machine_filename, tls_filename, full_path_flag);
char *ctl_filename;
char *job_filename;
char *cme_filename;
char *input_filename;
char *output_filename;
char *log_filename;
char *machine_filename;
char *tls_filename;
double full_path_flag;
Returns the various filenames that are being used by this job in the corresponding arguments. The full_path_flag is set to 1, the full path name will be returned for each file, otherwise only the last level file name will be returned.
CMEAPI_OFFSET_TYPE *cmeapi_get_gage_offset(char *);
char *active_tool_component;
Calculates and returns the gage offset for the current tool in the "active_tool_component". This is calculated as: GAGEPOINT_OFFSET - DRIVENPOINT_OFFSET. This function replaces void cmeapi_get_gage_length() which only retrieved the Z Axis length of the tool.
CMEAPI_OFFSET_TYPE *cmeapi_get_gage_offset2(char *);
char *active_tool_component;
Calculates and returns the gage offset for the current tool in the "active_tool_component". This is calculated as: -(Cutter Origin Offset + DRIVENPOINT_OFFSET). This function is only used in special circumstances. Typically, the void cmeapi_get_gage_offset() macro is used instead of this function.
double cmeapi_get_guide_z_distance();
Returns the vertical distance between the guides.
char *cmeapi_get_inch_format(word);
char *word;
Returns the inch format string for the specified word.
See also:
double cmeapi_format_number(format, type, value);
double cmeapi_get_inch_type(word);
char *cmeapi_get_metric_format(word);
double cmeapi_get_metric_type(word);
double cmeapi_get_multiplier(word);
void cmeapi_set_if_cond(flag);
void cmeapi_set_metric_mode();
double cmeapi_get_inch_type(word);
char *word;
Returns the inch type for the specified word. A return value of 0 means Decimal, 1 means Leading, and 2 means Trailing.
See also:
double cmeapi_format_number(format, type, value);
char *cmeapi_get_inch_format(word);
char *cmeapi_get_metric_format(word);
double cmeapi_get_metric_type(word);
double cmeapi_get_multiplier(word);
void cmeapi_set_if_cond(flag);
void cmeapi_set_metric_mode();
char *cmeapi_get_input_block(void);
Returns the current block.
double cmeapi_get_input_location();
Returns the position in the machine code file of the current block.
See also:
double cmeapi_get_next_input_location();
double cmeapi_set_input_location(location, sequence_number, file_id);
void cmeapi_get_last_token(double *, char *);
char *word;
double *value;
Returns the last word/value that was processed.
char *cmeapi_get_macro_modal(modal_name);
char *modal_name;
Returns the value of the specified macro modal, modal_name.
See also:
void cmeapi_get_last_token(double *, char *);
char *cmeapi_get_metric_format(word);
char *word;
Returns the metric format string for the specified word.
See also:
double cmeapi_format_number(format, type, value);
char *cmeapi_get_inch_format(word);
double cmeapi_get_inch_type(word);
double cmeapi_get_metric_type(word);
double cmeapi_get_multiplier(word);
void cmeapi_set_if_cond(flag);
void cmeapi_set_metric_mode();
double cmeapi_get_metric_type(word);
char *word;
Returns the metric type for the specified word. A return value of 0 means Decimal, 1 means Leading, and 2 means Trailing.
See also:
double cmeapi_format_number(format, type, value);
char *cmeapi_get_inch_format(word);
double cmeapi_get_inch_type(word);
char *cmeapi_get_metric_format(word);
double cmeapi_get_multiplier(word);
void cmeapi_set_if_cond(flag);
void cmeapi_set_metric_mode();
char *cmeapi_get_mm_menu_string(modal_item);
char *modal_item;
Returns the text string that is to be associated with the specified macro modal menu item.
void cmeapi_get_mm_widget_string(label_widget, value_widget, label_string, value_string);
char *label_widget;
char *value_widget;
char *label_string;
char *value_string;
Returns the text string that is to be associated with the specified widget and its value. The first argument is the name of the label widget. The second argument is the name of the value widget (if it is a choice item). The corresponding label string and value string are returned in the third and fourth arguments.
double cmeapi_get_multiplier(word);
char *word;
Returns the multiplier for the specified word.
See also:
double cmeapi_format_number(format, type, value);
char *cmeapi_get_inch_format(word);
double cmeapi_get_inch_type(word);
char *cmeapi_get_metric_format(word);
double cmeapi_get_metric_type(word);
void cmeapi_set_if_cond(flag);
void cmeapi_set_metric_mode();
char *cmeapi_get_input_block(void);
double cmeapi_set_input_location(location, sequence_number, file_id);
int cmeapi_get_nc_vacant_var(var_name);
double var_name;
Returns a value (1 for YES or 0 for NO) indicating whether the specified NC variable has been set.
void cmeapi_get_nc_vacant_vars_list(int_array, start_index, end_index);
int *int_array;
int start_index;
int end_index;
Returns in the first argument, an array of numbers (1 for YES or 0 for NO) indicating whether the specified NC variables have been set. The vacant indicator array of numbers corresponds to the NC variables starting with the second argument (start_index) and ending with the third argument (end_index).
double cmeapi_get_nc_var(var_name);
double var_name;
Returns the value for the NC variable specified by the var_name.
void cmeapi_get_nc_vars_list(dbl_array, start_index, end_index);
double *dbl_array;
int start_index;
int end_index;
Returns an array of values for the NC variables beginning from start index and ending at end index.
See also:
double cmeapi_get_alpha_nc_var(variable_name);
void cmeapi_set_alpha_nc_var(variable_name, value);
void cmeapi_set_nc_vars(nc_vars, start, end);
double cmeapi_get_next_input_location();
Returns the machine code file position of the beginning of the next block following the current block.
double cmeapi_get_num_errors();
Returns the number of errors which have occurred.
double cmeapi_get_num_warns();
Returns the number of warnings which have occurred.
double cmeapi_get_number_of_objects();
Returns the number of objects in the current block.
double cmeapi_get_number_of_opti_objects();
Returns the number of optimizable objects in the current block. Comments and assignments are not included in this list of objects.
char *cmeapi_get_operator_input();
Raises the main message window, and prompts the operator for input. The operator's input is then returned.
double cmeapi_get_opti_block_type(void);
Returns the current opti_block_type as specified within Vericut. Possible values are: VC_UNDEFINED, VC_FIRST_BLOCK, VC_MIDDLE_BLOCK, and VC_LAST_BLOCK. This is used to determine which word/value pairs will be in the current output block.
char *cmeapi_get_part_spindle();
Returns the name of the first ROTARY or SPINDLE component that is found moving from the part to the base. If no ROTARY or SPINDLE component is found, an empty string is returned.
CMEAPI_OFFSET_TYPE void cmeapi_get_pivot_offset();
Returns the position of the tool's zero point relative to its rotary component axis. This is the pivot point when running in "Rotary Tool Control Point" (RTCP) mode.
int cmeapi_get_program_record(void)
Returns the line number of the record that is currently being processed in the NC program file.
double cmeapi_get_programming_method();
Returns the programming method (0 for tool tip, 1 for gage length, and 2 for tool length compensation).
void cmeapi_get_rapid_traversal(comp_register_name, subsystem, pos_priority, neg_priority, rapid_feedrate, pos_interpolated, neg_interpolated);
char *comp_register_name;
char *subsystem;
double pos_priority;
double neg_priority;
double rapid_feedrate;
double pos_interpolated;
double neg_interpolated;
Returns a series of information associated with RAPID motion for the specified component.
void cmeapi_get_stats(error_cnt, warnings_cnt, time, linear_time, distance, linear_distance);
double *error_cnt;
double *warnings_cnt;
double *time;
double *linear_time;
double *distance;
double *linear_distance;
Returns the above statistics.
double cmeapi_get_table_value(char *, char *, double, double *);
char *table_name;
char *subsystem;
double table_index;
double *value;
Gets value to the element indexed by table_index in the table table_name .
CMEAPI_VECTOR *cmeapi_get_tool_axis();
Returns the tool's orientation I,J,K, vector in the structure CMEAPI_VECTOR.
CMEAPI_POINT cmeapi_get_tool_axis_position(tool_name);
char *tool_name;
Returns the tool's position X,Y,Z in the structure CMEAPI_POINT.
OFFSET_TYPE cmeapi_get_tool_comp_offset(x_offset, y_offset, z_offset, x_reg, y_reg, z_reg);
double x_offset;
double y_offset;
double z_offset;
char *x_reg;
char *y_reg;
char *z_reg;
This function is passed a X,Y,Z offset that is to be applied to the current tool component. This function multiplies this offset by the tool's current transformation matrix, and returns this value within the structure OFFSET_TYPE. It also returns within the 4th, 5th, and 6th arguments, the register names of the components which moves the current tool component along the X,Y,Z axis. Here is the definition of the OFFSET_TYPE type structure.
type OFFSET_TYPE {
double x, y, z, a, b, c, u, v, w;
};
double cmeapi_get_tool_gage_length(void)
Returns the length of the active tool component as measured from the zero point of the tool to the gage_line.
CMEAPI_TOOL_REC cmeapi_get_tool_location(status_flag);
double status_flag;
Returns the current tool location's X, Y, Z position as well as the tool orientation I, J, K, vector in the structure CMEAPI_TOOL_REC. Here is the definition of the CMEAPI_TOOL_REC type structure. If status flag is set to 1, the tool's position will be updated within the status window.
type CMEAPI_POINT {
double x,y,z;
};
type CMEAPI_VECTOR {
double i,j,k;
};
type CMEAPI_TOOL_REC {
CMEAPI_POINT pos;
CMEAPI_VECTOR vec;
};
See also:
double cmeapi_is_component_register(register_name);
double cmeapi_machine_is_multi_axis();
void cmeapi_process_motion(subsystem, register_name, value);
CMEAPI_TOOL_REC cmeapi_get_wire_location();
Returns the current position and angle of the wire. The current position is based off of the lower guide.
double cmeapi_get_word_value(word, numeric_value, text_value);
char *word;
double numeric_value;
char *text_value;
If the specified word is found in the current block, the corresponding value will be returned. If the value is a numeric value, the value will be returned in the second argument and the function will return a 1. If the value is a text value, the value will be returned in the third argument, and the function will return a 2. If the word is not found, the function will return a 0.
void cmeapi_guides_fixed(double *, double *);
double *lower_guide;
double *upper_guide;
Determines whether either of the guides are fixed (in X and Y). The corresponding guide is set to 0 if not fixed, and 1 if fixed.
void cmeapi_init_nurbs();
Initializes a NURBS structure. This routine should be called at the beginning of each NURBS statement.
See also:
void cmeapi_add_nurbs_ctrl(xval, yval, zval, ivector, jvector, kvector, weight);
void cmeapi_add_nurbs_knot(knot);
void cmeapi_add_nurbs_objdata(knot);
void cmeapi_convert_nurbs_2_apt(subsystem, xreg, yreg, zreg, sequence_no);
void cmeapi_free_nurbs_objdata(knot);
double cmeapi_nurbs_get_next_point(xval, yval, zval);
void cmeapi_set_nurbs_order(order);
void cmeapi_init_polynomial(p1x, p1y, p1z, p2x, p2y, p2z, ax, bx, ay, by, az, bz, t);
double p1x;
double p1y;
double p1z;
double p2x;
double p2y;
double p2z;
double ax;
double bx;
double ay;
double by;
double az;
double bz;
double t;
Initializes the polynomial curve with its appropriate values. This routine was written specifically for Siemens.
void cmeapi_init_var(variable, data_type, text_value, numeric_value);
char *variable;
double data_type;
char *text_value
double numeric_value;
This function is the same as void cmeapi_set_var() except only initializes the variable if it has not been initialized by the user (Job file). Sets the NC variable specified by the first argument to either the double value of the fourth argument or the text value of the third argument. The second argument contains the data type (1 for number, 2 for text).
double cmeapi_is_component_register(register_name);
char *register_name;
Returns the value 1 if register_name matches a component in the current machine.
See also:
CMEAPI_TOOL_REC void cmeapi_get_tool_location(status_flag);
double cmeapi_machine_is_multi_axis();
void cmeapi_process_motion(subsystem, register_name, value);
double cmeapi_is_multiple_pass();
Returns 1 during multiple pass operation, otherwise a 0 is returned.
See also:
OFFSET_TYPE cmeapi_get_pivot_offset();
double cmeapi_is_optimizing();
Returns 1 if Optimization is currently turned on, otherwise a 0 is returned.
double cmeapi_iterate_arc(command, center, normal, start, end, radius, tolerance, next_point)
| Command | Additional Info |
|---|---|
| double command; | // 0=Start Initialize; 1=Process Next Point; |
| CMEAPI_POINT *center; | // Center of arc |
| CMEAPI_VECTOR *normal; | // Normal of the Arc |
| CMEAPI_POINT *start; | // start point of arc |
| CMEAPI_POINT *end; | // end point of arc |
| double radius; | // arc radius |
| double tolerance; | // tolerance used to calculate number of chords |
| CMEAPI_POINT *next_point; | // return the next point of arc |
The first argument is a "command" argument indicating whether to initialize the iteration, or to return the next iterative point on the arc. The center point and normal vector of plane passing through start point and center point are passed in the second and third arguments. The fourth, fifth and sixth arguments specify the start point, the end point and the radius of the arc respectively. Tolerance, which is used to calculate the number of chords, is specified in the seventh argument. The function returns the number of chords remaining for arc iteration, and also returns next iterative point on the arc in eighth argument.
void cmeapi_log(message);
char *message;
Outputs the specified message to the log file. If the log file is not defined, the message will be printed to standard out.
double cmeapi_machine_is_multi_axis();
Returns a 1 if the machine definition contains any rotary components or if the machine tool normal vector is not (0, 0, 1).
See also:
CMEAPI_TOOL_REC cmeapi_get_tool_location(status_flag);
double cmeapi_is_component_register(register_name);
void cmeapi_process_motion(subsystem, register_name, value);
void cmeapi_max_errors(max_errors);
double max_errors;
Specifies the number of errors to allow before processing is stopped.
void cmeapi_max_warnings(max_warnings);
double max_warnings;
Specifies the number of warnings to allow before processing is stopped.
void cmeapi_mts_inc_time(delta_time, dwell_time, feed_mode, spindle_speed, spindle_mode, max_table_speed);
double delta_time;
double dwell_time;
double feed_mode;
double spindle_speed;
double spindle_mode;
double max_table_speed;
This function is called to execute a dwell. In most cases, this will simply cause the time to be incremented by delta_time . If, however, the current machine is a dual head machine running in synchronous mode, additional calculations are done to keep the heads in sync. This is the reason for the additional arguments. Delta_time is given in minutes. Dwell_time is the specified dwell time. The units for the dwell_time is dependent on the feed_mode . The feed_mode is 1 for "Feed Per Minute", 2 for "Feed Per Revolution", and 3 for "Inverse Time". The spindle_speed is specified as either "Revolutions Per Minute" or "Units Per Minute" depending on the spindle_mode. The spindle_mode is 1 for Constant Surface Speed and 2 for RPM. Max_table_speed is specified in "Units Per Minute" and is used to calculate RPM when the spindle is in Constant Surface Speed mode.
double cmeapi_nurbs_get_next_point(xval, yval, zval);
double xval;
double yval;
double zval;
This function returns the next point associated with the NURBS curve. This function should not be called until the NURBS curve has been fully defined. The next point is based off of the NURBS curve, and an internal tolerance value that is associated with the NURBS curve. Returns 1 if there is a next point, otherwise it returns 0.
See also:
void cmeapi_add_nurbs_ctrl(xval, yval, zval, ivector, jvector, kvector, weight);
void cmeapi_add_nurbs_knot(knot);
void cmeapi_add_nurbs_objdata(knot);
void cmeapi_convert_nurbs_2_apt(subsystem, xreg, yreg, zreg, sequence_no);
void cmeapi_free_nurbs_objdata(knot);
void cmeapi_set_nurbs_order(order);
void cmeapi_operator_input(msg);
char *msg;
Sends a message to the operator and waits for input from the operator. The way this has been implemented is that the specified msg is sent to the INFO location, and the processing of the mcd file is stopped. The user/operator can then decide what to do next in response to the specified msg.
void cmeapi_output(msg);
char *string;
The function void cmeapi_output() outputs string to the current output file. It outputs string to standard output, when the output file is not specified.
void cmeapi_output_text(msg, cutcom_mode);
char *string;
double cutcom_mode
This routine outputs a text string to action queue. When running in look ahead mode, text output generally should not be sent out immediately, but buffered and sent out as the block is processed. This routine insures that the text is sent out at the right time.
void cmeapi_pass1_tool_change(tool_num);
double tool_num;
This function is called during the scan pass and is used to build a tool list. This function allows a tool list to be created without fully processing the file. This function will only work however if the file does not contain subroutines.
double cmeapi_poly_get_next_point(xval, yval, zval);
double xval;
double yval;
double zval;
This function returns the next point associated with the polynomial curve. This function should not be called until the polynomial curve has been fully defined. The next point is based off of the polynomial curve, and an internal tolerance value that is associated with the polynomial curve. Returns 1 if these is a next point, otherwise it returns 0.
void cmeapi_process_cycle_motion(feed_to, rapid_to, retract_to, step_down, step_up, initial_level, change_cycle_flag, x_comp_reg, y_comp_reg, z_comp_reg, dwell_time, feedrate, feedmode, spindle_mode, spindle_speed, max_table_speed, subsystem);
double feed_to; /* distance to feed from goto */
double rapid_to; /* distance to rapid to from goto */
double retract_to; /* final feed above toto */
double step_down; /* step down, 0 if not applicable */
double step_up; /* step up, 0 if not applicable) */
double initial_x_level; /* initial x level */
double initial_y_level;/* initial y level */
double initial_z_level;/* initial z level */
char *x_comp_reg; /* x register name */
char *y_comp_reg; /* y register name; */
char *z_comp_reg; /* z register name */
double dwell_time;
double feedrate;
double feedmode;
double spindle_mode;
double spindle_speed;
double max_table_speed;
double delta_time;
double rapid_feedrate;
double intermediate_flag;
double rpoint_motion;
char *subsystem;
Executes the motion associated with a cycle statement.
void cmeapi_process_motion(subsystem, register_name, value);
char *subsystem;
char *register_name;
double value;
Rebuilds the register_name component's current matrix.
See also:
CMEAPI_TOOL_REC cmeapi_get_tool_location(status_flag);
double cmeapi_is_component_register(register_name);
double cmeapi_machine_is_multi_axis();
void cmeapi_process_mts_arc(x_center, y_center, z_center, arc_dir, plane, x_start, y_start, z_start, x_end, y_end, z_end, radius, tolerance, x_comp_reg, y_comp_reg, z_comp_reg, feedrate, feedmode, spindle_mode, spindle_speed, max_table_speed, inverse_time, active_spindle, normal_x, normal_y, normal_z, subsystem);
double x_center; /* center of arc */
double y_center; /* center of arc */
double z_center; /* center of arc */
double arc_dir; /* direction of arc: 1 = CCW, -1 =CW */
double plane; /* plane of the arc: 1 = XY, 2 = ZX, 3 = YZ */
double x_start; /* start point of arc */
double y_start; /* start point of arc */
double z_start; /* start point of arc */
double x_end; /* end point of arc */
double y_end; /* end point of arc */
double z_end; /* end point of arc */
double radius;
double tolerance;
char *x_comp_reg;
char *y_comp_reg;
char *z_comp_reg;
double feedrate;
double feedmode;
double spindle_mode;
double spindle_speed;
double max_table_speed
double max_cutrate;
double invert_time;
char *active_spindle;
double normal_x;
double normal_y;
double normal_z;
char *subsystem;
Executes the motion of an arc.
void cmeapi_process_mts_motion(delta_time, velocity, feedmode, spindle_mode, motion_mode, feedrate, spindle_speed, max_table_speed);
double delta_time;
double velocity;
double feedmode;
double spindle_mode;
double motion_mode;
double feedrate;
double spindle_speed;
double max_table_speed;
Executes normal (non-arc, noncycle) motion.
void cmeapi_process_sync();
char *register_name;
double value;
Tells the current head to stop processing and wait until the other head gets to the corresponding sync location.
void cmeapi_register_macro_modals(category, modals);
char *category;
char *modals;
Passes the macro modal information for a specific category to Machine Simulation. After the CME file is loaded, Machine Simulation will call register_macro_modals(). This macro then calls void cmeapi_register_macro_modals() repeatedly, once for each category of macro modals. For each category, a menu item will be created in Machine Simulation. The modals parameter contains a list of modal definitions, terminated with a NULL string. Each modal definition contains a list of arguments, terminated with a NULL string. The first argument is the label for the modal. The second argument is the default value. If the modal is a text field, no other arguments are needed. If the modal is a choice field, additional arguments are given for each choice field.
void cmeapi_register_states(state_variable, state_options);
char *state_variable;
char *state_options[];
Defines a CME state variable, and list the corresponding values that can be associated with the given state variable.
void cmeapi_register_table_names(table_names);
char *table_names[];
Passes the list of table names that are defined in the CME. This list is used to create dynamic menu options.
void cmeapi_reset_job_send_types();
Resets the information associated with the send_types. Calling void cmeapi_set_send_value() dynamically allocate memory. This memory is freed with the call to this function.
void cmeapi_reset_job_values();
Resets a few job values that are used by both Machine Simulation and the CME. Currently these values include: num_errors, total_num_errors, num_warnings, and total_time.
void cmeapi_reset_states();
Resets the Machine Simulation state variables associated with the current CME.
void cmeapi_screen(message,);
char *message;
Prints the specified message to the screen. In general, this routine should not be used. void cmeapi_send() is the preferred method of sending information.
void cmeapi_send(message_type, message, sequence_number);
double message_type;
char *message;
double sequence_number;
This is the general purpose function for the printing of all messages. Message_type specifies the type of message (error, warning, info, debug,...). The message_type also indicated the destination for the message. This relationship was established with the void cmeapi_set_send_value() cfunc. For OUTPUT message types (6), the sequence_number is concatenated to the message.
void cmeapi_set_active_tool(component_name);
char *component_name;
Sets the specified component_name as the active tool component.
void cmeapi_set_alpha_nc_var(variable_name, value);
char *variable_name;
double value;
Sets the NC variable, variable_name, to value .
See also:
double cmeapi_get_alpha_nc_var(variable_name);
void cmeapi_get_nc_vars_list(dbl_array, start_index, end_index);
void cmeapi_set_nc_vars(nc_vars, start, end);
void cmeapi_set_c_3d_offset_parms(offset, i_present, j_present, k_present);
CMEAPI_VECTOR offset;
double i_present;
double j_present;
double k_present;
Sets the values associated with a 3 dimensional offset parameter structure.
void cmeapi_set_c_3d_vars(double, CMEAPI_POINT *);
double variable;
CMEAPI_POINT *point;
Sets the CMEAPI_POINT value of a specific variable. See CMEAPI_POINT *cmeapi_get_c_3d_vars(double); for a list of supported variables.
void cmeapi_set_c_array_vars(double, double, double);
double variable;
double index;
double value;
Sets the value of a specific variable. This function is used with array variables. The indexed value into the specified array will be set. See double cmeapi_get_c_array_vars() for a list of supported variables.
void cmeapi_set_c_axis_vars(variable, axis_values);
double variable;
CMEAPI_AXIS, axis_values;
Sets the CMEAPI_AXIS value of a specific variable. See void cmeapi_get_c_axis_vars() for a list of supported variables.
void cmeapi_set_c_circle_parms(i, j, k, r, i_present, j_present, k_present, r_present,pitch);
double i;
double j;
double k;
double r;
double i_present;
double j_present;
double k_prsent;
double r_present;
double pitch;
Sets the values associated with a circle parameter structure.
void cmeapi_set_c_fixture(double, CMEAPI_AXIS *);
double index;
CMEAPI_AXIS *offset;
Sets the values in the Work Offsets table. The index is the Register in the Work Offsets table.
void cmeapi_set_c_mirror(xflag, yflag, zflag, aflag, bflag, cflag, xval, yval, zval, aval, bval, cval);
double xflag;
double yflag;
double zflag;
double aflag;
double bflag;
double cflag;
double xval;
double yval;
double zval;
double aval;
double bval;
double cval;
Sets the values associated with a mirror structure.
void cmeapi_set_c_numeric_vars(variable, value);
double variable;
double value;
Sets the number value of a specific variable. See void cmeapi_get_c_numeric_values() for a list of supported variables.
void cmeapi_set_c_nurbs(opti_state, order, weight, knot, incre_knot, ctl_cnt, knot_cnt, start_pos);
double opti_state;
double order;
double weight;
double knot;
double incre_knot;
double ctl_cnt;
double knot_cnt;
CMEAPI_AXIS start_pos;
Sets the values associated with the current NURBS structure.
void cmeapi_set_c_poly(bx, ax, by, ay, bz, az, t);
double bx;
double ax;
double by;
double ay;
double bz;
double az;
double t;
Sets the values associated with a Siemens polynomial.
void cmeapi_set_c_precision(x_metric, x_inch, y_metric, y_inch, z_metric, z_inch);
double x_metric;
double x_inch;
double y_metric;
double y_inch;
double z_metric;
double z_inch;
Sets the format values associated with the X, Y, and Z words.
void cmeapi_set_c_probe_offset(index, id, offset);
double index;
double, id;
double, offset[];
Sets the specified probe id and offset.
void cmeapi_set_c_program(old_axis, old_asign, old_bsign, old_csign, old_count, old_map, old_active, new_axis, new_asign, new_bsign, new_csign, new_count, new_map, new_active);
CMEAPI_AXIS old_axis;
double old_asign;
double old_bsign;
double old_csign;
CMEAPI_AXIS old_count;
CMEAPI_POINT old_map;
CMEAPI_AXIS new_active;
CMEAPI_AXIS new_axis;
double new_asign;
double new_bsign;
double new_csign;
CMEAPI_AXIS new_count;
CMEAPI_POINT new_map;
CMEAPI_AXIS new_active;
Sets the values associated with a program structure.
void cmeapi_set_c_rotate(flag, angle, angles, matrix_flag, plane, xyz_mode, axis_flags, position, specified_position, matrix);
double flag;
double angle;
double angles[];
double matrix_flag;
double plane;
double xyz_mode;
CMEAPI_AXIS axis_flags;
CMEAPI_AXIS position;
CMEAPI_POINT specified_position;
double matrix[];
Sets the values associated with a rotation structure.
void cmeapi_set_c_text_vars(variable, textstr);
double variable:
char *textstr
Sets the text value of a specific variable. See char* cmeapi_get_c_text_vars() for a list of supported variables.
void cmeapi_set_c_typeII_arg(index, textstr, argtype, value);
double index;
char *textstr;
double argtype;
double value;
Sets the values associated with the specified type II argument. If index is set to -1, the type II special argument is returned.
void cmeapi_set_c_typeII_state(index, textstr);
double index;
char *textstr;
Sets the specified type II state.
void cmeapi_set_c_work_parms(values, present_flags);
CMEAPI_AXIS values;
CMEAPI_AXIS present_flags
Sets the values associated with a work parameter structure.
void cmeapi_set_cml_block_skip(block_skip_char, num_switches, switch_values);
char *block_skip_char;
double num_switches;
double switch_values; /* actually an array of numbers */
Passes the block skip information to Machine Simulation. Block_skip_char is the block skip character marker. Num_switches indicates the number of switches that are supported, and switch_values are the current value for each switch (0 for OFF, and 1 for ON).
void cmeapi_set_component_color(component_name, color_index);
char *component_name
double color_index;
Sets the specified color. The name of the component that color applies to, is specified in first argument. The color index is specified in the second argument.
📝 NOTE: The color_index value refers to the number associated with the color in the Shade Color list on the Color window, Define tab. See Color window, Define tab in the Edit Menu section of Vericut Help for additional information.
void cmeapi_set_coolant(coolant_str);
char *coolant_str;
Passes the current coolant string to Machine Simulation. For example: COOLANT/ON or COOLANT/MIST,... This is typically used to set the corresponding status field.
void cmeapi_set_ctl_state(state_variable, state_value);
char *state_variable;
char *state_value;
Sets the state of the specified state variable.
void cmeapi_set_cycle_component(component_register_name);
char *component_register_name;
Sets the component that is to be associated with a cycle.
void cmeapi_set_cycle_motion(cycle_motion_type);
double cycle_motion_type;
Set the type of cycle motion. Valid types are: IGNORE, BOTTOM_ONLY, or FULL_MOTION.
void cmeapi_set_feedrate(feedrate, units_str);
double feedrate
char *units_str;
Passes the current feedrate to Machine Simulation. This is typically used to set the corresponding status field.
void cmeapi_set_fixture_offset(char *, char *, double);
char *subsystem;
char *comp_reg_name;
double value;
Sets the specified component's offset to the specified value.
📝 NOTE: The component is specified by its register name.
See also:
CMEAPI_VECTOR *cmeapi_convert_machine_vector(input);
void cmeapi_set_tool_length_offset(z_offset);
void cmeapi_set_if_cond(flag);
double flag
Sets a flag indicating whether the previous "IF" condition was true or not.
void cmeapi_set_inch_mode();
Sets Machine Simulation into inch mode. In inch mode, Machine Simulation uses the inch formats to convert all word values.
See also:
double cmeapi_format_number(format, type, value);
char *cmeapi_get_inch_format(word);
double cmeapi_get_inch_type(word);
char *cmeapi_get_metric_format(word);
double cmeapi_get_metric_type(word);
double cmeapi_get_multiplier(word);
void cmeapi_set_metric_mode();
double cmeapi_set_input_location(location, sequence_number, file_id);
double location;
double sequence_number;
double file_id;
Sets the file position of the machine code file to location and the block sequence number to sequence_number. The return value of 0 means the cfunc succeeded, a nonzero value means failure. If file_id is present, it specifies the file being referenced.
See also:
double cmeapi_get_next_input_location();
void cmeapi_set_macro_modal(modal_name, string);
char *modal_name;
char *string;
Sets the specified macro modal, modal_name, to the value of string.
void cmeapi_set_math_precedence(value);
double value;
Sets the type of math precedence to be used when parsing the mcd file. Options are: 0 for normal rules of mathematical precedence, and 1 for left to right precedence.
void cmeapi_set_metric_mode();
Sets Machine Simulation into metric mode. In metric mode, Machine Simulation uses the metric formats to convert all word values.
See also:
double cmeapi_format_number(format, type, value);
char *cmeapi_get_inch_format(word);
double cmeapi_get_inch_type(word);
char *cmeapi_get_metric_format(word);
double cmeapi_get_metric_type(word);
double cmeapi_get_multiplier(word);
void cmeapi_set_if_cond(flag);
void cmeapi_set_nc_vacant_vars(nc_vars, start, end);
double nc_vars[];
double start;
double end;
Sets the vacant flags for the NC variables beginning from start and ending at end to the values beginning at the first position of nc_vars.
void cmeapi_set_nc_vars(nc_vars, start, end);
double nc_vars[];
double start;
double end;
Sets the values for the NC variables beginning from start and ending at end to the values beginning at the first position of nc_vars.
See also:
double cmeapi_get_alpha_nc_var(variable_name);
void cmeapi_get_nc_vars_list(dbl_array, start_index, end_index);
void cmeapi_set_alpha_nc_var(variable_name, value);
void cmeapi_set_nurbs_order(order);
double order;
Sets the order of a NURBS statement.
See also:
void cmeapi_add_nurbs_ctrl(xval, yval, zval, ivector, jvector, kvector, weight);
void cmeapi_add_nurbs_knot(knot);
void cmeapi_add_nurbs_objdata(knot);
void cmeapi_convert_nurbs_2_apt(subsystem, xreg, yreg, zreg, sequence_no);
void cmeapi_free_nurbs_objdata(knot);
double cmeapi_nurbs_get_next_point(xval, yval, zval);
void cmeapi_set_part_component_offset(xvalue, yvalue, zvalue);
double xvalue;
double yvalue;
double zvalue;
Sets the part component's X, Y, & Z offset values.
void cmeapi_set_program_block_start(value);
double value;
Sets the starting block, during the conversion pass, to be either the current block, or the next block. If value is set to 0, set it to the current block. If value is set to 1, set it to the next block. This function will typically only be called during the scan pass.
void cmeapi_set_send_value(msg_type, destination);
double msg_type;
double destination;
Specifies where to send a specific message type. Any number of message types can be used. The following, however, have pre-defined meaning.
-
1 = Error
-
2 = Warning
-
3 = Informational
-
4 = Debug
-
5 = Input
-
6 = Output
-
10 = A continuation of a previous Error message
The possible destinations are defined with the following:
-
1 = log file
-
2 = output file
-
3 = screen
The above values can be added together. For example: A value of 5 specifies that the destination is both the output file and the screen.
void cmeapi_set_spindle(spindle_str);
char *spindle_str;
Passes the current spindle setting (ON, OFF, or speed) to Machine Simulation. This is typically used to set the corresponding status field.
void cmeapi_set_spindle_mode(mode);
double mode
Passes the current spindle mode(1 for CSS, 2 for RPM) to Machine Simulation. This is typically used to set the corresponding status field.
void cmeapi_set_tool_length_offset(z_offset);
double z_offset;
Sets the tool component's Z offset to the value of z_offset.
See also:
CMEAPI_VECTOR *cmeapi_convert_machine_vector(input);
void cmeapi_set_tool_offset(x_offset, y_offset,z_offset);
double x_offset;
double y_offset;
double z_offset;
Sets the tool component's X,Y,Z offset to the specified values.
void cmeapi_set_var(variable, data_type, text_value, numeric_value);
char *variable;
double data_type;
char *text_value
double numeric_value;
Sets the NC variable specified by the first argument to either the double value of the fourth argument or the text value of the third argument. The second argument contains the data type (1 for number, 2 for text).
void cmeapi_set_word_string(text_str);
char *text_str;
Passes a text string back to the tokenize logic. This is used while processing conditional macros. Currently it is only used to pass a function name that is to be executed if the conditional macro evaluates to be a function.
void cmeapi_siemens_last_nurbs_line();
This routine is a Siemens specific routine which takes a peek at the next line to determine if the current line is the last line of the NURBS statement. It returns 0 if the NURBS statement continues on the next line, and returns 1 if the current line is the last line of the NURBS statement.
void cmeapi_siemens_parse_poly_args(textstr, val1, val2, val3);
char *textstr;
double val1;
double val2;
double val3;
This routine is a Siemens specific routine which parses a text string and returns 3 values.
double cmeapi_string_in_buffer(string, buffer);
char *string;
char *buffer;
Returns a 1 if the string is within the buffer, and returns 0 if it is not.
char *cmeapi_substitute_wordvalue(block_type, f_word, f_value_string, f_new_value_flag, x_word, w_value_string, x_new_value_flag, y_word, y_value_flag, y_new_value_flag, z_word, z_value_string, z_new_value_flag, s_word, s_word_value_string, s_new_value_flag);
double block_type;
char *f_word;
char *f_value_string;
double f_new_value_flag;
char *x_word;
char *x_value_string;
double x_new_value_flag;
char *y_word;
char *y_value_string;
double y_new_value_flag;
char *z_word;
char *z_value_string;
double z_new_value_flag;
char *s_word;
char *s_value_string;
double s_new_value_flag;
Substitutes word/value pairs into the existing input block. If the specified word is not found in the input block, and this is a new value for this word, the new word/value string will be concatenated to the original input block (before any comments or end of block characters). The resulting string is returned.
📝 NOTE: This routine now makes use of the block_type (first, middle, last) to determine whether the sequence number and the after motion word/value pairs should be included in the output block.
void cmeapi_sync_transfer();
This function is only used when running dual heads in synchronous mode. While in synchronous mode, 1 head is in control. This function transfers the control to the other head.
void cmeapi_tool_load(double);
double tool_number
Loads a tool. The tool_number is specified in the first argument. The tool will be loaded on to the currently active tool component.
void cmeapi_user_abort_processing(message);
char *message;
This function stops the current processing of the MCD file, and prints an informational message (if a message is specified).