Overview

The Generate class uses callback functions to produce output that matches your needs. You write your own python functions or reuse one of the functions built-in to support the pre-defined styles.

Calling set_style() with a name below configures a series of callbacks to produce that output. You can further adjust the output by replacing callbacks with set_event_fn(), set_type_fn(), or set_other_fn().

Styles

apt
APT program. Moves are converted into GOTO commands with appropriate FEDRAT, RAPID, and SPINDL modifiers. Tool changes are declared with the TLDATA/MILL style command used by NX.
crcl
Canonical Robot Command Language, a low level XML robot command format. The output does linear moves and simulated probing operations.
dmis
DMIS program that declares the datums defined by the STEP model and an inspection plan using the probing operations defined in the model. The output also declares the features for the geometry associated with the probing operations, so a group of probes on a cylindrical surface will be declared with a FEAT/CYLNDR and a MEAS/CYLNDR block. Similarly for FEAT/PLANE.
dmis-cnc
Alias for the "dmis" style
dmis-manual
Same as the "dmis", but starts with MODE/MAN rather than MODE/PROG,MAN.
esab-cut
ESAB Plate Cutting with a plasma torch. One of three styles of output generated from STEP-NC process for plasma cutting and laser marking on ESAB controls. This was used by an NSRP project to explore STEP-NC for steel processing in shipbuilding.
esab-farmark
ESAB Farside Mark with laser. See above.
esab-nearmark
ESAB Nearside Mark with laser. See above.
fanuc
General FANUC program style. Program uses the get_program_number() value in the header declaration. Will use TCP mode G43.5 and command IJK for five axis moves. Uses Renishaw inspection-plus macros for probing.
haas
General Haas program style. Based on the FANUC style but has Haas codes for through-spindle coolant. Uses Renishaw inspection-plus macros for probing.
heidenhain
General Heidenhain program style. Forces all lines to have block numbers. Use one of the variants below for five axis programs.
heidenhain-ac
Heidenhain variation for AC machines. Uses M128 and commands A/C for five axis moves.
heidenhain-bc
Heidenhain variation for BC machines. Uses M128 and commands B/C for five axis moves.
mdsi
MDSI program style for a left-handed lathe. This was used for early turning tests. It sets the destination transform to place everything into the ZX plane and reverse arc directions for the left-handed lathe.
okuma
General Okuma program style. Use one of the variants below for five axis programs.
okuma-ac
Okuma variation for AC machines. Uses G169 and commands A/C for five axis moves.
okuma-bc
Okuma variation for BC machines. Uses G169 and commands B/C for five axis moves.
okuma-omac
Okuma variation with OMAC macros for spindle and other fuctions.
siemens
General Siemens program style. This uses TRAORI with A3/B3/C3 commands for five axis motion and the native CYCLE978 for XY probing. It also uses OMAC macros for spindle and other fuctions.
siemens-810
Siemens variation that does not use any macros
siemens-dmdii
Siemens variation that uses Renishaw inspection plus macros and TRAORI, but commands the AC axes.
siemens-nist
Siemens variation that uses G700 to set units rather than G70.
siemens-renishaw
Siemens variation that uses Renishaw inspection plus macros.
siemens-traori
Siemens variation that explicitly calls TRAORI setup rather than expecting it to be done using OMAC macros.

Predefined Generation Functions

The built-in functions below use the common function prototype, which takes a generate, state vars, and a cursor object, then returns either a string or None. These functions handle the details of the built-in styles.

def generate_fn_prototype(
	gen: Generate,
	gs: GenerateState,
	cur: Adaptive
	) -> Optional[str]

All builtin functions are declared staticmethod() on the Generate class. Some functions handle events via set_event_fn(), others handle specific types of process elements via set_type_fn(), but most are used with set_other_fn() to provide partial strings for assembling a complete response for an event.

Generate.builtin_none()
No output. Always returns None.
Generate.builtin_coolant_apt()
Call coolant-off if any coolant has changed state. Turn on as appropriate with COOLNT/FLOOD, COOLNT/MIST, and COOLNT/THRU.
Generate.builtin_coolant_default()
Default for coolant function. Turn coolant on or off as needed with M08 for flood, M07 for mist, and the coolant-off function for off.
Generate.builtin_coolant_haas()
Turn coolant on or off as appropriate with M08 for flood, M07 for mist, M88 for through-spindle and the coolant-off function for off.
Generate.builtin_coolant_off_apt()
Turn coolant off as needed with COOLNT/OFF
Generate.builtin_coolant_off_default()
Default for coolant-off function. Turn coolant off as needed with M09.
Generate.builtin_coolant_off_haas()
Turn off flood/mist coolant as needed with M09 and through-spindle with M89.
Generate.builtin_coolant_off_siemens_macro()
If any coolant is on, turn them all off with WSCOOLOF.
Generate.builtin_coolant_okuma()
Turn coolant on or off as needed with M08 for flood, M07 for mist, M50 for through-spindle and the coolant-off function for off.
Generate.builtin_coolant_siemens_macro()
Call coolant-off if any coolant has changed state. Turn on flood coolant with WS_FLOOD. Emit comments for mist or thru-spindle coolants.
Generate.builtin_dwell_default()
Default for CtlEvent.DWELL event function. Generates a fanuc-style dwell
Generate.builtin_dwell_fanuc()
Generates a G04 dwell command with a P parameter giving the time in milliseconds. So a half-second dwell would be G04 P500. If the dwell is given in revolutions rather than a time unit, the value is converted to time using the programmed spindle speed.
Generate.builtin_dwell_siemens()
Generates a G4 dwell command. If the dwell is given in a time unit, it will have a F parameter with the time in seconds. If the dwell is given in revolutions, it will have a S parameter with the number of revolution.
Generate.builtin_error()
Used to handle ERROR events from the cursor. Formats the error message as a comment.
Generate.builtin_filename()
Returns the name of the STEP-NC file as a comment. Used at the start of programs to identify the source of the process.
Generate.builtin_move_apt()
If position has changed, call move-feed to set the feedrate, then issue linear move using the APT-style GOTO/0,1,2 syntax.
Generate.builtin_move_arc_apt()
Call move-feed to set the feedrate, then issue arc move using the APT-style CIRCLE and GOTO/0,1,2 syntax. Ignores arcs that are too small and splits arcs over 180deg into two pieces.
Generate.builtin_move_arc_default()
Default for CtlType.MOVE_ARC type function. Generates a fanuc-style arc move.
Generate.builtin_move_arc_esab()
Use builtin_move_arc_linear if linearize curves requested. Call move-feed to set the feedrate. call format_move_xyz() to move to the start point if not already there. Emit G02/GO3 with XY and center as IJ params. Ignores arcs that are too small.
Generate.builtin_move_arc_fanuc()
Use builtin_move_arc_linear if linearize curves requested. Call move-feed to set the feedrate, move-contact to set any contact codes, call format_move_xyz() to move to the start point if not already there. Emit G02/GO3 with R param. Ignores arcs that are too small and splits arcs over 180deg into two pieces.
Generate.builtin_move_arc_heidenhain()
Use builtin_move_arc_linear if linearize curves requested. Call move-feed to set the feedrate, move-contact to set any contact codes, call format_move_xyz() to move to the start point if not already there. Emit G02/GO3 with R param. Ignores arcs that are too small and splits arcs over 180deg into two pieces.
Generate.builtin_move_arc_siemens()
Use builtin_move_arc_linear if linearize curves requested. Call move-feed to set the feedrate, move-contact to set any contact codes, call format_move_xyz() to move to the start point if not already there. Emit G2/G3 with CR= param. Uses A3=/B3=/C3= if the arc is not in the XY plane. Ignores arcs that are too small and splits arcs over 180deg into two pieces.
Generate.builtin_move_arc_linear()
Used when linearize curves requested. Call move-feed to set the feedrate, move-contact to set any contact codes, split the arc into linear segments. Call format_move_xyz() for each piece, which creates and processes a CtlType.MOVE for the given coordinate values.
Generate.builtin_move_contact()
Default for move-contact function. Compare the direction of motion with the surface normal vector in the toolpath data and return the results of calling refpoint-left or refpoint-right.
Generate.builtin_move_crcl()
Return a MoveToType command with an EndPosition Point, XAxis, and Zaxis
Generate.builtin_move_default()
Default for CtlType.MOVE type function. Call move-xyz and move-ijk to get position and rotation parameters for a move. Add any any cutter contact prefix returned by move-contact to the prefixes. If the move will change position, build the command by adding the prefixes to G0 or G1 if required by the current modal state, append the coordinates, then add the result of move-feed to the current block or the next one if feed is standalone. Call Generate.builtin_move_trace and prefix the move with any move comment.
Generate.builtin_move_dmis()
Return APT-style GOTO/0,1,2 command.
Generate.builtin_move_fanuc_renishaw()
Do protected move with G65P9810 using probe feed rate
Generate.builtin_move_feed()
Default for move-feed function. If current feed is not rapid, normalize feed unit to linear velocity and if changed return F command.
Generate.builtin_move_feed_apt()
Return None if the feedrate has not changed, otherwise return FEDRAT/<val>
Generate.builtin_move_feed_esab()
Return F as separate block.
Generate.builtin_move_helix_apt()
Use builtin_move_helix_linear if linearize curves requested. Call move-feed to set the feedrate, then issue arc move using the APT-style CIRCLE and GOTO syntax.
Generate.builtin_move_helix_default()
Default for CtlType.MOVE_HELIX type function. Generates a fanuc-style helix command
Generate.builtin_move_helix_fanuc()
Use builtin_move_helix_linear if linearize curves requested. Call move-feed to set the feedrate, move-contact to set any contact codes, call format_move_xyz() to move to the start point if not already there. Emit G17/G18/G19 depending on the working plane, then G2/G3 with XYRZ/ZXRY/YZRX parameters.
Generate.builtin_move_helix_heidenhain()
Use builtin_move_helix_linear if linearize curves requested. Call move-feed to set the feedrate, move-contact to set any contact codes, call format_move_xyz() to move to the start point if not already there. If in the XY plane, emit IJ G12/G13 G91 Hangle Z.
Generate.builtin_move_helix_siemens()
Use builtin_move_helix_linear if linearize curves requested. Call move-feed to set the feedrate, move-contact to set any contact codes, call format_move_xyz() to move to the start point if not already there. Emit G2/G3 with AR= param.
Generate.builtin_move_helix_linear()
Used when linearize curves requested. Call move-feed to set the feedrate, move-contact to set any contact codes, split the helix into linear segments. Call format_move_xyz() for each piece, which creates and processes a CtlType.MOVE for the given coordinate values.
Generate.builtin_move_ijk_fanuc()
Default for move-ijk function. Returns I, J, and K tool direction parameters multiplied by 100 and formatted with the appropriate digits of precision if the direction has changed and we are not doing 3axis only.
Generate.builtin_move_ijk_siemens_traori()
Returns Siemens TRAORI(1) A3, B3, and C3 tool direction parameters formatted with the appropriate digits of precision if the direction has changed and we are not doing 3axis only.
Generate.builtin_move_ijk_tcp_ab()
Returns tool direction for TCP-capable machines in terms of AB angles, where A is rotation in YZ and B is rotation in XZ.
Generate.builtin_move_ijk_tcp_ac()
Returns tool direction for TCP-capable machines in terms of AC angles, where A is rotation in YZ and C is rotation in XY.
Generate.builtin_move_ijk_tcp_bc()
Returns tool direction for TCP-capable machines in terms of BC angles, where B is rotation in XZ and C is rotation in XY.
Generate.builtin_move_none()
Tracks the current position in the generate state, but does not emit any movement command.
Generate.builtin_move_siemens_renishaw()
Do protected move with L9810 using probe feed rate
Generate.builtin_move_trace()
Returns a comment for polyline move points if the trace_comments() is set to points.
Generate.builtin_move_xyz()
Default for move-xyz function. Returns X, Y, and Z parameters formatted with the appropriate digits of precision if they have changed and are not supressed.
Generate.builtin_move_xyz_esab()
Return X Y parameters always, even if not changed.
Generate.builtin_ncfun_default()
Default for the CtlEvent.EXEC_NCFUN event. This tests the type of the function and calls ncfun-mark-set, ncfun-mark-wait, ncfun-message, ncfun-exchange-pallet, ncfun-index-pallet, ncfun-index-table, ncfun-stop, ncfun-optional-stop, ncfun-tool-load, ncfun-tool-unload, or ncfun-extended as appropriate.
Generate.builtin_ncfun_exchange_pallet_default()
Default for ncfun-exchange-pallet function. Return a comment describing the pallet exchange.
Generate.builtin_ncfun_extended_apt_insert()
Return contents prefixed with INSERT/. Does not duplicate INSERT/ if the contents already starts with that.
Generate.builtin_ncfun_extended_default()
Default for ncfun-extended function. Return a comment with the contents of the function. If the contents starts with INSERT/, add what follows verbatim. If the contents are CUTCOM/LEFT, add G41. If the contents are CUTCOM/RIGHT, add G42. If the contents are CUTCOM/OFF, add G40.
Generate.builtin_ncfun_extended_esab()
Insert machine specific codes for CYCLE/PLASMA, CYCLE/STRGHT, CYCLE/BOTTOM, CYCLE/TOP, CYCLE/PLABEL, CYCLE/PLABELF, CYCLE/TEXT, CYCLE/TEXTF, CYCLE/PMARK, CYCLE/PMARKF, CYCLE/DUMMY, HEAD/ON, HEAD/OFF, ANGLEL/, ANGLER/, HITEL/, HITER/, MANGLE/, TFONT/, LFONT/, GRAIN/, AREA/, MARK
Generate.builtin_ncfun_index_pallet_default()
Default for ncfun-index-pallet function. Return a comment describing the pallet index.
Generate.builtin_ncfun_index_table_default()
Default for ncfun-index-table function. Return a comment describing the table index.
Generate.builtin_ncfun_index_table_heidenhain()
Return G247 Q339=+idx.
Generate.builtin_ncfun_message_apt_pprint()
Returns message formatted as PPRINT/<text>
Generate.builtin_ncfun_message_comma_uppercase()
Returns message formatted as (MSG, <TEXT>), with the text in uppercase. Total line length is limited to 80 chars. Used by the Fanuc, and many others.
Generate.builtin_ncfun_message_comment()
Returns the message formatted as a comment, prefixed with MESSAGE.
Generate.builtin_ncfun_message_default()
Default for ncfun-message function. Returns message formatted with builtin_ncfun_message_comma_uppercase
Generate.builtin_ncfun_message_dmis()
Returns message formatted as TEXT/OUTFIL,<text>, with message length limited to 80 chars.
Generate.builtin_ncfun_message_okuma()
Returns message formatted as MSG(<TEXT>), with message length limited to 124 chars and uppercase.
Generate.builtin_ncfun_message_siemens()
Returns message formatted as MSG("<text>"), with message length limited to 124 chars.
Generate.builtin_ncfun_optional_stop_apt()
Return OPSTOP.
Generate.builtin_ncfun_optional_stop_default()
Default for the ncfun-optional-stop function. Returns M01.
Generate.builtin_ncfun_stop_apt()
Return STOP.
Generate.builtin_ncfun_stop_default()
Default for the ncfun-stop function. Returns M00.
Generate.builtin_op_approach_paths()
Default for the op-approach-paths function. Temporarily enable TOOLPATH_START and OPERATION_END events if necessary, advance the process cursor to the first toolpath with a trajectory type of approach and priority of required. Process events until the operation end or the first non-required, non-approach toolpath.
Generate.builtin_op_lift_paths()
Default for the op-lift-paths function. Temporarily enable TOOLPATH_START and OPERATION_END events if necessary, advance the process cursor to the first toolpath with a trajectory type of lift and priority of required. Process events until the operation end or the first non-required, non-lift toolpath.
Generate.builtin_probe_comments()
Default for probe-comments function. Returns comments describing the probe operation, variable, direction, distance, and endpoint.
Generate.builtin_probe_comments_dmis()
Returns comments describing the probe operation, direction, and distance.
Generate.builtin_probe_crcl()
Call op-approach-paths and probe-comments. Do format_move_xyz() to move to the start position if needed. Do additional moves to the end and back to the start to simulate probing, then call op-lift-paths.
Generate.builtin_probe_datums_dmis()
Return datum declarations for active project. Examines geometry associated with datum and declares a PLANE or CYLNDR feature with a matching MEAS command
Generate.builtin_probe_default()
Default for the CtlType.OP_PROBE action. Call refpoint-center, op-approach-paths, probe-comments, and op-lift-paths
Generate.builtin_probe_dmis_feature()
Call builtin_probe_dmis_ptfeat or builtin_probe_dmis_ptmeas depending on whether the probing operation is associated with a feature or point
Generate.builtin_probe_dmis_feature_end()
Close off measurement with ENDMES and declare associated datums and tolerances
Generate.builtin_probe_dmis_feature_start()
Examines geometry associated with feature and declares a PLANE or CYLNDR feature with a matching MEAS command
Generate.builtin_probe_dmis_ptfeat()
Call op-approach-paths and probe-comments. Do format_move_xyz() to move to the start position if needed. Emit FEAT/POINT, MEAS/POINT, and PTMEAS, then call op-lift-paths.
Generate.builtin_probe_dmis_ptmeas()
Call op-approach-paths and probe-comments. Do format_move_xyz() to move to the start position if needed. Emit PTMEAS then call op-lift-paths.
Generate.builtin_probe_fanuc_renishaw()
Temporarily set the CtlType.MOVE action to builtin_move_fanuc_renishaw to do protected moves. Call op-approach-paths to approach, then probe-comments. Do format_move_xyz() to move to the start position if needed. Emit Renishaw Single Surface G65P9811 probing macro for X/Y/Z single axis moves or a G65P9821 AD Angled Surface probing macro for planar XY movement. Set decomposed feature UUID, face id, probe number and probe max in vars #170-#180, probe XYZ in #181-#183. Call op-lift-paths to do protected departure, then reset CtlType.MOVE action.
Generate.builtin_probe_haas_renishaw()
Call op-approach-paths to approach, then probe-comments. Do format_move_xyz() to move to the start position if needed. Emit Renishaw Single Surface G65P9811 probing macro for X/Y/Z single axis moves or a G65P9821 AD Angled Surface probing macro for planar XY movement. Call op-lift-paths.
Generate.builtin_probe_heidenhain()
Call op-approach-paths to approach, then probe-comments. Do format_move_xyz() to move to the start position if needed. Emit G427, setting Q263, Q264, Q261, Q320, Q272, Q267, Q281, Q288, Q289, Q309, Q330. Call op-lift-paths.
Generate.builtin_probe_heidenhain_hhcycle()
Call op-approach-paths to approach, then probe-comments. Do format_move_xyz() to move to the start position if needed. Emit TCH PROBE 3.0 MEASURING, TCH PROBE 3.1 Q1, TCH PROBE 3.2 X ANGLE:, and TCH PROBE 3.3 DIST F MB: REFERENCE SYSTEM:0. Call op-lift-paths.
Generate.builtin_probe_okuma()
Call op-approach-paths and probe-comments. Do format_move_xyz() to move to the start position if needed. Emit PUT and WRITE statements to log the values. Emit G31 X Y Z F, then more PUT and WRITE statements to log the results. Call op-lift-paths.
Generate.builtin_probe_prog_begin_fanuc()
Clear variables used to track UUID, face id and probe number. #170-#180
Generate.builtin_probe_prog_begin_siemens()
Clear variables used to track UUID, face id and probe number, all prefixed with STP
Generate.builtin_probe_siemens_renishaw()
Temporarily set the CtlType.MOVE action to builtin_move_siemens_renishaw to do protected moves. Call op-approach-paths to approach, then probe-comments. Do format_move_xyz() to move to the start position if needed. Emit Renishaw Single Surface G65P9811 probing macro for X/Y/Z single axis moves or a L9821 Angled Surface probing macro for planar XY movement. Set decomposed feature UUID, face id, probe number and probe max in STPFEAT, STPFACE, STPNUM, STPMAX, STPRET, STPDIST, and STPCT vars. Call op-lift-paths to do protected departure, then reset CtlType.MOVE action.
Generate.builtin_probe_siemens_xy()
Call op-approach-paths to approach, then probe-comments. Do format_move_xyz() to move to the start position if needed. If probing is axis aligned, emit CYCLE978(). Set decomposed feature UUID, face id, probe number and probe max in STPFEAT, STPFACE, STPNUM, STPMAX, STPRET, STPDIST, and STPCT vars. Call op-lift-paths to do departure.
Generate.builtin_program_end_apt()
Call refpoint-center, spindle-off and coolant-off. Emit END and FINI.
Generate.builtin_program_end_crcl()
Call spindle-off and coolant-off, EndCanon tag, close CRCLProgram tag.
Generate.builtin_program_end_default()
Default for the CtlEvent.PROGRAM_END event. Call refpoint-center, spindle-off, coolant-off. Emit M30.
Generate.builtin_program_end_dmis()
Return ENDFIL
Generate.builtin_program_end_esab()
Return code for head rotation off
Generate.builtin_program_end_fanuc()
Emit G49 to cancel tcp, then call spindle-off and coolant-off. Emit M30 and then the closing % percent.
Generate.builtin_program_end_heidenhain()
Call spindle-off, coolant-off. Emit M129, M30, and then N99999999 %G70/G71.
Generate.builtin_program_end_okuma()
Call spindle-off, coolant-off. Close logfile if probing, Emit G170 if in TCP mode, and M30.
Generate.builtin_program_end_okuma_omac()
Close logfile if probing, the emit CALL O238 LFLG=0, and M30
Generate.builtin_program_end_siemens()
Call spindle-off, coolant-off. If using macros WSMODEOF, then emit M2.
Generate.builtin_program_end_siemens_traori()
Call spindle-off, coolant-off. Emit TRAFOOF, then M2.
Generate.builtin_program_start_apt()
Emit opening comment, call filename, timestamp. Emit PARTNO with the workpiece product id. Call units function.
Generate.builtin_program_start_crcl()
Open XML encoding, call filename, timestamp, open CRCLProgram tag. InitCanon tag, and call units
Generate.builtin_program_start_default()
Default for the CtlEvent.PROGRAM_START event. Call filename, timestamp.
Generate.builtin_program_start_dmis()
Emit DMISMN, call filename, timestamp, followed by setup boilerplate, then call probe-datums.
Generate.builtin_program_start_esab()
Emit opening comment, call filename, timestamp, units, G90, registration and turn on head rotation for near and far marking.
Generate.builtin_program_start_fanuc()
Emit opening % percent, then O with the program number. Call filename, timestamp, workoffset, and units functions. If the program has probes, call builtin_probe_prog_begin_fanuc. Call wstep-trace-clear function.
Generate.builtin_program_start_heidenhain()
Emit %G70/G71 depending on the requested unit, then call filename, timestamp then G17 G90.
Generate.builtin_program_start_mdsi()
Generate.builtin_program_start_okuma()
Emit O with the program number. Call filename, timestamp. Emit G15 H0, call workoffset, and units functions. If using TCP, emit M510 to turn off CAS.
Generate.builtin_program_start_okuma_omac()
Emit O with the program number. Call filename, timestamp. Emit CALL O238 LFLG=1, then call workoffset and units functions.
Generate.builtin_program_start_siemens()
Call filename, timestamp, workoffset. Possibly declare OMAC macros, variable for workingstep tracking. If the program has probes, call builtin_probe_prog_begin_siemens. Call wstep-trace-clear, emit G17 G40 G64 G90, then call workoffset and units functions.
Generate.builtin_refpoint_center()
Default for refpoint-center function. Returns G40 if needed.
Generate.builtin_refpoint_contact()
Default for refpoint-contact function. Notes that cutter contact is on in the generate state variables then return None.
Generate.builtin_refpoint_left()
Default for refpoint-left function. Returns G41 if needed.
Generate.builtin_refpoint_right()
Default for refpoint-right function. Returns G42 if needed.
Generate.builtin_setup_start_default()
Default for the CtlEvent.SETUP_START event. Call ncfun-stop to force a hard stop between setups, emit comments indicating that a setup change has occurred and the new transform numbers
Generate.builtin_spindle_apt()
Default for spindle function. Return None if the old and new spindle values are the same. Call spindle-off if the new value is zero. Return SPINDL,<val>, CCLW/CLW. CCLW counter-clockwise is indicated for positive values and CLW clockwise for negative ones.
Generate.builtin_spindle_apt_uvd()
Return None if the old and new spindle values are the same. Call spindle-off if the new value is zero. Return SPINDL/RPM,<val>, CCW/CLW. CCW counter-clockwise is indicated for positive values and CLW clockwise for negative ones.
Generate.builtin_spindle_default()
Default for spindle function. Return None if the old and new spindle values are the same. Call spindle-off if the new value is zero. Return M4/M3 with an S parameter. M4 counter-clockwise is indicated for positive values and M3 clockwise for negative ones.
Generate.builtin_spindle_off_apt()
Return None if the spindle is already off. Return SPINDL/OFF
Generate.builtin_spindle_off_default()
Default for spindle-off function. Return None if the spindle is already off. Return M5.
Generate.builtin_spindle_off_siemens_macro()
Return None if the spindle is already off. Return WSSPINDL( 5, 0.0 ).
Generate.builtin_spindle_siemens_macro()
Return None if the old and new spindle values are the same. Call spindle-off if the new value is zero. Return WSSPINDL( 4/3, <val> ), where 4 counter-clockwise is indicated for positive values and 3 clockwise for negative ones.
Generate.builtin_spindle_speed_before_direction()
Default for spindle function. Return None if the old and new spindle values are the same. Call spindle-off if the new value is zero. Return an S parameter followed by M4/M3. M4 counter-clockwise is indicated for positive values and M3 clockwise for negative ones.
Generate.builtin_tap_comment()
Return a series of comments describing the tapping parameters
Generate.builtin_tap_default()
Default for the CtlType.OP_TAP action. Call builtin_tap_comment, then examine the featuure of the workingstep. If a hole feature, call tap-first, tap-point, and tap-last. If it a pattern feature, call tap-first before the first element in the pattern, call tap-point for each element in the pattern, and call tap-last after the last element. Advance to the operation end.
Generate.builtin_tap_first()
Default for the tap-first function. Call format_rapid_xyz_ijk() to move to the start point. Force a standalone spindle command by clearing the stored value in the state and calling spindle.
Generate.builtin_tap_first_siemens()
Call format_rapid_xyz_ijk() to move to the start point. Set SPOS=0.
Generate.builtin_tap_last()
Default for the tap-first function. Return None
Generate.builtin_tap_last_g84()
Return G80 to cancel the G84 rigid tapping mode.
Generate.builtin_tap_point_default()
Default for the tap-point function. Return a comment describing the tap start end and retract values.
Generate.builtin_tap_point_g84()
Check for Z-aligned tapping, and issue a warning comment and call ncfun-stop if not. Get the thread pitch from the tapping tool and construct a feedrate speed from the commanded spindle speed and pitch. If not at the start point, emit G80 then call format_rapid_xyz_ijk() to move to the retract point then the start point. Emit G84 X Y Z R F
Generate.builtin_tap_point_siemens()
If not at the start point, call format_rapid_xyz_ijk() to move to the retract point then the start point. Emit G331 X Y Z I J K S, then G332 X Y Z.
Generate.builtin_timestamp()
Returns the current time formatted as an ISO-style date in a comment. Used at the start of programs to identify when the output was created.
Generate.builtin_tool_change_apt()
Call spindle-off and coolant-off. Emit TLDATA/MILL with the tool shape parameters.
Generate.builtin_tool_change_comment()
Default for the tool-comment function. Return comments describing the tool and associated parameters.
Generate.builtin_tool_change_default()
Default for the CtlEvent.TOOL_CHANGE event. Call spindle-off, coolant-off, and tool-comment, emit TnumM6. If using TCP, emit G43Hnum.
Generate.builtin_tool_change_fanuc_tcp()
Call spindle-off, coolant-off, and tool-comment, emit G49 to cancel TCP mode, TnumM6, then G90. If using TCP, emit G43.5HnumI0J0K1 otherwise queue G43Hnum as a prefix for the next move. Clear the feed and position in the generate state.
Generate.builtin_tool_change_fanuc_tcp_T100_no_M6()
As with builtin_tool_change_fanuc_tcp but add 100 to the tool number.
Generate.builtin_tool_change_heidenhain()
Call spindle-off, coolant-off, and tool-comment, emit Tnum G17, then M128 and M126.
Generate.builtin_tool_change_mdsi()
Generate.builtin_tool_change_okuma()
If we have a prior tool and are commanding tool tilt, turn off TCP mode with G170. Call spindle-off, coolant-off, and tool-comment, wrap TnumM6 with a test of VTLCN to prevent setting a tool that is already present. Set tool offsets with G56 Hnum. If we are commanding tool tilt, turn on TCP mode with G169.
Generate.builtin_tool_change_okuma_omac()
Clear spindle, coolant, feed, and position values in the generate state. Call tool-comment, then call the OMAC tool change macro with CALL OTCG LTL=num
Generate.builtin_tool_change_siemens()
Call spindle-off, coolant-off, and tool-comment. add WSMODEON if doing TCP, followed by WSTOOL(num). If doing TCP, finish with WSMODEON and call workoffset.
Generate.builtin_tool_change_siemens_810()
Call spindle-off, coolant-off, and tool-comment, set length, diameter, and corner radius compensation parameters if available with $TC_DP3[num,1]=, $TC_DP6[num,1]=, and $TC_DP7[num,1]=, then Tnum D1 M6 or TnumM6 as appropriate.
Generate.builtin_tool_change_siemens_traori()
Call spindle-off, coolant-off, and tool-comment. Add TRAFOOF to disable TCP, followed by Tnum and M6 on separate lines. Finish with TRAORI(1), ORIWKS and call workoffset.
Generate.builtin_toolpath_start_default()
Default for the CtlEvent.TOOLPATH_START event. Emit comment identifying the toopath, call spindle and coolant, then depending on the toolpath type , call refpoint-center or refpoint-contact.
Generate.builtin_units_apt()
Examine the length unit in the generate object and return UNITS/INCH or UNITS/MM.
Generate.builtin_units_crcl()
Examine the length unit in the generate object and return a SetLengthUnitsType command with UnitName of inch, millimeter, or meter.
Generate.builtin_units_dmis()
Examine the length unit in the generate object and return UNITS/INCH or UNITS/MM with ANGDEC.
Generate.builtin_units_g20()
Examine the length unit in the generate object and return G20/G21 for inch/mm.
Generate.builtin_units_g70()
Examine the length unit in the generate object and return G70/G71 for inch/mm.
Generate.builtin_units_g700()
Examine the length unit in the generate object and return G700/G710 for inch/mm.
Generate.builtin_workingstep_end_default()
Default for the CtlEvent.WORKINGSTEP_END event. Call ncfun-optional-stop if requested.
Generate.builtin_workingstep_start_default()
Default for the CtlEvent.WORKINGSTEP_START event. Return comment identifying the workingstep if requested.
Generate.builtin_workingstep_start_esab()
Discard workingstep if not in the correct pass.
Generate.builtin_workingstep_start_fanuc()
Call builtin_workingstep_start_default to do usual initialization. Then set variable #185= the current workingstep sequence number.
Generate.builtin_workingstep_start_fanuc_unwind()
If we have just done a tool change the position is unknown and we do not need to unwind. If the position is known, rapid up to security plane with IJK of 001, then emit G49 G53C360, and then put the control back into TCP mode with G43.5HnumI0J0K1. Call builtin_workingstep_start_default to do usual initialization.
Generate.builtin_workingstep_start_siemens()
Emit STOPRE to keep command lookahead from executing variable assignment early, then set the STPWS= variable to the current workingstep index.
Generate.builtin_workingstep_trace_clear_fanuc()
Set variable #185=0.
Generate.builtin_workingstep_trace_clear_siemens()
Set the STPWS= variable to its base value.
Generate.builtin_workoffset_default()
Default for "workoffset" function. Return G53 if offset is zero, or G54-58 for offsets 1-5.
Generate.builtin_workoffset_okuma()
Return G15 H0 if offset is zero, or G15 H1-200 for offsets 1-200.
Generate.builtin_workplan_end_default()
Default for the CtlEvent.WORKPLAN_END event. Call workplan-probe-end if the workplan contains probing operations.
Generate.builtin_workplan_probe_end_default()
Return None
Generate.builtin_workplan_probe_end_fanuc_renishaw()
Turn the probe off with G65P9833
Generate.builtin_workplan_probe_end_haas_renishaw()
Turn the probe off with G65P9833
Generate.builtin_workplan_probe_end_okuma()
Return M127
Generate.builtin_workplan_probe_end_siemens_renishaw()
Return L9833
Generate.builtin_workplan_probe_start_default()
Return comment identifying the probing workplan.
Generate.builtin_workplan_probe_start_fanuc_renishaw()
Turn the probe on with G65P9832
Generate.builtin_workplan_probe_start_haas_renishaw()
Clear all variables with G65P9800, then turn the probe on with G65P9832
Generate.builtin_workplan_probe_start_okuma()
Call builtin_workplan_probe_start_default, then emit G15H10 M130 M19 M127
Generate.builtin_workplan_probe_start_siemens_renishaw()
Call builtin_workplan_probe_start_default, then emit L9800 and L9832
Generate.builtin_workplan_start_default()
Default for the CtlEvent.WORKPLAN_START event. Call workplan-probe-start if the workplan contains probing operations.
Generate.builtin_workplan_start_dmis()
Ignore workplans that do not contain probing operations by popping them off the execution stack of the cursor.