Skip to content

pradhankukiran/bend-form

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BendForm

BendForm logo

Vanilla JavaScript metal-profile configurator with a live SVG cross-section drawing engine.

Last commit Top language Repo size Status Vanilla JS SVG engine No framework Tests

BendForm preview

Overview

BendForm is a browser-based configurator for sheet-metal and profile-style sections. It takes user-entered dimensions, solves the profile geometry, and renders a live technical SVG drawing with labels, bend angles, centerlines, and overall dimensions.

The current version is intentionally frameworkless. It focuses on the core drawing engine, predictable geometry behavior, and a clean repo setup that can be extended into a production quoting or fabrication workflow later.

Highlights

  • Live SVG cross-section preview driven by editable profile dimensions
  • Parametric profile families for equal angle, unequal angle, channel, lipped channel, top hat, and Z section
  • Trigonometric bend handling for non-90-degree geometry
  • Automatic centering and scaling through computed SVG viewBox bounds
  • Toggleable drawing overlays for grid, centerline, segment labels, bend labels, and dimensions
  • Export actions for SVG and JSON configuration snapshots
  • Public-catalogue seed presets for fast demos and regression coverage
  • Localhost-only Node dev server with zero framework dependencies

Tech Stack

  • Vanilla JavaScript modules
  • Native SVG rendering
  • Node.js for local static serving and test execution
  • node:test for geometry regression tests
  • gh CLI for repository metadata and publishing workflows

Quick Start

git clone https://github.com/pradhankukiran/bend-form.git
cd bend-form
npm start

Open http://127.0.0.1:4173.

Scripts

npm start   # start the localhost-only static server
npm run dev # same as start
npm test    # run geometry and rendering regressions

What The App Does

Configures parametric section families

Each profile family exposes the dimensions and bend angles that matter for that section type. Presets seed realistic starting values, and the configurator immediately switches into a custom state when those values are edited.

Solves section geometry

Inputs are treated as outside dimensions. For each segment, the engine solves a neutral-axis centerline length using bend allowances:

centerline = outside length - (t / 2 * tan(theta_start / 2)) - (t / 2 * tan(theta_end / 2))

The centerline is then offset by thickness / 2 to form the rendered section polygon.

Renders a technical SVG

The viewer draws:

  • profile fill and outline
  • optional centerline
  • segment labels
  • bend labels
  • overall width and height callouts
  • thickness callout
  • adaptive background grid

Supported Profiles

Family Purpose
Equal Angle Symmetric L profiles with variable included angle
Unequal Angle Asymmetric L profiles with independent legs
Channel U channels with independent top and bottom bend angles
Lipped Channel Cold-formed channels with lips and four bend controls
Top Hat Hat sections with crown, walls, and flanges
Z Section Offset Z profiles with opposing flanges

Repository Structure

bendform/
├── docs/                # README assets such as logo and preview
├── src/
│   ├── lib/
│   │   ├── geometry.js       # vector math and polygon helpers
│   │   ├── profile-engine.js # parametric strip-section builder
│   │   ├── profiles.js       # profile definitions and presets
│   │   └── render.js         # SVG markup generation
│   └── main.js          # UI state, events, export actions
├── tests/
│   └── profile-engine.test.js
├── index.html
├── server.mjs
└── styles.css

Development Notes

  • The engine currently assumes sharp bends and uniform thickness within a profile.
  • Invalid non-finite inputs are rejected before they reach SVG rendering.
  • Self-intersecting profile results are blocked and surfaced as geometry errors instead of exporting corrupted shapes.
  • Exported SVG uses inline styles from the live drawing engine; font embedding is still a future improvement.

Roadmap

  • Bend-radius aware geometry instead of sharp-corner assumptions
  • DXF or CAD-driven profile ingestion
  • Manufacturing-oriented export fidelity improvements
  • More preset libraries and fabrication-specific profile families
  • Quote-ready metadata and BOM style output

Preset Sources

About

Vanilla JS metal profile configurator with a live SVG cross-section drawing engine.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors