Post-Processor Variables - @@LOGICAL@@

HelpCadfil Help contents      HomeIconCadfil.com Home

Introduction

In the post processor block definitions for the layout of SPF and MPF there are numerous logical variables that can be used. These have the format @@NAME@@ for example @@LAB-AX-1@@. In this case the LAB-AX-1 is the axis name label for axis 1 (the mandrel rotation). So if the mandrel rotation axis label has been set to 'A' then wherever @@LAB-AX-1@@ is specified the value (in this case 'A' will be applied).

The structure of the NC data is made up from a number of 'block definitions' as listed below. Each of these can consist of multiple line of code. Sample SM files give more detail on this structure.
$BLOCK-MAIN-PROGRAM=
$BLOCK-START-POSN=
$BLOCK-SPF-START=
$BLOCK-SPF-MIDDLE=
$BLOCK-SPF-END=

The blocks listed above are the mains ones but there are some others with specific special purposes listed below.

$BLOCK-ANR01, $BLOCK-ANR02 Are blocks of machine specific codes for machines with a two position eye rotation to switch from position 1 to position 2 and visa versa, this type of machine is not much made these days.

$BLOCK-NC-TOP and $BLOCK-NC-BOT For configuration that have a single file NC output the block TOP is at the start of the NC file and BOT at the end of the file. For settings that produce multiple NC file outputs the TOP and BOT sandwich the main program file but aren't really needed as you could have just modified the main program block instead.

$BLOCK-ANR-RECOVER A special block used in some application with power failure recovery for the winding machine.

$BLOCK-SPF-EXPAND A special block that is essential where a subprogram is being expanded (unrolled) into a continuous motion list. The expand block replaces the $BLOCK-SPF-END for all the intermediate virtual end of subprogram lines so that any specific codes for the last line only get processed one time. Typically this block would look like $BLOCK-SPF-MIDDLE but might have a counter of other code added for progress monitoring etc.

$BLOCK-CONV1 a special block used with some bespoke program format converters to convert programs from an old machine to a new machine.

List of variable and descriptions

There are numerous logical variable, some will be essential for creating a working program, some can be used to add optional information to the program for example @@CADFIL-VERSION@@ can be used to add the version of Cadfil being used to the program.

@@FEED@@ Current value of feed-rate or speed variable. Note that time variables are also available, see DTIME, WTIME and INVTIME

@@LINE-NUMBER-SPF@@   &   @@LINE-NUMBER-MPF@@ These are the current SPF and MPF  program line numbers. The first line in the main program (MPF) is set by the value $LINE-NO-START-MPF and the line number step is set by $LINE-NO-INCREMENT-MPF. For the sub-program file (SPF) the values are $LINE-NO-START-SPF and $LINE-NO-INCREMENT-SPF. @@LINE-NUMBER-SPF++@@ is the number of the next line i.e. the current line number plus the line number increment. The maximum line number the controller can support is set by $LINE-NO-MAX. If this is exceeded the first line number is then used thus it will not be unique!

@@LAB-AX-n@@ (where n can be 1 to 6) These are the names (labels) for axes 1 to 6

@@AX-INC-n@@ (where n can be 1 to 6) Is the current increment motion value for axis n

@@POS-n@@ (where n can be 1 to 6) Is the current absolute machine position value for axis n

@@SPOS-n@@ (where n can be 1 to 6) Is the absolute machine position of the very first position (the start position) for axis n for the current sub-program being processed.

@@MODPOS-n@@ (where n can be 1 to 6) the same as POS-n however the value is forced in the 0-360 range. This is primarily used for start positions for the mandrel axis (MODPOS-1) for non-round parts. It maybe that the mandrel axis is a modulo axis e.g. G90 A 361.0 is the same as G90 1.0 and G90 A -1.0 is the same as G90 A 359. Some CNC configurations do not like negative absolute values for a rotary axis or have problems with G90 values greater than 1 rotation. This feature was added at V9.01 at some future point if needed a feature to set the 1 rotation limit to values other than the 360 default value can be added. This feature is only useful with axis numbers 1-3 as 4-6 are usually linear axis.

@@MODSPOS-n@@ (where n can be 1 to 6) is the same as MODPOS-n but uses SPOS rather than the POS value

@@NO-PASSES@@Is the number of circuits for the current SPF

@@NO-SUBS@@Is the number of subprograms or the number of payout files in a combined winding file. For post-processing an individual payout file it will have a value of 1.

@@NO-PAYOUT-FILES@@Is the total number of payout files in a combined winding program. This can be used to count up the total number of layers in a program.

@@CADFIL-VERSION@@ The current Cadfil version e.g. 7.35

@@DATE@@ Gives the value windows reports for current date and time in the following format 06-NOV-07 08:38:07

@@MDF-NAME@@ The name of the post processor configuration (.sm file) being used. Please note that as of Cadfil 9.17 the variable has been deleted and will give an error. @@CONFIG@@ should be used instead. for more information on the error caused by this, see the Config redundancy error page.

@@SPF-NAME@@ The name of the current SPF (often the current payout file name)

@@MPF-NAME@@ The name of the MPF

@@CTL-FILE-NAME@@ Name of the CTL file when multiple layer programs are being processed if there is no CTL file this is the name as @@MPF-NAME@@

@@Qn@@ (where n takes the values 1 to 4) These are the 4 terms of the quaternion function for post-processing using a industrial robot. The four Q values Q1,Q2,Q3& Q4 define angular the orientation of the payout eye (robot tool).

@@BLANK-LINE@@ Adds an empty line (a line with a single space)

@@TENSION-VALUE-n@@ (where names takes the value 1 to 3) In the sm file there user can define up to 3 tensions values. For example these could be high medium and low tension. This function inserts the value of tension defined.

@@RMAX@@ Maximum radius in the current mandrel (only valid for axisymmetric mandrels)

@@RCLR@@ Default mandrel clearance distance from current payout file

@@ANR-TXT@@

@@BLOCK-START-POSN@@ This is a special logical which is found in the MPF block definition and inserts a line or number of lines that define the start point and subroutine call for the SPF. This is defined as a separate block as a program with multiple subprograms will use this block several times. To understand this function is is easier to look at a working example of an SM file.

@@PAY-FILE-NAME@@ Name of current payout path file

@@BANDWIDTH@@ Width of the fibre band for the current SPF (payout file)

@@XDAT@@ Mandrel Xdatum value

@@USER-NAME@@ Name of the logged in user reported by windows

@@FIRST-SPF-ONLY@@ This is a special function variable. In the program block definitions any line containing this value will only be processed on the first occurrence (ie the first subroutine). This could be used for example in the start position block to have a stop code (NC - M00) for the first SPF start only to tie on the fibres.

@@FIRST-SPF-EXCLUDE@@ This is a special function variable. In the program block definitions any line containing this value will NOT be processed on the first subroutine but will for all subsequent subroutines and is the opposite of @@FIRST-SPF-ONLY@@.

@@DTIME@@ Incremental time for current motion.

@@INVTIME@@ Inverse Incremental time for current motion i.e. 1/DTIME this is the output variable if the CNC uses the old style 'Inverse Time' speed control often under G93 in GCODE

@@WTIME@@ Current winding machine time from start of program to current position.

@@TOT-FIB-LEN@@ Total length of fibre wound in the program

@@P38-TAPE-LAY-ANG@@
@@P38-TAPE-THICK@@
@@P38-TAPE-WIDTH@@
@@P38-ACTION-UPPER@@
@@P38-ACTION-LOWER@@
@@P38-TAPE-SPEED@@
@@P38-CONE-HALF-ANGLE@@
@@P38-START-DIAMETER@@
@@P38-WIND-LENGTH@@
@@P38-REVS-BEFORE-COOLING@@
These 'P38' parameters are specific only the the tape edge winding parametric program and are documented elsewhere.

Pipe Winding Parameters, see the help file section on these programs
@@PW-MANDREL-RAD@@ The mandrel radius at the start of the program.
@@PW-CLEARANCE-RAD@@ The Clearance Radius for the machine.
@@PW-START-POS@@ Start position from chuck datum.
@@PW-WIND-LENGTH@@ Length of pipe to be wound
@@PW-WIND-ANGLE@@ For a multi-layer pipe program the winds angle my be different for each layer so this parameter is best included in the start position block or the SPF header block.
@@PW-WIND-LAYER-NO@@ This parameter if used should be included in the start position block or the SPF header block.
Please note that for a pipe winding program with more than one layers the 'mandrel' radius (and other parameters) changes with each layer. If these parameters are used in the main MPF block the value that is used will be for the last SPF! It is better to use these parameters in the start position block, perhaps using the @@FIRST-SPF-ONLY@@ if the data is not required for each layer. Some parameters will probably be required for each layer such and wind angle.

@@FIBER-TEX@@
@@FIBER-NAME@@
@@FIBER-TYPE@@
@@FIBER-NUM-ROVINGS@@
@@FIBER-ROVING-WIDTH@@
@@FIBER-MASS-PERCENT@@
@@FIBER-VOLUME-PERCENT@@

@@RESIN-NAME@@ and @@RESIN-TYPE@@ These parameters relate to the fibre & resin properties from the materials database that have been saved in the current payout file.

@@MASS-RESIN@@

The current estimate of the mass of resin used during winding, assuming the user has selected the correct  material parameters. The fibre amount is known. the resin is from the specified resin fraction & resin density. Caution, this will be the current value and it is cumulative. If you have this at the end of the MPF it will be the total. If you have after each layer it will be the current value and will increase layer by layer.

@@MASS-FIBRE@@ The current estimate of the mass of fibre used. See @@MASS-RESIN@@.

@@MASS@@ Current wound mass of composite. It is equal to @@MASS-FIBRE@@+@@MASS-RESIN@@.

@@ANR08@@ The payout file is a set 3D motion coordinate data that is converted into NC motion for a specific winding machine by the post-processor. The payout file may also contain some ancillary records that direct the post-processor to perform some additional action.  Ancillary records take the format ANRxx where xx is a number any then may have some other data that follows. ANR08 appears with the line:
ANR08 ; previous point was hoop point

If the user wishes an action can be associated with this event, for example every time a hoop (turning) point is reached by flipping a  fixed stop payout eye rotation that can be found on some older machines that do not have a programmable payout eye rotation.  This works as follows , set the output for the NC machine with the SM file variable $ANR08_HOOP_ACTION_TXT1=. For example $ANR08_HOOP_ACTION_TXT1=M88 outputs the code M88 which could have been set on the CNC to perform a specific action. In the SM file we our then add @@ANR08@@ to the blocks $BLOCK-SPF-START, $BLOCK-SPF-MIDDLE and $BLOCK-SPF-END that are used for sub-program motion data formats.

Note we now have $ANR08_HOOP_ACTION_TXT1 and $ANR08_HOOP_ACTION_TXT2 which are used alternately to allow for the set and unset code to be different. For example:
$BLOCK-SPF-START=@@LAB-AX-1@@@@AX-INC-1@@ @@LAB-AX-4@@@@AX-INC-4@@ @@ANR08@@
Each time the ANR08 appears in the payout file (at the turning points) the codes @@ANR08@@ would be replaced by M88 and at all other times it would be replaced by null text (i.e. removed). If $ANR08_HOOP_ACTION_TXT1 or 2 is not set in the SM file then there will be no output as it will by default be set to a null string.

@@TSW-1@@, @@TSW-2@@, @@TSW-3@@ these allow the output of twist , shear and wrap angles on the payout eye/roller(in degrees) for each line of the NC program and are discussed in more detail "here."

these new SM variable added for V9.94, in the post-process these relate to the current position on the surface of the mandrel also know as the fibre position or FIBPOS. These all use the mandrel coordinate system and the X axis is by convention the axis of rotation.

@@FP1@@,@@FP2@@,@@FP3@@ These represent the X, Y and Z 'mandrel' coordinates if the fibre point on the mandrel surface

@@FD1@@,@@FD2@@,@@FD3@@ These represent the X, Y and Z components of the fibre movement directions (unit vector) at the fibre point

@@FN1@@,@@FN2@@,@@FN3@@ These represent the X, Y and Z components of the unit normal to the mandrel surface

@@FR@@ This is the radial distance of the fibre point from the X axis (the mandrel rotation axis)

@@FA@@ This is the orientation angle in radians of the fibre point in the YZ plane. The angle is measured from the Y+ direction and is in the range -pi to +pi, the positive Z quadrants being plus and the negative Z quadrants being minus angles.

@@FWA@@ The winding angle, the angle of the fibre direction measure to the normal projection of the global X axis into the mandrel surface at the point.

Mathematical Expressions Evaluation

At Cadfil V9.94 the facility to have mathematical expressions within the SM file blocks was introduced as a BETA feature. Some CNC controllers can do maths some cannot so on some CNC you could have #101=[250.0*2.0+5.0] in the NC code that would set the variable #101 to 505.0. In the SM file you might have a block with #101=[@@RMAX@@*2] and RMAX would get replaced with a value so the NC might be #1=[250.0*2]. The math function on the CNC might be limited or non-existent.

Cadfil could have an SM file line that said #1=@@EXPRN@@(expression)(fmt) where expression is a mathematic expression (formula) and fmt is the format of the expression result, that is defines the number of decimal places wanted etc). An expression usage case might be F@@EXPRN@@(500.0/@@FR@@)(F0.3) @@FR@@ is a variable that is the current radius of the fibre position on the mandrel surface so if the current radius was 100 the expression would be 500.0/100 which would be passed to the evaluator which would calculate 5.000000. The format F0.3 says three decimal places and no leading spaces so the final result in the NC would be F5.000. The Cadfil expression evaluator can have a wide range of maths function such as SIN, COS, SQRT etc and is discussed in the the expression evaluator topic.

For more information on the use of formats there is a specific topic on Cadfil formats.

Updated: 17 July 2026