X FlyingShear Library
Cut on the fly, exactly to length: one function block for a carriage that syncs to line speed, cuts and returns.
In short
X FlyingShear Library (ONX FlyingShear) is ONX Control's CODESYS library for cutting continuously running pipe, profile, sheet and wire to length without stopping the line. Its core, the OnxFlyingShearFB function block, synchronizes the carriage that carries the cutter to the line encoder with an EtherCAT servo; the cut profile, length and count, limit calculations, the optimum working stroke and error handling are all in one block. The axis layer is X Motion Library.
Profile calculation and axis control in the bus task, every cycle.
Forward and return ramps are 5th-order polynomials: zero velocity and acceleration at segment boundaries.
Power, homing, jog, line encoder, cutting, limits and error handling.
A full cycle with the same application software, without drive or line.
Cut on the fly instead of stop-and-cut
On stop-and-cut lines the line slows down, stops and accelerates again for every cut. X FlyingShear cuts on the move: the carriage matches line speed, cuts at zero relative speed and returns in time for the next piece.
Non-stop production
Cuts without stopping the line. Cutting follows the measured line position, not time, so length holds even when line speed changes.
Length errors don't accumulate
Line travel carried over from each 1 ms cycle is passed to the next segment. Encoder filtering and length calibration included.
Knows its own limits
Maximum line speed and minimum cut length are calculated live from the recipe; the working stroke is optimised from the measured cut time.
Commission at your desk
A virtual axis and a virtual line let you test the full cycle before the machine is built.
PC-based, no motion card
No separate motion card: CODESYS runs on an industrial PC, servos and I/O share one EtherCAT network.
Clear diagnostics
Bit-coded errors and warnings, a process status text and an operator message that rotates every 2 seconds.
Motion tied to line position, not time
The carriage makes one full cycle each time the line advances by one cut length. The profile is defined on the line position (master, mm), so it scales by itself when the line speed changes and the cut lands at the right point on the material.
Every ramp is a 5th-order polynomial: s(u) = 10u³ − 15u⁴ + 6u⁵. Velocity and acceleration are zero at segment boundaries, so mechanical shock and servo following error are minimal. In every 1 ms cycle the line travel that overshoots one segment is carried into the next, so length errors never accumulate.
- H_A = Par_Araba_Boyu − Par_Baslangic_Offset
- forward sync = H_A · (1 − 2·rİ)
- forward total (line) = H_A · (1 + 2·rİ)
- Lgeri = L − wait − forward total
- k = H_A / (Lgeri · (1 − H_C)), H_C = rG / (0,5 + rG)
| Code | Segment | What happens |
|---|---|---|
| 2 | Forward acceleration | The carriage accelerates from 0 to line speed on an S-curve. At the end the cut length is recorded, count +1. |
| 3 | Forward sync | Carriage at line speed, zero relative speed: the cut happens here (Q_Kesimde = TRUE). |
| 4 | Forward deceleration | The carriage stops; the return is recalculated at the end. |
| 5 | Return acceleration | Accelerates in reverse to k times the line speed. |
| 6 | Return at speed | Constant return speed: k × line speed. |
| 7 | Return deceleration | Stops at the start offset. |
| 8 | Wait | If Par_BeklemeMesafe ≠ 0, waits until that much line has passed; reduces servo load on long pieces. |
How fast can the line run with this recipe?
On site the block calculates two limits every cycle: the carriage must return at the servo's maximum speed in time for the next piece, and the cut must fit into the sync zone. The calculation below uses the block's own formulas; change the values and the result and the profile update instantly.
This is a preliminary estimate. On site the block runs the same formulas live with the filtered line speed and the measured cut time. Torque and acceleration limits for the carriage mass must be checked separately: flying shear servo motor sizing · motor sizing
The block finds the optimum working stroke
With a short stroke the forward sync distance is not enough and the cut does not finish in the sync zone. With a long stroke there is not enough line travel for the return and the servo would exceed its maximum speed. The block calculates the safe range from the cut time measured with a manual cut and picks the start offset inside it; it waits for the new maximum speed and repeats, up to 16 steps, until the offset changes by less than 0.5 mm and the speed by less than 0.05 m/min.
Running in CODESYS
In the sample project the block is in CFC, carriage position and speed are in Trace and the machine is on the WebVisu operator screen: process status, current and cut length, maximum line speed, minimum length, cut and sync time, carriage and plunge axis positions.
Block interface
The block is used with its namespace: fbShear : X_FlyingShear.OnxFlyingShearFB. The EtherCAT master, the servo slave and its connector, the licence code and persistent recipe variables are connected; the block limits and optimises stroke, offset and ramp ratios and writes them back.
Axis and mechanics
Scale from encoder, gearbox and pinion diameter; servo speed limit from the motor's maximum speed.
Line measurement
32-bit line encoder or built-in virtual master; moving-average filter, a separate filter window during the cut, length calibration (0.8–1.2).
Recipe and profile
Cut length, stroke, ramp ratios and wait distance. Start without a crop cut and saw mode.
Commands and sensors
Jog, homing, start position, auto start/stop, manual cut, reset; NC-logic home, limit, emergency and cutter-up inputs.
Process and limits
Cut window, line speed, last cut length, count; maximum line speed, minimum length, cut and sync time, following error.
Status, diagnostics and licence
Run and ready bits, error/warning bit masks, process text, operator message, device key and licence status.
Startup, manual, automatic, error
On an error the carriage stops on the stop ramp, drive power is removed, the profile is reset and enable is dropped. In automatic any warning stops the cycle; if the cutter is down in the cut window, the block waits for the cut to finish.
Drive powered with X_Power; error 4 if not in Operation enabled within 5 s.
Jog, homing, start position, manual cut and cut time measurement. Q_Otomatik_Hazir when there are no warnings.
Calculate → length wait → gear-in → profile. Stopped with the same button, returns to manual via gear-out.
Fix the cause → Komut_Ariza_Reset → enable → Startup → Manual → Home.
Error and warning codes
Q_ErrorID and Q_WarningID are bit masks; Q_Info rotates the active messages every 2 seconds and shows "Hazir" (ready) when there are none. Example: Q_WarningID = 33 → not homed and carriage not at start.
| Bit | Value | Name and meaning |
|---|---|---|
| 0 | 1 | Error_Acil_Stop Emergency stop pressed |
| 1 | 2 | Error_Servo_Takip_Hatasi Following error above Par_TakipHatasiRef |
| 2 | 4 | Error_Drv_Hata Drive fault / enable lost while running |
| 3 | 8 | Error_Araba_Enable Carriage enable removed |
| 4 | 16 | Error_Drv_Runa_Gecmedi Drive not in Operation enabled within 5 s |
| 6 | 64 | Error_ProfilHesap_Hatasi Profile calculation: invalid length, stroke, ratio or offset |
| 7 | 128 | Error_ArabaBoyuHesap_Hatasi Optimum working stroke could not be calculated |
| Bit | Value | Name and meaning |
|---|---|---|
| 0 | 1 | Warning_HomeYok Not homed |
| 1 | 2 | Warning_LimitPosAsti Home/forward limit sensor hit in auto |
| 3 | 8 | Warning_KesimSureAsti Cut did not finish in the sync zone |
| 4 | 16 | Warning_External External system permission lost |
| 5 | 32 | Warning_BaslangicPosError Carriage not at start position |
| 6 | 64 | Warning_MakasPosKontrol Shear/saw not in start position |
Commissioning in five stages
The manual's 24-step checklist is grouped into five stages; the first is done before the machine exists.
-
AAt the desk (virtual)
Libraries installed, block called in the 1 ms EtherCAT task. With Axis_Virtual and Komut_Virtual the profile runs through segments 2→8 and the cut length matches the recipe; licence entered.
-
BDrive and mechanics
Slaves in OP; encoder, gearbox and pinion values entered, a measured jog distance checked with a tape measure. The line encoder's 32-bit count and the NC sensors are verified.
-
CManual motion
Enable, jog, limits, homing and stroke. The following error limit is set to 3–5 times the value measured while jogging.
-
DCutting
Q_Kesimde is wired to the cut command; the cut time is measured with a manual cut and the optimum working stroke is calculated.
-
EAutomatic
Virtual master, then encoder without material; first cut with material, Par_EncoderDuzeltme calibration from measured lengths and stepwise speed increase.
No motion card, one EtherCAT network
Motion control runs in the soft PLC on the industrial PC. Servo, line encoder and remote I/O sit on one EtherCAT network with Distributed Clocks on the same time base.
One source, ONX products






- CODESYS V3.5 (tested with SP22 Patch 3), CODESYS Control runtime, EtherCAT master
- X Motion Library, OSCAT BASIC 3.31, IoDrvEtherCAT
- EtherCAT CiA402 servo for the carriage; rack and pinion with gearbox
- Line encoder with a continuous 32-bit count; home, forward limit, emergency and cutter-up inputs
Device-bound licence, no SoftMotion needed
The library is delivered compiled. Since the carriage axis is driven by X Motion, no CODESYS SoftMotion axis licence is needed; the controller's CODESYS Control runtime licence is enough.
- 1The project is downloaded with an empty licence code; the device key on Onx_Key_Code is read.
- 2The key is sent to ONX and a device-specific BlokCode is issued.
- 3BlokCode is written to a persistent variable; BlokCodeAktif and LicenseStatus show the licence.
- Compiled X_FlyingShear library and device licence
- Working sample project: carriage + saw plunge axis, operator screen
- User and commissioning manual
- Commissioning and cut-test record sheet
The block is motion control software, not a safety function. Emergency stop, guard doors and cutting-zone protection must be provided with a safety relay / safety PLC and STO in the drive.
From our flying saw and flying shear projects
X FlyingShear brings together what ONX Control learned building flying saws and flying shears on pipe, profile and sheet lines into one block.
Best values reached in the field on ONX Control flying shear projects; they were not achieved together on one machine. Achievable speed, tolerance and cycle rate are largely set by the mechanics (carriage mass, stroke, drive train, measuring wheel).
Flying shear and cut-to-length + vision measurement
The length and cut quality of every piece can be measured by camera at the end of the line. The trend of the measured deviation is fed back to the flying shear's cut-length correction, so measuring-wheel slip or wear is caught before parts drift out of tolerance. The servo torque trace of each cut cycle shows the condition of the carriage, blade and drive mechanics for predictive maintenance.
Frequently asked questions
What is X FlyingShear Library?
A flying saw and flying shear library developed by ONX Control for CODESYS. Its core is the OnxFlyingShearFB function block: it synchronizes the cutting carriage to the running line with an EtherCAT servo and cuts the material to length without stopping the line. Axis handling, line measurement, the cut profile, length and count, limit calculations, the optimum working stroke and error handling are all in one block.
Is the same block used for saws, shears and presses?
Yes. The block gives the cut window on its Q_Kesimde output, which is wired as the cut command to a saw's plunge axis, a shear blade or a press valve. With a saw, if Mod_Testere_Kesti is on, the carriage decelerates as soon as the cut is finished and the saw is up, without waiting for the end of the stroke, so the cycle gets shorter.
Which drives and hardware does it work with?
It needs an industrial PC or PLC with the CODESYS Control runtime, an EtherCAT master and an EtherCAT CiA402 servo drive for the carriage axis; v1.0.3 was tested with an Estun ED3L. Line measurement uses a line encoder with a continuous 32-bit count. The axis layer is X Motion Library.
Can it be tested before the machine is built?
Yes. With Axis_Virtual the carriage axis runs without a drive, and with Komut_Virtual the line runs on a built-in virtual master. The full cut cycle, the Q_Kesimde window, stopping and the limit calculations are tried at the desk, so less time is spent on site.
How is the maximum line speed determined?
The block calculates two limits every cycle and outputs the smaller as Q_MaxHatHizi_m_dak: the speed at which the carriage can still return at the servo's maximum speed in time for the next piece, and the speed at which the measured cut time still fits into the sync zone. The shortest length that can be cut at the current line speed is output as Q_MinKesilecekUzunluk.
How does licensing work, is SoftMotion needed?
The library is delivered compiled and protected by X Motion's lock code mechanism: the device key on the Onx_Key_Code output is sent to ONX and a device-specific BlokCode is entered. Since the axis is driven by X Motion, no CODESYS SoftMotion axis licence is needed; a CODESYS Control runtime licence is.
Does it also provide personnel safety?
No. The block is motion control software, not a safety function. Emergency stop, guard doors and cutting-zone protection must be provided in hardware with a safety relay or safety PLC and the drive's STO; the I_Acil_Stop input is only for controlled stopping and error handling.
What is delivered?
The compiled X_FlyingShear library and device licence, a working sample project with carriage and saw plunge axes and an operator screen (WebVisu), the user and commissioning manual, and a commissioning and cut-test record sheet. Motor sizing, retrofit and on-site commissioning are available as services.
Talk to our engineers about your flying shear
For preliminary sizing and an architecture proposal, this is all we need:
In this section
Estun Automation
CODESYS
Crevis
Nexcom / Nexcobot
Leroy-Somer
Servo Systems
AC Drive + Motor
DC Drives
Smart PLC
Panel PC / IPC
Remote I/O