RazorCAD
Chapters

User manual / For Developers

For Developers

Rebuilding the executable

python -m pip install pywebview pyinstaller pillow
build.bat

build.bat bundles app/ (including the 23 MB OpenCascade WebAssembly kernel) and razorcad.py into RazorCAD.exe with PyInstaller. If RazorCAD is open, the running copy is renamed to RazorCAD.old.exe and the new build is used from the next launch.

installer\build_installer.bat builds RazorCAD.exe and then RazorCAD-Setup.exe. Set the version in version.txt first.

Code signing

Both builds sign RazorCAD.exe, the thumbnail DLL and the setup once a code-signing certificate is set up; until then they say "Not signed" and carry on. tools\sign.py --check shows how signing is set up. installer\SIGNING.md explains how to get a certificate and set it up (a certificate on a USB token or in Windows by its thumbprint, a .pfx file, or a cloud signing service).

Regression tests

python tests/run_tests.py

This rebuilds the test parts in tests/parts with the real geometry kernel in headless Microsoft Edge. It compares every body's volume, area, faces and edges (and flat patterns) with tests/expected.json. It also runs checks done as a user does them: sketching, dimensioning and extruding, drawings, assemblies, mates, references, cosmetic threads, inch units, exploded drawing views, balloons and more. It needs Python's playwright package and exits with 1 on any difference. --update stores new expected results, --only runs some of them, and --make-parts makes the test parts again from tests/make_parts.js. See tests/README.md.

Working on the UI

Run python serve.py and open http://localhost:8765/ in a browser. In that mode files are downloaded instead of saved through dialogs. Set the RAZORCAD_DATA_DIR environment variable to keep a test run's recent-files list separate from your own.

Project layout

PathPurpose
RazorCAD.exeThe application (built by build.bat)
razorcad.pyDesktop shell: native window, file dialogs, auto-save (pywebview)
app/js/main.jsApplication controller: documents, commands, selection, files
app/js/ui.jsMenus, Command ribbon, Feature tree, Property panel, dialogs
app/js/model.jsFeature definitions, undo history, materials, sample part
app/js/kernel.worker.jsGeometry kernel worker: replays the history with OpenCascade
app/js/sketcher.js, sketchmodel.js, solver.jsSketch mode, sketch data and the constraint solver
app/js/sketch3d.js, sketch3dmodel.js3D sketches
app/js/sheetmetal.jsSheet metal features and flat patterns
app/js/weldments.js, profiles.jsFast Structure members and the profile tables
app/js/assembly.js, asmview.js, explode.jsAssemblies, their display and exploded views
app/js/drawing*.js, drawtemplates.js, pdf.js, dxf.jsDrawings, templates, sheet formats, PDF and DXF export
app/js/claudespec.jsModelling guide used by Ask Claude
Manual/This manual: source, build script and change tracking