Parametric programming

CNC macros & auto-compensation

We develop CNC programs that calculate, check and correct themselves.
The goal: less scrap, fewer stoppages and fewer input errors on the shop floor.

Request a quote LinkedIn Download Brochure
We are members of:

PROGRAMS THAT ADAPT TO YOUR PRODUCTION

The machine calculates, checks and corrects itself, within the limits you set



A conventional CNC program repeats the same values, whatever happens. A parametric program uses variables, calculations and conditions: it adapts to the part, checks what the operator enters, displays its own messages and corrects its dimensions from a measurement. Solutions CNC develops these CNC macros on Fanuc controls (Macro B, Fanuc Picture) for turning and milling, in series production.

These developments have already helped our customers reduce scrap and machine stoppages on high-volume automotive parts. Every program is delivered with comments, its flowchart and the list of its variables, so that your teams can understand it and develop it further.

2026/03/2214:39OP10-M1 AUTO ON HOME Automatic ModeMeasure AUTO COMPENSATION (EXPERT MODE)Part ID 01 Measuring frequency 10 D1 diameter 45.000 D1 measured 45.015 End air blow (sec.) 3.000 Correction coef. 0.85 D1 allowance (R) 0.200 D1 correction 0.012 End spindle rpm 200.000 AFTER A LONG STOP: EXTRA ALLOWANCE Measure Machinestatus Cycletime Partcounter Qualitycheck Setup Machining Tools Diagnostics RESET
Custom-built Fanuc Picture operator screen (reconstruction, fictitious values)

WHAT WE IMPLEMENT

Twelve functions that can be added to your programs, together or separately

Part families

One program for the whole family: you enter a few values and rewrite nothing.

Fast changeoverFewer programs

Built-in calculations

The formulas are in the program: the machine recalculates positions and angles on the actual part.

FormulasRealignment after probing

Automatic compensation

After a measurement or based on statistics, the machine corrects its dimensions within set limits.

SafeguardsAutomatic re-machining

Alerts and alarms

Clear messages, pauses and alarms that tell the operator what to do.

Custom messagesProgrammed pauses

Input checking

Missing, out-of-range or inconsistent value: the cycle does not start.

Error-proofingExplicit alarm

Operator screens

Fanuc Picture screens to read and enter data without opening the program.

Fanuc PictureMode selection

Automatic engraving

Serial number, date or batch engraved and incremented with no manual input.

Serial numberDate and batch

Warm-up cycle

Started after a long stop, with a duration matched to the downtime.

After a stopSafety allowance

Measurement calibration

The probe is calibrated at start-up, then again after a set time.

ProbeConsistency check

Tool management

Sister tools, tool life and offset checks before machining.

Sister toolsOffsets checked

Traceability

Every correction is recorded in the machine with the date and time.

HistoryQuality tracking

Documentation

Commented program, flowchart and list of variables delivered to your teams.

FlowchartTraining

HOW AUTOMATIC COMPENSATION WORKS

An automatic correction, but never without safeguards

Measured dimension, with automatic compensationWithout correction (estimate)
+50+130−1215101520253033 Upper tolerance Lower tolerance Without correction (estimate) Part 1: first pass with extra allowance Automatic re-machining Part number Deviation from target (µm)
Record over 33 consecutive turned parts, using the machine's built-in measuring system. Nominal dimension changed for confidentiality.
33consecutive parts measured
by the machine itself
11 µmof spread across the run,
for a 25 µm tolerance
44 µmof drift compensated
by small corrections

1. Leave extra stock on the first part

After a tool change or a long stop, the first pass deliberately leaves a little material.

2. Measure in the machine

The lathe has a built-in measuring system: the part is measured at several points without leaving the machine.

3. Re-machine if needed

If material remains, the machine repeats the finishing pass on its own to bring the part to size.

4. Correct partially

Only part of the deviation is applied, set by a coefficient, to follow the drift without over-correcting.

5. Check

Measuring points that disagree or a deviation that is too large: the machine stops and displays the cause.

6. Record

Measurements and corrections are stored. Cumulative drift stays under watch throughout the run.

Excerpt from an automatic compensation subprogram after measurement (Fanuc Macro B, variables changed)

O8520                               (AUTO COMPENSATION DIAMETER D1 - 3 POINT MEASURE)
(... EXCERPT ...)

(--- 1. MEASURING FREQUENCY ---)
#540=#540+1                         (PART COUNTER)
IF[#540LT#501]GOTO900               (NO MEASUREMENT ON THIS PART)
#540=0

(--- 2. MEAN DEVIATION AND TAPER OVER 3 POINTS ---)
#1=0                                (SUM OF DEVIATIONS)
#2=-999.                            (MAX DEVIATION)
#3=999.                             (MIN DEVIATION)
#10=1
WHILE[#10LE3]DO1
  #4=#[610+#10]-#502                (POINT DEVIATION = MEASURED - TARGET)
  #[620+#10]=#4
  #1=#1+#4
  IF[#4GT#2]THEN#2=#4
  IF[#4LT#3]THEN#3=#4
  #10=#10+1
END1
#630=#1/3                           (MEAN DEVIATION)
#631=#2-#3                          (TAPER = SPREAD BETWEEN POINTS)
IF[#631GT#506]THEN#3000=21(TAPER OUT OF LIMIT)

(--- 3. CONSISTENCY WITH PREVIOUS MEASUREMENT ---)
#632=#630-#633                      (CHANGE SINCE LAST MEASUREMENT)
#633=#630
IF[ABS[#632]GT#507]THEN#3000=22(SIZE JUMP - CHECK GAUGE)

(--- 4. RE-MACHINING IF STOCK REMAINS ---)
IF[#630LE#508]GOTO400
IF[#550GE#509]THEN#3000=23(TOO MANY RE-MACHININGS)
#550=#550+1                         (RE-MACHINING COUNTER)
#551=#630                           (STOCK TO REMOVE)
GOTO910                             (BACK TO FINISHING CYCLE)
N400
#550=0

(--- 5. COEFFICIENT BY SIZE OF DEVIATION ---)
IF[ABS[#630]LT#510]GOTO800          (NEGLIGIBLE DEVIATION: NOTHING TO DO)
#5=#511                             (SMALL DEVIATION)
IF[ABS[#630]GE#512]THEN#5=#513      (MEDIUM DEVIATION)
IF[ABS[#630]GE#514]THEN#5=#515      (LARGE DEVIATION)
#6=#630*#5                          (CORRECTION TO APPLY)

(--- 6. SAFEGUARDS BEFORE WRITING ---)
IF[ABS[#6]GT#516]THEN#3000=24(CORRECTION TOO LARGE)
IF[ABS[#560-#6]GT#517]THEN#3000=25(CUMULATIVE DRIFT TOO HIGH)
#560=#560-#6                        (CUMULATIVE DRIFT)
#[2000+#518]=#[2000+#518]-#6        (TOOL X WEAR OFFSET)

(--- 7. TRACEABILITY: DATE, TIME, CORRECTION ---)
IF[#570GE#519]THEN#570=0            (ROLLING MEMORY)
#[700+#570]=#3011                   (DATE)
#[701+#570]=#3012                   (TIME)
#[702+#570]=#6                      (CORRECTED VALUE)
#570=#570+3
N800
(... CONTINUED ...)

WHAT YOU GAIN

Direct effects on quality and machine availability

✓

Less scrap

Drift is corrected part after part, before it leaves the tolerance band

⚡

Fewer stoppages

No more stopping the machine to adjust an offset by hand

🛡️

Fewer errors

Inputs are checked and messages say clearly what to do

REAL CASES — SERIES PRODUCTION

Two examples at car manufacturers

Cylinder block — bore machining

Car manufacturer, series production

Machine: machining centres — Fanuc control

Initial problem

  • ✓ Bore position varying from one part to the next
  • ✓ Dimensions drifting over the run
  • ✓ Frequent stops to adjust offsets

Work carried out

  • Realignment formulas calculated by the machine after probing
  • Automatic compensation of dimensions with limits and alarms
  • Automatic stop for CMM inspection after correction
  • Dated record of every correction

Result: less scrap and fewer machine stoppages, with no manual adjustment of offsets.

Turned part — turning with built-in measurement

Car manufacturer, series production

Machine: line of several machines — Fanuc control

Initial problem

  • ✓ Tight diameters to hold across the whole run
  • ✓ First parts at risk after a stop
  • ✓ Machine complex for the operator to run

Work carried out

  • Diameters measured by the lathe's built-in system, then automatic correction of the finishing pass
  • Automatic re-machining when material remains
  • Safety allowance after a long stop or a new tool
  • Tool offset check before machining
  • Operator menu: warm-up, measurement, calibration, rework
Over 90%average OEE on the machine
fitted with automatic compensation
500,000parts produced
per year

Result: an average OEE (overall equipment effectiveness) above 90% on the machine fitted with automatic compensation, with simpler operation and less risk of error.

Want to make a series production more reliable? We also provide programming, training and technical assistance.

FREQUENTLY ASKED QUESTIONS

What you need to know about parametric programming


What is parametric programming?

It is a way of writing a CNC program with variables, calculations and conditions instead of fixed values. The same program adapts to several parts, checks what the operator enters, displays its own messages and can correct its dimensions from a measurement. On Fanuc controls, these are called macros (Macro B).

Can automatic compensation make my parts worse?

No, provided it is properly bounded. Our programs never correct without checks: the correction is capped, an inconsistent measurement is ignored, cumulative drift is monitored, and the machine stops with a clear message asking for an inspection as soon as a limit is reached. Every correction is recorded with the date and time.

Does the machine need special options?

It depends on the machine and on what you want to do: user macros must be enabled on the control, measurement requires a probe or a gauging device connected to the machine, and custom screens require Fanuc Picture. We check these points with you before starting.

Will my team be able to maintain these programs?

Yes. Every development is delivered with comments, a flowchart and the list of variables used. We can also train your setters and process engineers so they are autonomous on day-to-day adjustments.

A program to make safer, more flexible or more autonomous?

Tell us about your part, your machine and your problem. Video call or on-site visit, depending on your needs.

Request a technical discussion