Skip to content

About

Web-based parametric CAD generator for rapid hardware prototyping. Interactively configure mechanical parts (fasteners, bearings, springs, linear motion) and export 3D models or FreeCAD Python scripts directly in your browser.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

ProtoLab 3D

A browser-based library of configurable mechanical products and assembly definitions. Find a component, adjust its dimensions, inspect its 3D preview, organize its physical occurrences in a design project, and bring the generated solid geometry into an existing FreeCAD document.

Open ProtoLab 3D

The application is a static React / TypeScript / Three.js site built with Vite. It runs without a backend and is suitable for GitHub Pages. The interface, generated Python, and source comments are in English.

Generated products retain enterprise designations, executions, revisions and supplier identities in FreeCAD. See ESKD generation for configurable detail families, product structure and Open ESKD exchange.

Run locally

Use Node.js 22 or later.

npm ci
npm run dev

Open the local URL printed by Vite. The default development port is 8080, with the application at http://localhost:8080/.

npm run typecheck
npm test
npm run build
npm run preview

The production output is dist/. Vite uses / as the base for the custom domain https://protolab.defencore.com/. The GitHub Actions Pages workflow builds and uploads this directory; enable Settings → Pages → Source → GitHub Actions and set the custom domain in the repository. Deploying instead to a repository URL such as https://defencore.github.io/ProtoLab-3D/ requires changing the Vite base to /ProtoLab-3D/ before rebuilding.

Working with parts

  • Browse category → subgroup → component, or press / to search names, descriptions, keywords, and preset sizes.
  • Choose a library view by engineering discipline, product type, make or buy policy, or manufacturing process. All views reference the same product definitions.
  • Use Catalog sizes in the configurator for everyday selection. For bolts and screws, choose thread → length → head → drive. Each choice narrows the remaining catalog options and automatically selects a matching part in the 3D preview. Matching product cards, counts and supplier links remain beside the model; clicking a card applies it immediately.
  • Switch to Custom dimensions to enter precise numeric dimensions and fine-tune the geometry.
  • Open Browse presets for advanced searches by designation, standard, manufacturer, supplier SKU or source. Its sidebar keeps the model visible while you filter by category, part type, numeric ranges and shape choices. Clicking a result immediately updates the model and its parameter review.
  • Find matching turns the current part's main dimensions and choices into editable search conditions. Remove individual conditions or widen their From/To ranges. Blank endpoints are unbounded, and both ends of a range are included. Browse all bearing types to compare available bore/outside diameter/width combinations.
  • Choose a sourced catalog preset, a prototype example, or enter your own dimensions. Invalid configurations display an explanation and disable export.
  • Open the single Fasteners & threads → Spacers & standoffs entry for all 4,451 choices: 4,444 supplier articles, four custom-order sleeve templates and three editable plain-spacer designs. Search M3 10 or M3 × 10 mm, or choose ends, thread, body length, shape and material. Catalog lists actual supplier body lengths; Range accepts From/To bounds. Each length mode remembers its separate manual values. The first switch may initialize the alternate mode from a valid explicit exact length; it never uses the selected model or the lower endpoint of a genuine interval. More filters provides construction (including metal inserts), supplier, finish, independent end threads, overall length, diameter/across flats and plain bore. Options show counts under the other active filters; each filter can be cleared separately. Selecting an article preserves your filters and the real product identity. Results load in groups of 24.
  • Each supplier card includes its product link. Choose Custom-order sleeve to request dimensions within DREMEC's published range; selecting a template applies your requested dimensions. The steel default reproduces printed example 324/2.1x10; the other initial dimensions are customer examples. Missing source dimensions and conflicts remain identified in cards/specifications. DREMEC dimensions come from the manufacturer's 2020 catalog, with Ukrainian product-family links; current Ukrainian variations and stock are unconfirmed. See source coverage and verification.
  • Freely rotate, pan, and zoom the preview. X/Y/Z select exact axis views; the 180° button below them switches to the opposite side and back without changing zoom. Use Light background in the preview toolbar to switch between dark and light backgrounds; the choice is remembered in this browser.
  • Switch Simple / Full above the preview to hide or show declared thread detail. Simple is the default for lighter geometry and TechDraw; Full exports actual helical threads where the library defines a pitch and profile. Drawing callouts are retained in both modes. The mode is remembered in this browser and does not change product identity or configured dimensions.
  • Where available, select an assembled/exploded bearing state or a free/loaded spring state. The selected state is used by every export.
  • Save named presets in this browser. Presets use local storage and are not synced to another device.

Copy for FreeCAD puts a one-line exec(...) command on the clipboard. FreeCAD options lets you review the mode, copy the command or download the macro. Code and STL are prepared only when requested. In FreeCAD, open View → Panels → Python console, paste the command, and press Enter. The macro adds a single solid as a Part::Feature, or an assembly as an App::Part containing independently selectable component features. Expand the assembly in the model tree to hide components or change their Placement; moving the parent moves the complete assembly. The macro uses the active document, creates a document if necessary, and wraps creation in a transaction.

Preview and export workers load the selected product and its declared dependencies on demand. Project exports load the configured products and their dependencies. Unrelated model assets are not loaded into those workers.

The main application still loads the catalog at startup. Worker loading and Simple mode reduce subsequent geometry work; the initial catalog download remains large.

The download menu provides:

Format Result
FreeCAD macro (.FCMacro) Standalone Python that constructs OpenCASCADE solid geometry in FreeCAD.
STL (.stl) Binary triangle mesh in Simple mode, without thread relief, with coordinates in millimetres.
Parameters (.json) Part ID, dimensions, model state, format version, and units. This is configuration data, not a CAD model.

For STEP, run the macro in FreeCAD, select the created object, and use File → Export. Use File → Save for an FCStd document. The browser does not run the FreeCAD geometry kernel.

Library and documentation

The library covers mechanical parts, fasteners, motion systems, actuators, electronics, power components, and vehicle structures. Use the category tree or search to select a part. The live library shows the current package count.

Each package's GUIDE.md contains its specific sources, dimensions, and limitations. READMEs describe workflows shared across the project or package system.

Independent part packages

Each product family lives in one folder under src/parts/<part-id>/. That folder contains its classification, configurator, presets, preview, FreeCAD recipe, validation and component-specific helpers. Shared hardware and geometry have one implementation in the documented SDK. Assemblies declare their library dependencies; portable handoffs include the complete dependency closure and run in an isolated workbench.

src/
  App.tsx                       Application state and commands
  components/                   Generic controls, views and React state hooks
    usePresetBrowser.ts         Memoized catalog results, facets and navigation
    requestWorkerOutput.ts      Shared preview/export worker lifecycle
  core/
    types.ts                    Parameter and PartDefinition contracts
    product-types.ts            Product, occurrence and design-project contracts
    product-library.ts          Classification, grouping and specification sections
    design-project.ts           Product structure, manufacturing, procurement and release checks
    part-modules.ts             Versioned package contract and validation
    preset-browser.ts           Scope changes, field presentation and result pagination
    preset-resolution.ts        Source identity and explicit supplier selection
    assembly/                   Shared physical geometry and library instance rendering
    hardware/                   Shared fastener, nut, washer, bearing, gear and spring utilities
    component-recipes.ts         Structured local fabrication geometry and component definitions
    geometry.ts                 Generic mesh primitives
    mechanical.ts               Generic boundary meshes and section construction
    manufacturer-cad.ts         Compressed supplier meshes, placements and native BREP export
    solid-union.ts              Generic mesh boolean operations
    freecad.ts                  Application export wrapper
  parts/
    index.ts                    Generated registry; do not edit manually
    <part-id>/
      index.ts                  Package API version, stable ID, display order and library dependencies
      part.ts                   Definition, geometry, FreeCAD recipe and validation
      configurator.ts           Local configuration metadata
      presets.json              Complete local preset snapshot and source evidence
      product.json              Product type, supply, manufacturing routes and release requirements
      lib/                      Private domain helpers, when needed
      README.md                 Shared package workflow
      GUIDE.md                  Component-specific scope and sources
  catalog/                      Offline supplier inputs and refresh adapters
scripts/
  build/                        Native CAD asset handling and startup dependency report
  parts.ts                      Create, check, export, import and registry tools
  sync-package-catalogs.ts       Explicit offline supplier-to-package refresh

The migrated packages define their numeric and conditional parameter schema in part.ts or a private factory under lib/; their configurator.ts defines ordered Catalog sizes selectors. The new-part template separates its parameter schema and defaults into configurator.ts. Both layouts keep all editable part behavior in the same package. Its README explains the shared workflow; GUIDE.md records component-specific details.

Reusable thread, bearing, spring and gear helpers belong to the shared SDK. Unique component geometry and reference data remain local. Imports into another product package require an explicit library dependency, and dependency cycles are rejected. The boundary checker rejects undeclared package imports and application catalog imports. src/catalog remains an offline data preparation layer; the browser uses each package's presets.json.

Vite discovers added or removed package folders and regenerates the registry. Existing-file edits update the live preview and configurator through hot reload. The application resolves the selected module by ID, applies updated untouched defaults and preserves compatible edits. Removed fields, unsupported values and removed states are reconciled against the new definition. A part's defaultSelection: true metadata chooses the initial selection; only one package may declare it.

See the part package guide for the contract, editing workflow, examples, source metadata and handoff details.

Refreshing supplier presets

Replace <part-id> and <output-folder> in the examples with actual values.

Run the import scripts explicitly when a new offline snapshot is needed. They read public catalog pages and do not interact with carts or accounts. Cached pages allow interrupted imports to resume.

python3 scripts/import-gvyntok-fasteners.py --output test-results/catalog/gvyntok-fasteners.json
python3 scripts/import-gvyntok-hardware.py gajki
python3 scripts/import-gvyntok-hardware.py shajby-koltsa
python3 scripts/import-gvyntok-hardware.py shpilki
python3 scripts/import-gvyntok-hardware.py shplinty-i-strubtsiny
python3 scripts/build-hardware-presets.py
python3 scripts/build-cotter-presets.py
python3 scripts/import-promtehimport.py --workers 2 --output test-results/catalog/promtehimport-inventory.json
node --import tsx scripts/build-promtehimport-presets.ts test-results/catalog/promtehimport-inventory.json
node --import tsx scripts/sync-package-catalogs.ts <part-id> --check
node --import tsx scripts/sync-package-catalogs.ts <part-id>
node --import tsx scripts/report-catalog.ts

The final sync is explicit and scoped to one part. Use --all --check to review every package, then --all to refresh all supported supplier snapshots. --check makes no changes and exits with status 1 when updates are pending. The sync reads existing offline adapter outputs; it never crawls websites. It validates the resulting presets before writing, preserves examples and unrelated sources, and backs up changed snapshots outside src/parts. Refreshing upstream catalog inputs alone does not overwrite an independently edited part package. See catalog refresh behavior.

Review coverage and any source conflicts before accepting refreshed data. The hardware builder transcribes the linked supplier drawings and preserves nominal versus clearance diameters. Models do not infer missing envelope dimensions from price, names or nearby products.

Adding a part

Create a complete starter package:

npm run parts:create -- <part-id> --name "Display name"
npm run parts:check -- <part-id>
npm run dev

The template starts with a working spacer, so its preview and FreeCAD export can be tested immediately. Change its schema, geometry, labels and categories in src/parts/<part-id>/. The package ID stays stable; folder discovery updates the generated registry automatically.

Export an existing part and its SDK to a new folder outside src/parts. The package metadata retains external source links.

npm run parts:export -- <part-id> <output-folder>

The recipient runs npm install, npm run dev and npm run build in that handoff folder. Its workbench shows the part's own controls, presets, states, 3D geometry and generated FreeCAD macro. Return the complete handoff folder with part-module.json intact, then import it into the main project:

npm run parts:import -- <output-folder> --replace
npm run parts:check -- <part-id>
npm run typecheck
npm run build

Import replaces only the selected package and keeps its previous version under ignored test-results/backups/part-modules/. SDK and workbench edits are not imported into the application. Omit --replace for a new part ID. Use external links for source drawings. The registry updates automatically.

Geometry and manufacturing scope

Models record whether their geometry comes from manufacturer CAD, sourced dimensions, an envelope, or a parametric design. Check the selected component's evidence and guide before using it. Solid validity and collision checks do not establish manufacturing tolerances, structural suitability, or product compatibility.

FreeCAD exports create static solids and configuration metadata. Change parameters in ProtoLab and regenerate when a different configuration is needed. Assembly solids can be selected and moved independently; STL exports contain tessellated preview geometry. See the geometry scope reference for family-specific limits.

Verification

npm run parts:check -- <part-id> checks a single package boundary, API, schema, defaults and preset parameters. npm run parts:check checks the complete library. npm test runs offline catalog, geometry, export, and validation checks, without requiring a FreeCAD installation. Each catalog family runs all five original contracts in a fresh Node process, so geometry caches from other families cannot accumulate. Other test files run sequentially. The shared local and CI runner writes real per-job TAP logs and an aggregate manifest.json under test-results/test-runs/; npm test -- --output <new-directory> chooses a report directory. Its source-baseline checks use Python 3's standard library to inspect generated Python syntax; no Python packages are required. python3 -m unittest discover -s tests -p 'test_*.py' checks the Python catalog importers. npm run typecheck and npm run build verify the TypeScript application and production bundle.

The generated recipes are also checked with a local FreeCAD runtime during development. Checks include validity, positive solid volume and agreement with preview dimensions. Gear checks include all defaults/presets; fastener checks exercise head, drive, thread and point variants; spring checks exercise presets, states and end profiles. Runtime checks establish that the recipes execute and produce the intended geometry; they do not establish engineering suitability or exact manufacturer internals. In-memory shape checks do not add objects to user documents. Full macro checks use a temporary document and restore the previously active document.

GitHub Pages deployment follows the official custom workflow documentation. Push to main after enabling the GitHub Actions Pages source to publish. Pull requests run tests and builds without deploying.

Tests for changed elements

Deployment compares the current commit with the latest successful ancestor push on the target branch. Failed and cancelled runs never advance that baseline, so their pending changes remain in the next test plan. Pull requests compare their merge commit against verified target-branch history. If no verified ancestor is available, the complete suite is required.

scripts/ci/test-plan.ts selects changed packages, their dependent assemblies and the test files that exercise them. It follows local imports and declared library dependencies, retains explicit ownership for tests that access the generated registry, and includes referenced fixtures and source assets. Additions, removals and renames are compared against both revisions. The generated registry does not turn every package edit into a full-library geometry run. Per-part geometry contracts retain their existing eight-way assignment and intersect it with the affected part IDs; each selected family executes its complete contracts in an independent process. Global inventory and cross-library integration checks stay intact.

Changes to shared core geometry, runtime dependencies or semantic compiler settings require broader verification. CI-selection changes run the selection regression tests; documentation-only changes do not rebuild unrelated model geometry. TypeScript checks, repository hygiene, language checks and the production build still run on every deployment. Part-package and Python importer checks follow the selected scope. Up to eight test groups run in parallel, and the exact plan is attached to the workflow. Deployment requires every selected test and the build to pass; an empty geometry selection is an explicit skip, never an implicit full-suite invocation.

New pushes cancel stale work. The next run still starts from the last successful baseline and includes all unverified changes. Local npm test runs the complete suite. To request complete CI verification manually, choose Actions → Build and deploy GitHub Pages → Run workflow → full_tests.

Generated exports, reports, screenshots, backups and compiler caches belong under ignored test-results/. npm run check:artifacts checks the actual working tree as well as tracked output paths, so ignoring a misplaced export does not conceal it. Catalogs record provenance and link to external references. Source packages contain the geometry and catalog data used by the application. See the repository hygiene policy.

Mechanism and control audit

npm run audit:parameters -- /tmp/parameter-audit.json checks visible controls through their actual update functions across construction families and inspection states. Unchanged native recipes are review candidates: reference values, material choices and equal-envelope catalog products may legitimately share geometry. See the mechanism audit and native CAD results for corrected mechanisms, catalog-first selection and explicit modeling limits. Each test group runs one child job at a time to limit memory pressure.

Geometry evidence

Each configuration shows whether it uses manufacturer CAD, a reconstruction from source dimensions, an envelope, or a parametric design. The same evidence is preserved in FreeCAD exports. Source-linked dimensions do not certify every surface or internal component. See the whole-library fidelity audit and manufacturer CAD revisions and limitations. Regenerate coverage with npm run audit:models.

Repository conventions

Write documentation, instructions, comments, and interface text in English. Repository text and file names must not contain literal Cyrillic characters. Supplier snapshots and foreign-input parser fixtures preserve exact source strings through Unicode escapes; they are machine evidence, not translated instructions or interface text.

Run npm run check:language before publishing. CI checks repository text and file names, including README scope. Keep README files universal; put component-specific engineering details in separate guides. Follow the library naming conventions for part labels and model identifiers.

About

Web-based parametric CAD generator for rapid hardware prototyping. Interactively configure mechanical parts (fasteners, bearings, springs, linear motion) and export 3D models or FreeCAD Python scripts directly in your browser.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Contributors

Languages