top of page

G-Code Placeholders and Postprocessor Parameters

Writer: David Schleicher
David Schleicher
Aug 19
5 min read

Placeholders let you write values from CamDRAW into your G-code. A placeholder is a keyword in angle brackets, and when the program is generated it is replaced with the actual value.


They are what makes a postprocessor adaptable rather than fixed.


Where they can be used


Placeholders work in the user-defined text sections of the presetting file: program start, program end, operation start, operation end, tool change, cut start, cut end and machine setup.


To reach them, click the gear icon at the top of the CamDRAW docker, open the Profile tab, and click Edit on your profile. The sections are under custom lines.


The syntax


A placeholder is the parameter name inside angle brackets, for example a tool number written as the letter T followed by the tool placeholder. Everything else in the line is written out exactly as you type it, so a placeholder can be combined freely with your own text and commands.


The full placeholder reference


Every placeholder below is written in angle brackets and replaced with its value when the program is generated. Names are case sensitive.


Job and document


  • <project> — the CorelDRAW document name

  • <version> — the CamDRAW version number

  • <units> — the current document unit, output as G20 or G21

  • <tools> — a listing of every tool needed for the job


Example, as a program header:


(Project: <project>)

(Created with CamDRAW <version>)

(Tools used: <tools>)

<units>

G90


This produces a readable header that identifies the job weeks later without opening the drawing.


The current operation


  • <name> — name of the current machining operation

  • <number> — number of the current machining operation

  • <s> — spindle speed for the current operation

  • <t> — tool number for the current operation

  • <f> — feed rate for the current operation

  • <tool_name> — name of the current tool


Example, as a tool change block:


M5

M6 T<t>

(<tool_name>)

M3 S<s>


Example, at the start of an operation:


(Op <number>: <name>, F<f>)


Workpiece


  • <workpiece_radius> — workpiece radius currently set in CamDRAW

  • <workpiece_size_x> — size in the X direction

  • <workpiece_size_y> — size in the Y direction

  • <workpiece_left_x> — X position of the left edge

  • <workpiece_bottom_y> — Y position of the bottom edge

  • <workpiece_center_x> — X position of the workpiece centre

  • <workpiece_center_y> — Y position of the workpiece centre


Toolpath extents


  • <toolpaths_left_x> — left edge of all toolpaths, as a bounding box

  • <toolpaths_right_x> — right edge of all toolpaths

  • <toolpaths_top_y> — upper edge of all toolpaths

  • <toolpaths_bottom_y> — lower edge of all toolpaths


Useful for a safety check at the start of a program, or for parking the head clear of the work at the end.


Drawing geometry


  • <x_position_first_node_shape> — X position of the first node of the first shape

  • <y_position_first_node_shape> — Y position of the first node of the first shape


State flags


Each returns 1 for yes and 0 for no, so they can drive a conditional on controls that support one.


  • <IsRotationMachining> — is this a rotary job

  • <surface_measurement_activated> — is a measurement grid created and active

  • <round_workpiece_activated> — is the workpiece round rather than rectangular


Surface measurement


  • <nx> — number of measuring points in the X direction

  • <ny> — number of measuring points in the Y direction

  • <gridsize_x> — spacing of the measuring points in X

  • <gridsize_y> — spacing of the measuring points in Y

  • <corner_measure_grid_x> — X position of the corner, meaning the first measuring point

  • <corner_measure_grid_y> — Y position of the corner

  • <minZ> — the MinZ safety limit

  • <zSafetyHeight> — safety height between measuring points

  • <z_increment_x_direction> — Z increment in X for the extended measuring cycle

  • <z_increment_y_direction> — Z increment in Y for the extended measuring cycle

  • <probeFeedRate> — probing feed rate

  • <x_position_zAuto_point> — X position of the Z-Auto point

  • <y_position_zAuto_point> — Y position of the Z-Auto point


Example, in the machine setup file, handing the grid to a probing subroutine on the control:


#100 = <nx>

#101 = <ny>

#102 = <gridsize_x>

#103 = <gridsize_y>

#104 = <corner_measure_grid_x>

#105 = <corner_measure_grid_y>

#106 = <probeFeedRate>

M98 P8000


The variable numbers and the subroutine call are whatever your control expects. CamDRAW supplies the values; the control does the probing.


Default values from the postprocessor


  • <default_tool_number> — default tool number

  • <default_safe_height> — default safety height

  • <default_plunge_height> — default plunge height

  • <default_start_height> — default start height

  • <default_depth> — default depth

  • <default_cutting_depth> — default cutting depth per pass

  • <default_engraving_height> — default engraving height

  • <default_cutting_height> — default cutting height

  • <default_number_of_cuts> — default number of passes

  • <default_plunge_feed> — default plunge feed rate

  • <default_spindle_speed> — default spindle speed

  • <default_interpolation_precision> — default curve precision


Tool information


Taken from the Other tab of the tool library.


  • <material> — the raw material stored with the tool

  • <pierce_time> — pierce time for laser, plasma and waterjet work

  • <info1> — first free information field

  • <info2> — second free information field

  • <info3> — third free information field


Example, at the start of a cut on a plasma or laser machine:


(Material: <material>)

M3

G4 P<pierce_time>


Static value


  • <first_safe_height> — safety height of the first tool operation, the value a G43 tool length compensation line usually needs


Example:


G43 H<t> Z<first_safe_height>


What they are actually for


Writing a readable header. Document name, tool list and units at the top of a program make it identifiable weeks later without opening the drawing.


Tool changes that match your control. The tool change section combined with the tool number and spindle speed placeholders produces exactly the sequence your machine expects.


Passing measurement data to a probing routine. This is the most substantial use. Write the grid parameters into the machine setup file, then call a subroutine on your control that performs the probing using them.


Transferring parameters generally. Anything your control can read as a variable can be filled from CamDRAW rather than typed at the machine.


The machine setup file


Alongside every generated program, CamDRAW writes a second file from the machine setup section of the postprocessor. All placeholders are available there.


This is the natural home for probing cycles, workpiece zero setting and macro calls. Run it before the job file, or the preparation it contains has no effect.


Testing


Add a placeholder, generate a small program and open it with the text editor icon in the NC program section. The substituted value is visible immediately.


If a placeholder appears in the output as literal text in brackets, the name is wrong. They are case sensitive and must match exactly.


Getting help with a specific control


Which placeholders you need depends entirely on what your control expects. Our support team helps with adapting a postprocessor and the machine setup file to a specific machine as part of a subscription or licence.

 
 

Recent Posts

See All
bottom of page