Skip to content

oooargon/line-cut-optimizer

Linear Cutting Stock Optimizer

TypeScript React Next.js Tailwind CSS Electron Capacitor Android iOS jsPDF ExcelJS

English Русский

📋 Abstract

LineCut Optimizer is an application for generating cutting maps and production reports (MES) for steel profiles (beams, pipes, channels, angles, and more), as well as exporting FabTrol (XML) lists for automated nesting in ProNest (version 2021 and above).

The application solves the Cutting Stock Problem (also known as the bin packing problem) - a classic optimization problem in operations research. The problem involves cutting standard-sized stock materials (such as pipes, profiles, rebar, or sheet metal) into pieces of specified sizes while minimizing material waste.

It implements a greedy algorithm with pattern generation to find near-optimal cutting solutions and supports:

  • Multiple stock lengths with quantity constraints
  • Multiple part sizes with required quantities
  • End cut and blade thickness parameters
  • Mark and position tracking for parts
  • Excel file import/export
  • Visual cutting pattern representation

This tool is designed for industrial applications where material waste reduction directly impacts production costs and efficiency.


🔍 Overview

A web-based calculator for optimal linear material cutting (pipes, profiles, rebar, etc.) that solves the cutting stock problem using pattern generation and greedy optimization algorithms.

✨ Features

  • Multiple Stock Management: Define multiple stock lengths with quantity constraints (including unlimited)
  • Part Management: Add parts manually or import from Excel files
  • Mark & Position Tracking: Track part marks and positions for production planning
  • Excel Import/Export: Import cutting lists from Excel and export cutting patterns
  • Visual Cutting Patterns: Interactive visualization of cutting patterns with waste indicators
  • Optimization Parameters: Configure end cuts and blade thickness for accurate calculations
  • Real-time Statistics: View total waste, efficiency, and stock usage

🛠️ Technology Stack

  • Next.js 16 - React framework with App Router
  • TypeScript - Type-safe development
  • Tailwind CSS 4 - Modern styling
  • ExcelJS - Excel file parsing and generation
  • jsPDF - PDF document generation
  • Electron - Desktop application platform
  • Capacitor - Android and iOS (WebView wrapper over static Next.js export)

📦 Installation

npm install

🚀 Development

npm run dev

The application will be available at http://localhost:3000

🏗️ Build for Production

npm run build
npm start

📱 Mobile build (Android)

npm run mobile:apk:debug    # debug APK (after next build + cap sync)
npm run mobile:apk:release  # release APK
npm run mobile:android      # open Android Studio

Output: android/app/build/outputs/apk/debug/app-debug.apk

Multi-platform release artifacts (.exe, .deb, .dmg, .apk, .aab, iOS simulator zip) are published to GitHub Releases on v* tag push.

🖥️ Desktop (Electron)

make                  # Windows portable
npm run electron:linux
npm run electron:mac

📊 File Import / Export Formats

Excel / Blank‑RZ
Standard Excel / Blank‑RZ
Import / export of simple cutting lists and Blank‑RZ templates.
Tekla Structures
Tekla Structures
Import of Tech Cards with automatic profile / fitting parsing.
Advance Steel
Advance Steel
Import of BOM extracts (`.xml`, `.xlsx`) with assemblies and fittings.
PowerFab / FabTrol / ProNest
PowerFab / FabTrol / ProNest
Import of PowerFab/FabTrol orders and export of plate fittings to FabTrol XML for ProNest.

The application supports several import modes and integrations:

  1. Standard Excel:

    • Expects columns:
      • LENGTH - Part length in millimeters
      • QUANTITY - Number of parts required
      • MARK - Optional part mark/identifier
      • POSITION - Optional part position
    • Extensions: .xlsx, .xlsm
  2. Blank‑RZ (Excel template):

    • Imports specifications in the Blank‑RZ format (plates and profiles).
    • Extensions: .xlsx, .xlsm
  3. Tekla Structures:

    • Imports "Technological Map" (Технологическая карта) exports.
    • Extensions: .xlsx
  4. Advance Steel:

    • Imports BOM extracts (XML) or Excel lists.
    • Extensions: .xml, .xlsx
    • Supports hierarchical assemblies (beams/pipes + attached plates) and automatically separates fittings vs mounting elements.
  5. PowerFab / FabTrol / ProNest:

    • Exports plate fittings grouped by steel grade to FabTrol XML pronest-cutting-list.xml for ProNest / PowerFab.

⚙️ Algorithm

The application uses a greedy algorithm with pattern generation:

  1. Generates all possible cutting patterns for each stock length
  2. Selects patterns with minimum waste
  3. Optimizes material usage by iteratively applying best patterns
  4. Tracks individual parts with marks and positions

📖 Usage

  1. Configure Parameters: Set end cut and blade thickness
  2. Add Stock: Define stock lengths and quantities
  3. Add Parts: Manually enter parts or import from Excel
  4. Calculate: Run the optimization algorithm
  5. View Results: Review cutting patterns and statistics
  6. Visualize: Click "Показать раскрой" to see visual cutting patterns
  7. Export: Save results to Excel file or PDF

📁 Project Structure

line-cut-optimizer/
├── app/                        # Next.js App Router entry
│   ├── layout.tsx              # Root layout
│   ├── page.tsx                # Main page (mounts CuttingCalculator)
│   └── globals.css             # Global styles
├── components/                 # React components / UI
│   ├── CuttingCalculator.tsx   # Main calculator + UI logic
│   ├── CuttingVisualization.tsx# Cutting patterns visualization
│   ├── AboutModal.tsx          # In‑app README / license viewer
│   └── TechCardComparison.tsx  # Tekla tech card comparison UI
├── lib/                        # Core domain logic
│   ├── cutting-stock.ts        # Cutting stock algorithm
│   ├── long-part-splitter.ts   # Long parts A/B splitter
│   ├── excel-parser.ts         # Standard Excel / Blank‑RZ parser
│   ├── tekla_tech_card.ts      # Tekla tech card parser
│   ├── advance_steel_parser.ts # Advance Steel XML / Excel parser
│   ├── blank_rz.ts             # Blank‑RZ helpers and weight calc
│   ├── fabtrol_generator.ts    # FabTrol XML export for ProNest/PowerFab
│   ├── tech_card_comparator.ts # Tekla tech card comparison logic
│   ├── pdf-font-loader.ts      # PDF font preloading for jsPDF
│   ├── asset-path.ts           # Asset path helper (web/Electron)
│   └── format-utils.ts         # Mark/label formatting helpers
├── public/                     # Static assets
│   ├── icons/                  # UI icons (Excel, Tekla, ADS, FabTrol, etc.)
│   └── assets/                 # Images and other assets
├── examples/                   # Sample input files
│   ├── advance/                # Advance Steel extracts (XML)
│   ├── blank_rz/               # Blank‑RZ Excel samples
│   └── PowerFab/               # FabTrol / PowerFab examples
├── out/                        # Static export / build artifacts
└── package.json                # Dependencies and scripts

📜 License

MIT

About

LineCut Optimizer is an application for generating cutting maps and production reports (MES) for steel profiles (beams, pipes, channels, angles, and more), as well as exporting FabTrol (XML) lists for automated nesting in ProNest (version 2021 and above)

Resources

License

MIT and 2 other licenses found

Licenses found

MIT
LICENSE.md
Apache-2.0
LICENSE.Apache
MPL-2.0
LICENSE.MPL-2.0

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors