A parametric solid modeller for the ArozOS desktop, following the usual desktop CAD part workflow: 2D sketch -> extrude -> pick a face -> 2D sketch -> extrude, then hole, fillet and chamfer, with STEP, STL and OBJ export for 3D printing. Parts can be put together in assemblies (14.16): placed, moved, turned and scaled by hand, and held by Mate, Flush, Angle, Tangent and Insert constraints. Both can be put on 2D drawings (14.17) for printing: views from any side, dimensions and notes, exported as PDF, DXF, SVG and PNG.
Status: milestones M0 to M6 are built and were tried on a live ArozOS server, with the gaps listed under "Known limits today" in section 2. Assembly mode and drawing mode are built (14.16, 14.17; tried in a browser, not yet on a live server). M7 (touch, localisation, README) and everything after stage 1 is planned in detail in section 14. Section 15 is the handoff for whoever continues. Section 13 holds the owner's answers to the open questions.
Everything below was built and passes node tests/run.mjs and a headless
Chrome walkthrough, but needs a person with a real mouse, a live ArozOS
server or a second browser. Tick an item off (or note what went wrong next
to it) and the next session picks it up from here. Reload with the cache
cleared first (Ctrl+F5): ArozOS sends WebApp files without a cache header,
so a browser can keep old modules after an update (see the last item).
Mouse and view (needs a real mouse)
Watertight meshes and Repair (14.27)
Stable references (14.29)
Sweep, Loft, Draft, Parameters, Material, meshes (14.28)
Part features
Sketcher
Assembly mode (new in this session, see 14.16)
Extrude extents, chamfer types, fillet sets, linear holes, history tools (newest, see 14.26)
Work axes, work points, more work planes (see 14.25)
Offset sketch planes, outlines of round faces, defaults, hiding planes (see 14.24)
Pictures of types, hole section, revolve fix, export sizes, wheel (see 14.23)
Sketch roll back, dashed hidden edges, the Appearance tab (see 14.22)
Missing parts and relative links (see 14.21; needs ArozOS)
Sketch input (see 14.20)
Appearance, previews in every visual style, hidden edges (see 14.19)
Tabs, orbit mark and ribbon (see 14.18)
Drawing mode (see 14.17)
Live server
These three assembly steps were never run by me, because they need ArozOS itself (the static preview has no file selector and no second window):
.aopart, .step, .stp); the chosen part is placed, and placing
the same file again adds a second component of the same part
(Name:2) instead of a second copy of the file..aopart from ArozOS and opens it in a tab
of the same window (it opened a new window before 14.18).[ ] Refresh Parts: after editing and saving a part in another window, Refresh Parts in the assembly shows the change, keeps the constraints on the faces they were put on and solves them again (a hole made larger stays inserted; a deleted face shows its constraint with a warning).
[ ] Drawings on ArozOS: Base View > Model > "Choose a file..." opens the
ArozOS file selector (parts and assemblies); Save / Open of .aodrw;
"Open with 3D Modeler" on an .aodrw; the four exports written to
the folder you pick.
[ ] A title block or note in Chinese (or any non-Latin text) in the PDF: the PDF font only has Latin letters, so such text is drawn by the browser into a small black and white image at about 600 dpi. Check it prints sharp enough.
[ ] "Open with 3D Modeler" on a .step file starts a new part with one
Imported feature; decide whether 3D Viewer should stay the default
opener for STEP (the File Manager setting decides, not the app).
[ ] An .aoasm assembly opens from the File Manager.
[ ] Decide on the cache header: should ArozOS send Cache-Control:
no-cache (with an ETag) for WebApp files, so updated apps are never
stale? It is a server-wide Go change, so it waits for your answer.
[ ] Firefox and Safari have not been tried at all.
| Topic | Decision | Consequence |
|---|---|---|
| Geometry kernel | OpenCascade compiled to WASM, the replicad-opencascadejs build, unmodified |
Real B-rep solids: exact STEP in and out, true fillets, chamfers and booleans |
| App name | 3D Modeler, group Engineering, folder src/web/3D Modeler/ |
Sits next to 3D Viewer in the start menu |
| Sketching | Full geometric constraint solver in stage 1 | Sketches behave like desktop CAD sketches: constraints plus driving dimensions, solved live |
| Interface | Ribbon, light and dark, following the ArozOS theme | One style sheet with colour tokens on body / body.dark |
| Self contained | Every library is vendored inside the app folder | Nothing is loaded from 3D Viewer or any other WebApp, and nothing from a CDN |
Open the app and you get:
js/ribbon.js), so adding a command
is one line. Commands that are not built are greyed and name their milestone
in the status bar when clicked.js/document/document.js, becomes one undo step, and triggers a
rebuild in the worker. The rebuild keeps the shape after each feature, so
only the changed feature and the ones after it are recomputed. A feature
that fails is marked in the browser and the rest is still built.backend/file.agi; a part handed
over by the File Manager is opened at start. Unsaved changes are asked about
before New, Open and closing the window.File > Kernel Self-test runs profile, extrude, boolean cut, fillets, a chamfer, meshing and a STEP export in memory and reports the result in the status bar.
View cube: every face, edge and corner is clickable (26 views), the cells that meet at an edge or corner light up together, and a home button sits beside it.
Model browser nesting: a sketch sits under the feature built from it (collapsed, as in desktop CAD); a sketch nothing uses yet stands on its own and is drawn in the 3D view. Right click offers Edit Sketch on a sketch and on the feature that uses it; double click a sketch to edit it.
The sketcher (M2). Start 2D Sketch creates a sketch feature on the picked plane or planar face and opens it; Edit Sketch reopens an old one. While a sketch is open the left button draws, the middle or right button pans, the wheel zooms and the view cube turns the view.
Model edges in a sketch (M3). A sketch started on a face gets the edges of that face as reference geometry (drawn in amber, held still by the solver). New geometry snaps to it and can be constrained and dimensioned to it, so a line can be made tangent to a hole of the model. Project Geometry adds any other edge, or all edges of a clicked face. Straight edges and circular edges seen face-on can be projected. The constraint tools and Dimension also take a model edge directly, as desktop CAD does: click an edge that is not in the sketch and it is projected on the spot (near its end, the end point is picked) and used for the constraint.
Formulas in every size box: 35/2, (40 - 2*3)/4, 2^3, sqrt(2)*10, pi*12. The typed-size boxes while drawing show the result as you type, the dimension editor and the Extrude distances accept them too. The result is stored, not the formula.
Extrude (M3). The Extrude button opens a property panel laid out like desktop CAD's: Profiles, From, Direction (Default, Flipped, Symmetric, Asymmetric), Distance A (and B), Through All, Boolean (Join, Cut, Intersect, New Solid), OK and Cancel.
Hole, Fillet, Chamfer (M4), each with a property panel like Extrude's.
View and inspect (M5).
Import and export (M6), File > Import / Export.
.step / .stp: opening one
from the File Manager starts a new part with it imported.backend/file.agi (binary files as
hex), so files land in the user's ArozOS drives.Work Plane (the last piece of M3): 3D Model > Plane, pick an origin plane, a planar face or another work plane, then give the distance (type it or drag the arrow; Flip for the other side). The plane is a feature in the history, drawn as a blue sheet, and Start 2D Sketch can pick it. Unlike a sketch on a face, a sketch on a work plane follows it: change the offset and everything built on the plane moves. Deleting a plane asks first and takes what was built on it along.
Checked on a live ArozOS server, in a scratch instance built from this repository:
filelib.isDir raises on a missing path).Known limits today:
BRep_Builder is
missing); import of STL / OBJ meshes and IGES is not built.Both engines were run under Node 20 and in the browser preview before this proposal was written.
| Check | Result |
|---|---|
| Kernel start (WASM compile and init) | 0.1 to 0.2 s once the file is cached |
| 60 x 40 x 20 block, through hole, 4 fillets, 1 chamfer | 120 to 215 ms in total |
| Meshing that part | 22 to 36 ms, 496 triangles |
| STEP export, then re-import of the same file | 78 ms and 99 ms, face count preserved |
| Volume against a hand calculation | 45097.0 mm3, matches |
| Solver: 4 points, 4 lines, 7 constraints | 10 ms, 0 degrees of freedom left, no conflicts |
| Kernel as a module worker with no bundler | works (new Worker(url, { type: "module" })) |
Not yet measured: the first download over a real network (the kernel is 22.9 MB, about 7 MB once gzipped, and ArozOS gzips static files by default), behaviour on a Raspberry Pi class client, and Safari.
In scope:
When creating a new 2D sketch with objects already exists in the scene, do not show the origin XY XZ yellow plane. The user should pick from an existing plane already on the mesh to start editing
- Extrude: join, cut, intersect, new body; one direction, flipped, symmetric, two distances; to a typed distance or through all.
- Hole, fillet and chamfer.
- View tools: orbit, pan, zoom, Look At, Home, view cube, orthographic and perspective, visual styles, half / quarter / three quarter section views.
- Import STEP, BREP, STL, OBJ. Export STEP, STL, OBJ, 3MF, BREP.
- Open and save a native document in the user's ArozOS drives, undo and redo.
Out of scope for stage 1 (see section 11): revolve, sweep, loft, shell, patterns, mirror, assemblies, 2D drawings, a parameter table, threads.
The target is that a desktop CAD user needs no manual for the basic loop.
main thread kernel worker (module worker)
+---------------------------------------+ +------------------------------+
| app.js shell, commands, modes | | worker.js message protocol |
| ribbon.js ribbon from data | | occt.js all OpenCascade |
| viewport.js three.js, picking, views | <--> | calls |
| document/ feature history, undo | RPC | rebuild.js feature replay, |
| sketch/ sketcher + planegcs | | shape cache |
| features/ one panel per feature | | naming.js stable face and |
| io/ open, save, import, export| | edge references |
+---------------------------------------+ +------------------------------+
| ao_module.js (file selector, upload, window title, theme)
v
ArozOS
A boolean or a fillet on a real part can take seconds. In a worker the
viewport keeps orbiting, and a rebuild that became pointless (the user typed a
new value) can be dropped. The single threaded kernel build is used: the multi
threaded one needs SharedArrayBuffer, which needs cross-origin isolation
headers that ArozOS does not send.
All OpenCascade calls stay in js/kernel/occt.js. The bindings do not garbage
collect: every temporary object must be released with .delete(). Keeping the
calls in one file keeps that rule checkable.
The saved document is not a shape. It is the ordered list of what the user did, and the shape is recomputed from it. That is what makes "edit Extrusion1 and everything after follows" possible.
{
"format": "aopart", "version": 1, "units": "mm",
"features": [
{ "id": "f1", "type": "sketch", "name": "Sketch1",
"plane": { "ref": "origin:xy" },
"geometry": [
{ "id": "p1", "type": "point", "x": 0, "y": 0 },
{ "id": "p2", "type": "point", "x": 60, "y": 0 },
{ "id": "l1", "type": "line", "p1": "p1", "p2": "p2" }
],
"constraints": [
{ "id": "c1", "type": "horizontal", "line": "l1" },
{ "id": "d1", "type": "distance", "p1": "p1", "p2": "p2", "value": 60 }
] },
{ "id": "f2", "type": "extrude", "name": "Extrusion1",
"sketch": "f1", "regions": [[30, 10]], "operation": "join",
"extent": { "type": "distance", "value": 20, "direction": "positive" } },
{ "id": "f3", "type": "fillet", "name": "Fillet1",
"edges": [ { "ref": "edge", "from": "f2", "sig": "..." } ], "radius": 5 }
]
}
Rebuild: the worker replays the features in order and keeps the resulting shape after each one, keyed by a hash of that feature and everything before it. Editing feature N reuses the cached shape of N-1 and only recomputes from N on. A feature that fails keeps the last good shape, is marked with a warning in the browser, and the features after it are attempted anyway.
Undo and redo are snapshots of this JSON. It is small, so a snapshot per action is cheap, and the rebuild cache makes going back fast.
"Fillet this edge" must still mean the same edge after an earlier sketch changed. The index of an edge in the shape is not stable. This is the known topological naming problem, and it is the largest technical risk of the project.
Plan for stage 1:
Generated, Modified, IsDeleted; confirmed present
in this build). A face gets a name from its origin: "side face of f2
generated by sketch line l1", "end cap of f2", "f2/l1 modified by f5". An
edge is named by the two faces it lies between.solveChange in js/sketch/solver.js, not a plain solve: each
end of the dimension is held in turn while every other point is held
softly (temporary constraints), and the answer that moves the fewest
points wins; on a tie the end drawn first stays. A plain solve shares the
change out, which moved an edge shared with the shapes beside it and
turned shapes over (owner's report: three rectangles on one bottom line,
shortening one lifted the line). Tests: tests/dimension-change.test.mjs.BRepAlgoAPI_Splitter, present in this build) and each resulting face is a
selectable region. Islands, arcs and overlapping loops come for free.| Feature | Inputs | Kernel calls |
|---|---|---|
| Extrude | sketch regions, operation, extent, direction | BRepPrimAPI_MakePrism, then BRepAlgoAPI_Fuse / Cut / Common |
| Hole | points of a sketch or a face plus two edge distances; simple, counterbore, countersink; depth or through all; flat or 118 deg drill point | profile revolved with BRepPrimAPI_MakeRevol, then BRepAlgoAPI_Cut |
| Fillet | edges (with tangent chain), radius | BRepFilletAPI_MakeFillet |
| Chamfer | edges; distance, two distances, distance and angle | BRepFilletAPI_MakeChamfer |
| Work plane | offset from a plane or planar face | none, it is a coordinate system |
Every feature has the same shape in code: a property panel docked at the left
of the viewport (the usual CAD layout), a live preview drawn while values change,
OK / Cancel, and a kernel function that takes the previous shape and the
feature's JSON. After each boolean ShapeUpgrade_UnifySameDomain merges
coplanar faces so the model does not collect seam lines.
| Format | Import | Export | How |
|---|---|---|---|
STEP .step .stp |
solid, as a base feature | yes | kernel (STEPControl_Reader / Writer) |
BREP .brep |
solid | yes | kernel (BRepTools) |
STL .stl |
reference mesh | yes, binary or ASCII, chosen tolerance | own writer from the kernel mesh; three.js loader for import |
OBJ .obj |
reference mesh | yes | own writer; three.js loader for import |
3MF .3mf |
no | yes | own writer (zip + XML), units and colour kept |
IGES .iges .igs |
later | no | not in this kernel build, see section 11 |
An imported STEP or BREP becomes a base feature that later features build on. An imported STL or OBJ is a triangle mesh, not a solid: in stage 1 it is shown as a reference to model around and cannot be filleted or cut. Export meshes the solid at a tolerance the user picks (coarse, normal, fine, or a typed deviation).
Extension .aopart: one JSON text file holding the feature history of
6.2 (js/document/sample.js is a complete example). It is text on purpose:
the AGI file functions read and write text directly, the file can be diffed
and version controlled, and a part is small because it stores what was done,
not the resulting shape.
Considered and postponed: caching the last built shape in the file (the BREP format is text too, so it would fit as a string) and a preview image for a File Manager thumbnailer. Both only matter once parts get slow to rebuild.
backend/file.agi reads and writes parts with filelib and runs with the
calling user's permissions. Requests are a JSON body, since url-encoded
forms are capped in size.filelib.readFile / writeFile, binary ones
(binary STL, 3MF) hex encoded through readBinaryFile / writeBinaryFile.
That doubles the transfer size of binary files; if it proves too slow for
large meshes it will be raised as a question before anything else is used.ao_module_openFileSelector, which is the desktop's
own dialog and not a backend call.ao_module_setWindowTitle shows the document name and a * when it has
unsaved changes, ao_module_loadInputFiles opens a file passed by the File
Manager, ao_module_onThemeChanged follows the desktop theme. The window's
close button calls the app's ao_module_close, which asks about unsaved
changes first.backend/prefs.agi).applocale.js and a locale/ folder is the last
milestone, once the strings have stopped moving.| Library | Version | Licence | Size | Where |
|---|---|---|---|---|
| three.js | r185 | MIT | 0.78 MB | lib/three/ (core, OrbitControls, the fat line add-ons) |
| replicad-opencascadejs (OpenCascade, single thread build) | 1.2.1 | LGPL-2.1-only | 22.9 MB (about 7 MB gzipped) | lib/occt/ |
planegcs (@salusoft89/planegcs, from FreeCAD) |
1.3.0 | LGPL-2.0-or-later | 0.6 MB | lib/planegcs/ |
Both LGPL libraries are shipped as unmodified upstream files next to their
LICENSE, and are loaded as separate files, never bundled into app code. That
is the same arrangement as the occt-import-js kernel already shipped with 3D
Viewer. The repository's dependency rule (CLAUDE.md rule 3) is written for
go.mod; neither library touches the Go module. Please confirm you are
comfortable with two more LGPL front-end libraries (question 13.5).
The kernel is fetched only when 3D Modeler is opened and is cached by the browser afterwards.
Now:
3D Modeler/
├── init.agi registration (Engineering, opens .aopart)
├── index.html shell, icon sprite, import map
├── PROPOSAL.md this file
├── backend/file.agi read / write .aopart (AGI, filelib)
├── css/style.css layout and theme tokens
├── img/module_icon.svg
├── js/
│ ├── app.js wiring: document -> rebuild -> display, commands
│ ├── ribbon.js ribbon definition and builder
│ ├── viewport.js three.js scene, navigation, picking, selection
│ ├── browser.js model browser tree
│ ├── ui.js menu and in-page dialog
│ ├── expr.js formulas in size boxes
│ ├── features/extrude.js Extrude panel, profile picking, preview
│ ├── document/
│ │ ├── document.js feature list, changes, undo / redo, validation
│ │ └── sample.js sample part, the format's reference
│ ├── io/files.js open / save through AGI, browser fallback
│ ├── kernel/
│ │ ├── client.js promise wrapper around the worker
│ │ ├── worker.js message protocol
│ │ ├── rebuild.js feature replay with a shape cache
│ │ ├── profile.js sketch plane frames
│ │ └── occt.js OpenCascade calls
│ └── sketch/
│ ├── sketcher.js pointer, snapping, solve and store, selection
│ ├── tools.js line, rectangle, circle, arc, point, dimension
│ ├── trim.js trim and extend
│ ├── project.js model edges as reference geometry
│ ├── render.js SVG overlay drawing
│ ├── model.js sketch data, constraints, solver translation
│ ├── geom.js 2D curve maths
│ └── solver.js planegcs wrapper
└── lib/ three, occt, planegcs (each with its LICENSE)
Added by the next milestones: more of js/features/ (one file per feature), js/io/ import and export,
js/kernel/naming.js, locale/, README.md (replaces this file as the
handoff document), img/desktop_icon.png.
Each milestone ends in something you can try.
| Deliverable | Done when | |
|---|---|---|
| M0 | Scaffold: shell, viewport, both engines running. Done. | Kernel self-test passes in the browser |
| M1 | Document and display core: feature history, rebuild with cache, exact faces and edges from the kernel, hover and selection, model browser driven by the document, undo / redo, open / save .aopart in ArozOS, face pick for Start 2D Sketch. Done, except that open / save still has to be tried on a live server. |
A hand written two feature document opens, shows, saves and reopens identically; faces and edges highlight under the cursor |
| M2 | Sketcher on origin planes: line, rectangle, circle, arc, point, construction, snaps and inferred constraints, all stage 1 constraints and dimensions, drag solving, trim and extend, degrees of freedom display. Done, on origin planes and on planar faces. | The profile of your center_plate side wall can be drawn and fully constrained; changing one dimension updates the sketch |
| M3 | Extrude and sketch on face: region picking, join / cut / intersect / new body, extents, projected face edges, offset work plane, edit feature and edit sketch from the browser | The loop sketch, extrude, pick face, sketch, extrude works three levels deep, and editing the first sketch rebuilds the rest |
| M4 | Hole, fillet, chamfer, with stable references (6.3). Done except the stable references: edges are found by position and fail loudly when moved. | Fillets survive an edit of an earlier sketch dimension; a broken reference is reported, not misapplied |
| M5 | View and inspect: section views with caps, all visual styles, Look At face, measure (distance, angle, radius), mass properties and centre of gravity. Done in a first form: fixed section planes, measure as a dialog. | The three section modes of your screenshots work on a real part |
| M6 | Import and export: STEP, BREP, STL, OBJ, 3MF. Done for export of all five and import of STEP. | An exported STEP opens in other CAD software with the same faces; an exported STL slices correctly |
| M7 | Finish: touch and pen input, localisation, README, desktop icon, File Manager opening .aopart |
Review pass on a tablet and in both themes |
Suggested order is as listed. M5 and M6 do not depend on M4 and can move earlier if export matters sooner than fillets.
js/kernel/occt.js and the document code are plain ES modules with no DOM,
so they run under Node. Every feature gets a test that builds a known part
and checks volume, face count and a STEP round trip. This is how the M0
kernel code was checked.Revolve, sweep, loft, shell, draft, rectangular and circular pattern, mirror, work axis and work point, sketch offset / mirror / pattern / text, a parameter table with expressions (the fx of desktop CAD), cosmetic and modelled threads, multi body tools (combine, split), appearance and material per body, IGES import (needs a different kernel build or the import-only kernel of 3D Viewer), DXF sketch import and export, 2D drawings from the hidden line remover that is already in this kernel, assemblies with constraints. Section 14 plans each of these in detail.
| Risk | Effect | Mitigation |
|---|---|---|
| Topological naming (6.3) | Features jump to the wrong edge after an edit | History based names, geometric fallback, fail loudly; own test suite from M4 |
| Kernel download size | Slow first start on a slow link | Fetched once and cached, gzip on by default, progress shown; the rest of the UI is usable while it loads |
| Kernel memory | WASM heap grows over a long session | One file for all kernel calls, strict .delete(), bounded rebuild cache, worker can be restarted and the document replayed |
| Kernel failures | OpenCascade throws without a message on bad input | Every operation is caught per feature; the feature is marked failed, the previous shape is kept |
| Binding API changes | replicad-opencascadejs 1.2.1 changed its binding style from older releases |
Version is pinned and vendored; all calls are behind occt.js |
| Constraint solver on the main thread | A very large sketch could stutter while dragging | Typical sketches solve in milliseconds; move to a worker only if measured |
| Scope | Stage 1 with a full solver is a large build | Milestones are independently usable; M2 is the biggest and can be split (geometry first, then dimensions) |
| Repository size | 23 MB of binaries added to git | One file, changed only on a kernel upgrade |
Use Z up
- Native extension. Is
.aopartacceptable, or do you prefer another name?That is fine
- Mouse mapping. Keep left drag = orbit when nothing is selected, or copy the reference CAD exactly (middle drag pans, Shift + middle or F4 orbits, left only selects)? The second is safer once selection exists, because a left drag can then be a window selection.
copy exactly, and add orbital view controller on the right menu under the cube
- Multiple bodies. Desktop CAD parts can hold several solid bodies ("New Body" in Extrude). Should stage 1 support that, or one body per part?
support single parts, but parts can have isolated sections within them
- Licences. Confirm that two unmodified LGPL front-end libraries (OpenCascade build, planegcs) are acceptable, as with 3D Viewer.
Yes
- File associations. Should 3D Modeler also register as an opener for
.step/.stp(importing them), next to 3D Viewer?Yes
- Imported meshes. Is showing an STL / OBJ as a reference enough for stage 1, or do you need to cut and fillet imported meshes? That needs a mesh to solid conversion and is a separate piece of work.
No need to edit mesh like STL or OBJ
Everything below is planned, not built. It is written so that someone who has not seen the earlier work can implement it: each item says what the user should get, what the document stores, which kernel calls do the work (all checked against this kernel build unless marked "probe first"), which files change, and how to test it. Section 15 says how to work on the code base and in which order to take the items.
Sizes are rough: S = an hour or two, one or two files; M = a day, several files and a test file; L = several days, touches the core.
| # | Item | Size | Why it matters |
|---|---|---|---|
| A1 | Finish checking the last changes (14.2) | S | Three small things were written but not fully tried |
| A2 | Quick wins in the sketcher (14.3) | S each | Daily friction: three point arc, sketch fillet, window selection |
| A3 | Revolve (14.4) | M | The most used feature still missing |
| A4 | Stable references (14.5) | L | Built (14.29): face names by role, projected sketch geometry follows, profiles remember their curves |
| A5 | Shell, Mirror, Patterns (14.6) | M each | The rest of the greyed ribbon buttons |
| A6 | Extrude and Chamfer options (14.7) | S to M | Built (14.26): taper, To, To Next, chamfer types, fillet sets, linear holes, threads |
| A7 | History tools (14.8) | M | Built (14.26): End of Part, reorder, shared sketches, visibility, errors on open, autosave |
| A8 | Parameters, "fx" (14.9) | M to L | Built in part (14.28): table, names in every size box, kept formulas on sketch dimensions and extrusion distances |
| A9 | View and inspect (14.10) | S to M | Built in part (14.28): material and mass, F5 / F6; sections, measure line, thick edges were done before |
| A10 | Exchange (14.11) | S to M | Built (14.28): STL / OBJ as reference meshes, ASCII STL, inches |
| A11 | M7: touch, localisation, README (14.12) | M | Release polish |
| A12 | Work axes, points, more planes (14.13) | S to M | Built (14.25): axes, points, six kinds of plane; used by Revolve, Circular Pattern, Mirror |
| A13 | Sweep, Loft, Draft (14.14) | M each | Built (14.28) |
| A14 | Later stages (14.15) | L | Threads, text, sheet metal |
| A17 | Watertight meshes, Repair (14.27) | M | Built: the cracked / non-manifold extrusions fixed, zero thickness refused, Check Geometry, Repair feature |
| A15 | Assembly mode (14.16) | L | Built: placing parts, constraints, move rotate scale, section, measure, interference |
| A16 | Drawing mode (14.17) | L | Built: base, projected and face views, dimensions and notes, sheet setup, PDF / DXF / SVG / PNG |
Suggested order: A1, A2, A3, A12 (axis part), A5, A6, A7, then A4 (the large one, once the feature set is wide enough to test it against), A9, A10, A8, A11, A13. A4 can be moved earlier if models with many edits are the main use; nothing else depends on it.
These were implemented and pass the Node tests; the first two were only partly tried in a browser.
js/viewport.js, js/app.js). Written: left button
only selects and draws; middle drag pans; Shift + middle orbits (three.js
OrbitControls swaps pan and rotate on Shift); wheel zooms to the cursor;
Orbit and Pan buttons under the view cube lend the left button to the
view; F4 held does the same for orbit; Esc gives it back. Tried: the
two buttons toggle and show their state. Not tried, needs a real
mouse: middle drag, Shift + middle, F4 held and released, and that a
sketch tool does nothing while Orbit is on (sketcher asks
viewport.isNavigating()). Also still missing from the reference CAD's set:
F2 + drag pan, F3 + drag zoom, F5 previous view, F6 home view, double
click on the middle button = Zoom All, and a right click menu in the view
(Repeat last command, Done, Zoom All, Home View).init.agi now lists .step and
.stp; js/app.js start-up imports the file into a new part). Needs a
live server: open a .step from the File Manager with "Open with", expect
a new part named after the file with one "Imported1" feature. Check that
3D Viewer is still the default opener if that is what the owner wants
(the File Manager's default-opener setting decides, not this app).isSound() in
js/kernel/occt.js). Covered by tests/chamfer-after-fillet.test.mjs.
In the app, the panel should show "does not fit on these edges" and keep
OK disabled; a part that already contains such a feature should show it
failed in the browser instead of a broken solid. Worth one manual look.All of these live in js/sketch/. A tool is one function in tools.js
(copy circleTool); geometry helpers go in geom.js; anything that edits
the sketch data goes through the helpers of model.js. Add cases to
tests/sketch.test.mjs for the pure parts.
Done in the last session (owner: "continue next phase"): three point arc
and tangent arc (the Arc button is now a drop-down), sketch fillet and
chamfer of line corners, window selection in the sketch, F8 / F9,
Concentric, and the softer failure of automatic constraints. Tests:
tests/sketch-tools.test.mjs. Found on the way: a Tangent between two
curves that share an end point was a double root for the solver (it called
the tangency redundant and left the join free to slide); such a tangent now
maps to planegcs angle_via_point at the shared point (0 or pi, as drawn),
which is how FreeCAD does it. Then, in a later session: Polygon (a
construction circle through the corners, all sides equal), Slot (two half
circles and two lines tangent at the joins, equal radii) and sketch Mirror
(each copied point tied to its original by a symmetric constraint about
the mirror line, so the copy follows; a circle also gets an equal radius;
curves selected before the tool are taken; Enter goes from picking curves
to picking the line). Driven dimensions are done too: a
dimension that would over-constrain the sketch is kept as a driven one
(driven: true, left out of the solver, its value refreshed by
applySolution, drawn in brackets, not editable). Still open from this
list: typed angle (needs the sketch X axis as a fixed reference for the
solver), offset, sketch pattern, window selection in the model view,
ellipse and spline, text.
Three point arc (done). Clicks: start, end, a point on the arc. Centre =
circumcentre of the three points (reject if collinear within 1e-9). The
stored arc is always counter clockwise from start to end, so swap the
two when the third point lies on the clockwise side (sign of the cross
product of start->end and start->third). Make it the default of the Arc
button with the present centre point arc in a small drop-down (the ribbon
supports menu), as in desktop CAD.
Tangent arc (done). Start on the end point of an existing line or arc; the
centre lies on the normal to that curve through the point; the end is the
cursor. Add a tangent constraint between the two curves on commit.
Sketch fillet and chamfer (done for two lines). This kernel build has no 2D fillet
(BRepFilletAPI_MakeFillet2d and ChFi2d_FilletAPI are absent), so do it
in JavaScript. For two lines meeting at a shared point P with directions
d1, d2 and angle t between them: tangent points are P + d1 * r / tan(t / 2)
and P + d2 * r / tan(t / 2); the centre is on the bisector at
r / sin(t / 2). Edit: give each line its own new end point at its tangent
point (the old shared point is dropped if nothing else uses it, or kept as
a construction corner when dimensions hang on it), add the arc, add two
tangent constraints and a radius dimension. A second fillet with the
same radius gets an equal to the first instead of its own dimension, as
desktop CAD does. Chamfer: same with a line instead of the arc and two
distance dimensions. Line-arc and arc-arc corners can come later.
Window selection (done in the sketch; the model view is open). In the Select tool, a left drag that starts on
nothing draws a rectangle: dragged left to right it selects what is fully
inside, right to left what it touches. The sketcher already keeps the
screen position of everything it drew (cache in sketcher.js: points,
curve polylines, dimension and glyph boxes), so this is a rectangle test.
Draw the rectangle in the overlay through preview. Do the same in the
model view for faces and edges (js/viewport.js: project each edge's
segment ends with project()).
Typed angle (S). While drawing a line, a second size box "Angle" (Tab
switches, as the rectangle already does) fixes the direction; commit adds an
angle dimension against the X axis. The X axis needs to exist as geometry
for that: add two fixed construction reference lines through the origin to
toPrimitives() (ids $x and $y), which also lets users constrain to
the sketch axes.
Driven dimensions (S). When a dimension would over-constrain the sketch,
ask "Create a driven dimension instead?" with ask(). Stored as
driven: true, sent to the solver with driving: false, drawn in brackets,
and its value refreshed from measure() after every solve.
Softer failure of automatic constraints (done). In commit() of
sketcher.js: when the solve fails and the edit was not strict, remove
the constraints added since the last store (the same set the redundancy
code already computes) and solve again before refusing the whole stroke.
Constraint display (done, keys only). F8 shows and F9 hides the glyphs; a status bar toggle "Show constraints". The renderer already draws them from one list.
Concentric (done). Two circles or arcs share a centre: a coincident
between their centre points; the button is sugar over build().
Polygon and slot (S each). Compositions of existing geometry with
constraints: a slot is two lines, two arcs, four tangent, one equal
between the arcs, one parallel.
Offset (M). Use the kernel rather than writing 2D offsetting: a worker
operation that builds the wire of the picked chain (curveEdge per curve,
BRepBuilderAPI_MakeWire), runs
new oc.BRepOffsetAPI_MakeOffset(wire, oc.GeomAbs_JoinType.GeomAbs_Arc)
then Perform(distance), and returns the resulting edges as line / circle
records exactly like discretize() already does for model edges. The
sketcher adds them as normal geometry plus one pldistance dimension
between the first source line and its copy. Not associative beyond that
dimension; say so in the prompt.
Mirror and pattern in the sketch (M). Mirror: copy the picked geometry
across a line and tie every point pair with a symmetric constraint (the
solver supports it), which keeps the copy associative. Rectangular and
circular pattern: plain copies in a first version.
Ellipse and spline (L, later). The solver supports both. Needs: new
geometry types in model.js (and in toPrimitives), sampling, nearest
point and intersection in geom.js, an edge builder in occt.js
(gp_Elips is present; splines through GeomAPI_Interpolate, which needs
an NCollection_HArray1_gp_Pnt; probe that it can be filled), and
projection of elliptical model edges.
Text (later). There is no font support in this kernel build; it would
need a font outline library vendored in lib/ and its glyph outlines
turned into sketch curves.
Done. revolveTool / revolve in occt.js (full turn or angle in
the four directions, a profile across the axis is refused), the panel in
js/features/revolve.js on panel.js, the profile picking shared with
Extrude in js/features/profiles.js, axis picking with
viewport.setAxes (lines of the profile's sketch and the origin axes in
its plane; a single construction line is taken by itself). Tests:
tests/revolve.test.mjs (Pappus volumes, directions, origin axis, a cut).
Not done: rebuilding the Extrude panel itself on panel.js (it keeps its
own markup, only the profile part moved), and an angle arrow to drag.
What the user gets. 3D Model > Revolve: pick profiles exactly as in Extrude, pick the axis (a line of the same sketch, usually a construction or centre line; later a work axis), choose Full or Angle with the same four directions as Extrude, and Join / Cut / Intersect / New Solid. Live preview.
Document.
{ "id": "f7", "type": "revolve", "name": "Revolution1",
"sketch": "f6", "regions": [[12, 4]],
"axis": { "curve": "l3" },
"operation": "join",
"extent": { "type": "full" } }
extent may also be { "type": "angle", "value": 90, "direction":
"positive" | "negative" | "symmetric" | "asymmetric", "value2": 30 }
(degrees). Add revolve: 'Revolution' to TYPE_NAMES in document.js.
Kernel (occt.js): revolveTool(oc, bodies, feature, sketch) and
revolve(...), modelled on extrudeTool / extrude.
sketchRegions() filtered with inRegion(), as Extrude.toWorld(frame, u, v),
new oc.gp_Ax1(point, new oc.gp_Dir(vector)).new oc.BRepPrimAPI_MakeRevol(face, axis, false) for a full turn,
new oc.BRepPrimAPI_MakeRevol(face, axis, radians, false) for an angle
(both overloads exist). For "negative" reverse the axis direction; for
"symmetric" first turn the face back by half the angle
(gp_Trsf.SetRotation(axis, -a / 2) + BRepBuilderAPI_Transform), for
"asymmetric" back by value2 and sweep value + value2.isSound(): a profile that crosses the axis gives
a self-intersecting solid that the kernel reports as done.rebuild.js: add case 'revolve'. worker.js: make the preview
operation dispatch on feature.type.Interface. Do not copy extrude.js. First move its profile handling
(loading regions of the free sketches, painting them with
viewport.setRegions, pick and drop, "one feature uses one sketch") into
js/features/profiles.js, and rebuild the Extrude panel on panel.js
(it predates that helper). Then js/features/revolve.js is small.
Axis picking needs sketch curves that can be picked in the 3D view, which
does not exist yet: extend viewport.setSketches so each curve is its own
object carrying { sketch, id }, and add startCurvePick(filter, handler)
beside startPlanePick (hover highlight, click returns the id). Only
straight curves qualify. When the sketch has exactly one construction
line, pick it automatically, as desktop CAD does with a centre line.
Tests (tests/kernel.test.mjs or a new file): a rectangle revolved a
full turn about a line at distance R gives volume 2 * pi * Rc * A (Pappus);
90 degrees gives a quarter of that; symmetric spans both sides (check the
bounding box); a profile crossing the axis is reported, not built.
A first step is done, found necessary while building a part through the interface (making a boss taller broke the chamfer on its top edge; making the plate thicker left the mounting holes sketched on its top short of the new top, silently):
{ body, mid, length } and gains sig
(edgeSignature in occt.js): the curve (line direction, or circle
radius and axis), the surfaces of its two faces (plane normal, cylinder
radius, axis and in / out) and whether it is an outside corner, found
with a point stepped off the edge and the distance tool's inside test
(isInside: BRepExtrema_DistShapeShape.InnerSolution(), per solid,
since it says nothing for a compound). findEdges tries the position
first, then the edge with the same description nearest to the old
position. Fillet and Chamfer store descriptions on OK (worker operation
edgeRefs), and Edit Feature re-selects the edges where they are now.
Tests: tests/references.test.mjs.face: { normal, point } (the point clicked). followFace in occt.js
finds the planar face with that normal on which the point, moved along
the normal, lands; rebuild.js does this in feature order and tells
profile.js (resolveFace), and the rebuild result carries frames so
the app does the same (takeFaceFrames). Tests:
tests/followface.test.mjs.What this does not cover, and what the naming design below would: faces that turn or move sideways, projected sketch geometry (phase C), and a face split in two (the point decides). Old documents keep working by position.
The problem today. Three things are remembered by where they were, not by what they are:
{ body, mid, length }, matched by
findEdges() in occt.js;plane: { ref: "face", frame };ref: true.So after an upstream edit a fillet fails ("an edge ... is no longer there"), a sketch on a face stays where the face used to be, and projected edges go stale. Failing loudly is correct, but desktop CAD users expect all three to follow.
What the kernel offers. Checked in this build: IsSame() on shapes;
Generated(), Modified(), IsDeleted() on every builder (prism, boolean,
fillet); FirstShape() / LastShape() on prism and revolve;
NbContours(), NbEdges(i), Edge(i, j), NewFaces(i) on the fillet
maker. Not available: BRepTools_History (so the history of
ShapeUpgrade_UnifySameDomain, which boolean() runs after every
operation, cannot be read), any shape map or hash (TopExp,
TopTools_*, HashCode are absent), TopoDS_Iterator, solid and face
classifiers. The lists returned by Generated() / Modified() only expose
First(), Last() and RemoveFirst() in the type definitions; whether
Extent() or IsEmpty() of the base class can be called must be probed
first in Node. Do not build the design on reading those lists.
Design: name faces by role, find them by the surface they lie on. This
needs only IsSame, BRepAdaptor_Surface and BRepExtrema_DistShapeShape,
all of which are in use already.
f2: f2/start, f2/end (the caps; with several regions
f2/end:0, f2/end:1 in the order of feature.regions), and
f2/side:<curve id> for the face swept by sketch curve <curve id>.side:<curve id>; start / end only when
the angle is not full.f6: f6/wall:<point id>, f6/bottom:<point id>,
f6/cbore:<point id>, f6/cboreface:<point id>, f6/csink:<point id>.f5: f5/round:<k> for the faces made along the
k-th picked edge (the fillet maker's contour functions say which new
faces belong to which picked edge; for a chamfer, assign each new face
to the nearest picked edge).f1: f1/face:<n> in the file's own face order.IsSame as a face of the body before the feature: keep that name;BRepExtrema_DistShapeShape with a vertex from
BRepBuilderAPI_MakeVertex). "Same surface" is decided from
BRepAdaptor_Surface: for a plane the normal and the offset, for a
cylinder axis and radius (Cylinder() on the adaptor: probe first, it
is inherited the way Plane() is), else the surface type plus a few
sample points. Group the candidates by a rounded key of those numbers
first, so each new face is only compared with a handful.f<id>/new:<n> ordered by the
coordinates of its centre, so at least it is repeatable.
When one old face is cut into several, they all inherit its name. That
is fine: see 4.rebuild.js, next to
bodies: names: [[...one name per face, in face order]] per body.
describe() takes that list and adds name to each face record, and to
each edge the pair of names of the two faces it lies between (found by
which faces list the edge; describe() already walks faces then edges).{ name, hint } where hint is
today's position record (mid and length for an edge, centre and area
for a face). Resolution: collect what carries the name; one match is the
answer (this is what makes it follow the model); several matches are
settled by the hint; no match falls back to the hint alone, exactly as
findEdges() works today; if that fails too, fail loudly as now. Old
documents without name keep working through the fallback.plane: { ref: "face", name, frame }. The worker
resolves it while replaying (the face named name in the body before
the sketch feature, its plane turned into a frame by the same rule as
faceFrame() in app.js) and returns the resolved frames with the
rebuild result (sketchFrames: { <sketch id>: frame }). The main thread
keeps that table and planeFrame() uses it, the way a work plane is
already looked up; the stored frame is the fallback, with a warning
mark on the sketch in the browser when it had to be used.ref: true curve stores
source: { edge: [nameA, nameB], hint }. After a rebuild, the main
thread compares the stored coordinates with the edge as it is now; when
they differ it re-projects, solves the sketch without opening it
(js/sketch/solver.js has no DOM in it and can be called directly),
stores the result without an undo step, and rebuilds once more. Guard
against a loop with a pass counter.Phases, each shippable: (A) names in the rebuild and in describe(),
fillet, chamfer and hole references use them; (B) sketches on faces follow;
(C) projected geometry follows.
Tests (a new tests/references.test.mjs): fillet the top outline of a
plate, change the extrusion distance, the fillet still builds and the
volume matches; add a boss on the top face, change the plate thickness,
the boss sketch frame moved with the face; delete the sketch curve whose
side face was filleted, the fillet reports the missing edge; a document
saved before names existed still rebuilds identically.
Cost to watch. Naming adds surface comparisons to every feature. Keep it out of the way of the cache: names are computed once per cache entry, not per rebuild.
Done. Shell (shell in occt.js, MakeThickSolidByJoin with the
Intersection join so outer corners stay sharp as in desktop CAD; a result
whose volume did not change is refused, which is how walls too thick come
back; panel js/features/shell.js; faces picked in the model and kept as
{ body, centre, area, sig } with findFaces, so an edit upstream does
not lose them; tests tests/shell.test.mjs). Rectangular and circular
patterns and Mirror (placements, patternTools, pattern in
occt.js; one panel js/features/pattern.js for the three; features are
picked in the browser while the panel is open, a sketch standing for the
feature built from it; directions, axes and planes from the origin or
picked in the model, stored as numbers; a mirror with no feature mirrors
the whole solid; deleting a repeated feature takes the pattern along;
tests tests/pattern.test.mjs). Not done: direction references that
follow edits, a preview that says when copies miss the solid, and
patterns of fillets.
These need face references, which do not exist yet. Until 14.5 is done,
make one by position, like an edge: describe() adds centre to every face
(the centre of mass from the GProp_GProps it already computes for the
area), and findFaces() matches centre and area with the tolerance used by
findEdges(). The viewport already picks faces; setPickFilter({ faces:
true, toggle: true }) limits picking to them.
Shell (M). Pick the faces to remove, give the wall thickness, Inside /
Outside. Document: { type: "shell", faces: [faceRef], thickness: 2,
direction: "inside" }. Kernel: const m = new
oc.BRepOffsetAPI_MakeThickSolid(); m.MakeThickSolidByJoin(body, new
oc.NCollection_List_TopoDS_Shape(faces), -thickness, 1e-3, ...) (negative
goes inwards; the later arguments have defaults: probe which can be left
out), m.Build(), m.Shape(), then isSound(). Live preview with
viewport.setPreview(meshes, 'result') as fillet does. Typical failure: a
thickness larger than the smallest fillet radius; report it.
Mirror (M). Mirror the whole solid, or chosen features, across a plane
(origin plane, work plane or planar face). Document: { type: "mirror",
source: { kind: "body" } | { kind: "features", ids: [...] }, plane:
<plane reference>, operation: "join" | "new" }. Kernel: gp_Trsf.SetMirror(
new oc.gp_Ax2(point, normal)) and new oc.BRepBuilderAPI_Transform(shape,
trsf, true, false).
Rectangular and Circular Pattern (M). Document: { type: "pattern",
kind: "rect", source, dir1: <direction reference>, count1: 4, spacing1: 12,
dir2, count2, spacing2 } and { kind: "circ", source, axis: <axis
reference>, count: 6, angle: 360 }. Kernel: gp_Trsf.SetTranslation /
SetRotation(axis, k * angle / count) and BRepBuilderAPI_Transform. A
direction reference is a straight model edge (its curve record gives the
two ends) or an origin axis, with a Flip box; an axis reference is a work
axis (14.13), an origin axis, or a cylindrical face (add axis and
radius to the face record for cylinders).
Patterning features, not just bodies. For source.kind: "features",
do not copy faces. Recompute the tool of each listed feature
(extrudeTool, holeTool, revolveTool already return it), transform the
tool, fuse all copies into one tool, and apply the feature's own boolean
once. That is fast and robust, and it is why the feature functions are
split into "tool" and "apply". Fillets and chamfers cannot be patterned
this way; say so in the panel. Cap the count (200) to keep a typo from
freezing the worker.
Tests: shell of a box of known size gives outer volume minus inner volume; mirror of an off-centre boss doubles its volume contribution; a 3 x 2 pattern of a through hole removes six cylinders.
Built; what was done and where it differs is in 14.26.
Taper (M). extent.taper in degrees. This build has no draft prism
(LocOpe_DPrism, BRepFeat are absent). Build the prism as now, then
draft its side faces: const d = new oc.BRepOffsetAPI_DraftAngle(prism),
d.Add(sideFace, new oc.gp_Dir(normal), radians, sketchPlane) for every
side face (the faces that are neither the start nor the end cap), Build,
Shape, isSound(). Negative angles widen.
To (M). extent: { type: "to", face: <face reference> }. When the
target is a plane parallel to the sketch, it is simply a distance. In
general: sweep as far as reach() gives, then cut the tool with the half
space beyond the target: new oc.BRepPrimAPI_MakeHalfSpace(targetFace,
pointOnTheFarSide).
To Next (M). Sweep as far as reach(), cut that prism by the body with
BRepAlgoAPI_Splitter (arguments: the prism; tools: the body), and keep the
piece that touches the profile: the one at zero distance from a vertex put
a hair in front of the profile's inside point (BRepExtrema_DistShapeShape;
there is no solid classifier in this build).
Chamfer with two distances, or distance and angle (S). The maker has
Add(d1, d2, edge, face) and AddDA(distance, angle, edge, face); face
is the one d1 is measured on. Find the two faces of an edge by walking
the body's faces and their edges with IsSame (there is no ancestor map).
Store mode: "equal" | "two" | "angle", distance2, angle and flip
(which of the two faces, ordered by their centres, is the reference).
Variable or multi-radius fillet (later). One feature with several edge
sets, each with its own radius: { sets: [{ edges, radius }] }.
Hole placed without a sketch (M). The usual "Linear" placement: click a
face, then two edges and their distances. Implement as sugar: create the
sketch on the face, a point, and two pldistance dimensions to the
projected edges, then open the Hole panel on it.
Threads (S for the note). Cosmetic only: thread: { designation:
"M6x1", depth } on a hole, shown in the browser and in Mass Properties as
text. A modelled helix is a later stage.
Built; what was done and where it differs is in 14.26.
End of Part marker (M). The row exists but does nothing. Make it
draggable in the browser; doc.data().end holds the id of the last active
feature. rebuild.js treats everything after it as not there (reuse the
upto path); new features are inserted at the marker, not appended.
Roll back while editing a sketch (S). openSketch() in app.js should
show the model as it was before the sketch, the way feature panels already
do with kernel.call('rebuild', { document, upto }).
Reorder (M). Drag a feature row. Allowed only when everything it needs
still comes before it (its sketch, the work plane of that sketch) and
everything that needs it still comes after. Add doc.move(id, beforeId)
with that check and a test.
Shared sketches (S). Right click a used sketch > Share Sketch sets
shared: true; it is then drawn in the model again and offered as a
profile source. The browser shows it under every feature that uses it.
Visibility (S). An eye toggle on sketches, work planes and bodies:
hidden: true. It must not cause a rebuild: remove hidden in
geometryKey() of rebuild.js the way name already is.
Feature errors on open (S). When a part is opened and features fail, list them in a dialog instead of only marking them in the tree.
Unsaved-work safety (S). Keep an autosave of the document text in
localStorage (or through an AGI script in the user's tmp:/) every few
changes, and offer to restore it on start after a crash.
Today a formula is evaluated when typed and only the number is stored
(js/expr.js).
parameters: [{ name: "wall", expr: "2.4", value: 2.4 }],
and every size gains an optional expr next to its value (sketch
dimensions, extrude distances, radii, hole sizes, pattern counts).evaluate(text, scope) with names looked up in scope;
parameters are evaluated in dependency order; a cycle is an error on the
parameter, not a crash.expr, then every sketch
whose dimensions changed has to be solved again without being open.
That is the same "solve a sketch headless" step 14.5 phase C needs:
write it once (js/sketch/headless.js: load the feature into the solver,
solve, write the geometry back).d3 = wall * 2 when a status bar toggle asks
for it. Each dimension also gets an automatic name (d0, d1, ...) so
it can be used in another formula, as in desktop CAD.Movable section planes (M). Section state { mode, planes: [{ normal,
offset }] } kept in the view, not in the document. Add "pick the cutting
plane" (origin plane, work plane or face, through startPlanePick) and a
drag handle (reuse viewport.setArrow) for the offset. A second small
panel shows the offset as a size box.
Measure in the view (S). BRepExtrema_DistShapeShape also returns the
two closest points (PointOnShape1(1), PointOnShape2(1)): return them
from the distance operation and draw a dimension line with a label,
projected like sketch dimensions. Add angle between two edges, radius of a
circular edge or cylindrical face, and running totals for several picks.
Vertices (S). describe() returns the unique vertices; the viewport
draws nothing for them but lets the pointer snap to them. Needed for
measuring between points, work points, and projecting a point into a
sketch.
Thick highlighted edges (done). LineSegments2,
LineSegmentsGeometry and LineMaterial of three.js 0.185.0 (the same
release as lib/three/, copied unmodified from the npm package) are in
lib/three/addons/lines/ and draw the hover and selection overlays only.
Their resolution follows the canvas in resize().
More visual styles (S). Realistic (an environment map: 3D Viewer
ships RoomEnvironment.js of the same three.js release; copy it, do not
link to it), Monochrome, Wireframe with Hidden Edges.
Appearance and material (S). A colour per part in the document, and a material with a density so Mass Properties can state the mass.
Look At a face, previous view (S). Look At should accept a face (it asks for a plane today and a face in a part with solids); keep a short stack of camera states for F5.
STL and OBJ as a reference (M). The owner does not need to edit meshes
(13.7), only to see them. A feature { type: "mesh", name, format, source,
data } that the kernel ignores (applyFeature returns the bodies
unchanged) and the viewport draws as a pale, non-pickable mesh
(viewport.setMeshes). Small parsers for binary and ASCII STL and for OBJ
belong in js/io/exchange.js with tests; read binary files through the
readBinary operation of backend/file.agi. Store data compactly
(base64 of a Float32 buffer), and warn above a few megabytes because it
lives inside the part file. Excluded from export and Mass Properties.
Export options (S). ASCII STL; export one chosen solid; a unit choice (mm or inch) applied as a scale; remember the last quality per format.
Size limit (to watch). Binary data goes through AGI as hex, which
doubles it; backend/file.agi allows 48 MB. If real parts hit that, stop
and ask the owner before using anything other than AGI (rule 1 in 15.2).
File Manager thumbnail (not planned). It would need Go code in
mod/filesystem/metadata; only on request.
Touch and pen (M). Pointer events are used throughout, but only a mouse
was tried. Plan: one finger selects and draws (as the left button); two
fingers pan and pinch-zoom (controls.touches = { ONE: null, TWO:
THREE.TOUCH.DOLLY_PAN }); orbit through the Orbit button; a long press is
the right click. Raise the pick tolerances when event.pointerType is
touch (POINT_PIXELS, CURVE_PIXELS in sketcher.js, EDGE_PIXELS in
viewport.js), make typed sizes reachable without a keyboard (tapping a
size box opens the existing value editor), and give the panels a bottom
sheet layout under 480 px. The preview's mobile preset only changes size
and user agent; a real tablet check is the owner's.
Localisation (M). Follow the pattern of the other WebApps:
locale/3dmodeler.json in the app folder with the File Manager's
languages (zh-tw, zh-hk, zh-cn, en-us, ja-jp, ko-kr); load
../script/applocale.js; applocale.init(file, onLoaded, onError) before
the first render (the app starts in js/app.js, a module: wait for it
there); locale="key" on static markup, a T(key, english, vars) helper
for strings built in code; no fontFamily in the file. Where the strings
are: the ribbon table (ribbon.js, key by command id), FEATURE_HINTS
and status messages in app.js, row labels in the feature panels, tool
prompts in sketch/tools.js, dialogs. Kernel errors are thrown as English
sentences inside the worker: give each a short code (new KernelError(
'fillet/toolarge', '...')) and translate by code on the main thread.
Decide with the owner whether default feature names ("Extrusion1") are
translated; they are stored in the file.
README (S). Replace this proposal as the handoff document: what the app is, the folder layout, how to run and test, the file format, the recipe for adding a feature (15.4), the kernel notes (15.5). Keep the design history out of it.
Desktop icon (S). img/desktop_icon.png, 128 x 128, drawn from
img/module_icon.svg (render it on a canvas in the preview and save the
PNG); the desktop prefers it for shortcuts.
Other browsers (S). Only Chromium was used. The kernel runs in a module
worker (Firefox 114 or newer, a current Safari). Check also pointer
capture, the inset CSS shorthand and WebGL line rendering.
Performance (S to M). The slow part is describe(): several calls into
the kernel per mesh vertex. Cheap win: keep the description in the cache
entry of rebuild.js beside the shape, so bodies a feature did not change
are not described again. Then measure with a real part of a few hundred
features before doing more.
Work axis (S to M). { type: "axis", name, def } with def one of:
along a straight edge ({ kind: "edge", ref }), the axis of a cylindrical
face ({ kind: "cylinder", ref }), through two points, or the intersection
of two planes. Resolves to { o, d } in js/kernel/profile.js next to
planeFrame(). Drawn as a long dash-dot line; pickable. Used by Revolve
(an axis outside the sketch), Circular Pattern and angled work planes.
Expose the three origin axes the same way (they are only labels in the
browser today).
Work point (S). At a vertex, at typed coordinates, or where an axis meets a plane. Needs vertex picking (14.10).
More work planes (M). Midplane between two parallel planes or faces
(very common in desktop CAD): offset from the first by half the distance.
Through an edge at an angle to a plane: { base, axis, angle }, the frame
rotated about the axis. Through three points. Tangent to a cylinder and
parallel to a plane. All are new def kinds resolved by workPlaneFrame();
the panel is js/features/plane.js.
Sweep (M). Profile from one sketch, path from another. { type:
"sweep", sketch, regions, path: { sketch, curves: [...] }, operation }.
Kernel: the path as a wire (curveEdge + BRepBuilderAPI_MakeWire), then
new oc.BRepOffsetAPI_MakePipe(pathWire, profileFace). The path should
start on the profile plane and leave it at a right angle; check and say so.
BRepOffsetAPI_MakePipeShell is there for the cases the simple pipe twists.
Loft (M). Sections from two or more sketches. { type: "loft",
sections: [{ sketch, region }], ruled: false }. Kernel: new
oc.BRepOffsetAPI_ThruSections(true, ruled, 1e-6), AddWire(outerWire) per
section in order, Build, Shape. The outer wire of a region face: probe
oc.BRepTools.OuterWire(face); otherwise explore the face's wires with
TopExp_Explorer(face, TopAbs_WIRE) and take the longest.
Draft (M). Faces tilted about a neutral plane: BRepOffsetAPI_DraftAngle
as in 14.7, with picked faces.
Rib, Emboss, Decal (not planned). BRepFeat is not in this build.
boolean() and the splitter are
there; they need body picking and a panel.3D Viewer carries a different
build that can read IGES for display only; a modelling import needs a
custom kernel build.Asked for by the owner: "when creating a new file, the user should be able to pick between a part, an assembly or a mechanical drawing (the last one later, for 2D printable blueprints). In assembly mode the user brings parts together, aligns them in different ways (translate, scale, rotate), views them in half and three quarter section, with alignment and measurement tools so parts can be easily manipulated in 3D space."
What the user gets
chooseNew() in js/ui.js); Drawing is 14.17.
Opening a file picks the environment by its format field; the File
Manager also opens .aoasm with the app (init.agi).mode: "part" | "assembly" on tabs, groups and buttons and
ribbon.setMode()):
.aopart) or a STEP file (kept
inside the assembly as a part of one Imported feature). The first
component is grounded at the origin; later ones land beside what is
there and the view zooms to show them. The same file placed twice is one
part entry with two components (CAD style names Pin:1, Pin:2).
Refresh Parts reloads every part file (after editing one), Open
Part opens a component's file in a tab (14.18), Delete.js/inspect/measure.js): one pick says what it is (area, length, radius,
diameter), two give the exact shortest distance, its X / Y / Z parts and
the angle, with a dimension line and its value drawn in the view; in an
assembly "Whole components" measures the gap between two components.
Analyze Interference (assembly) finds every pair of components that
share volume (faces that only touch do not count), lists the volumes and
shows the overlaps in red until Esc. Degrees of Freedom shows in the
browser how many ways each component can still move. Mass Properties
covers the whole assembly.js/inspect/section.js): Half, Quarter or Three Quarter; which origin
plane cuts (XY, XZ, YZ); where (a slider over the model's extent, or a
typed value); which side stays; a second plane for the quarter modes.
Each component's cut face is filled in a darker shade of its colour.js/assembly/browser.js): the assembly, its
Origin, every component (colour swatch, grounded pin, degrees of freedom,
a warning when its part could not be loaded) with its constraints under
it (value, a warning when it does not hold). Hovering a row lights the
component (or both components of a constraint) in the view; right click
for Move Rotate Scale, Ground, Hide / Show, Isolate, Open Part, Rename,
Delete, and Edit / Suppress / Rename / Delete on a constraint; F2 and Del
work too.How it is built
js/assembly/document.js): .aoasm JSON:
{ format: "aoasm", version: 1, units: "mm", parts: { p1: { name, path |
data } }, components: [{ id, name, part, matrix, grounded, hidden, color
}], constraints: [{ id, name, type, solution, offset, angle, a, b,
suppressed }] }. A part is referenced by its ArozOS path; data (the part
document itself) is kept only when there is no file (STEP placed, or the
browser fallback without ArozOS). matrix is 16 numbers, column-major as
three.js uses them: rotation times a uniform scale plus a translation.
Undo works as in the part document (whole JSON snapshots).js/assembly/geometry.js): a picked face or edge becomes a
plane (o, n), a cylinder (axis o, d, radius r), a circle (centre,
axis, radius; the axis points out of the flat face the edge closes, which
is what makes Insert's "opposed" mean "faces together") or a line, in the
part's own coordinates, plus pick: { type, body, index }. When a part
changes (Refresh, or on open) matchEntity() finds each one again: same
kind, same direction, nearest position and radius, preferring the same
index.js/assembly/solver.js): each constraint is a list of
residuals (mm; directions times a length scale about a quarter of the
assembly's size). Levenberg-Marquardt over six unknowns per free
component (a rotation vector about its middle and a shift), Jacobian by
finite differences, starting from where the components are, so they move
as little as needed. Two faces that must face each other but start facing
the same way sit on a saddle the solver cannot leave, so when it stalls it
retries with each free component turned over about each of its axes (the
upright pin that must go into a hole from above). Dragging adds a weak
pull towards the pointer's placement (the constraints weigh a thousand
times more), then a pass with the constraints alone. freedom() counts
each component's degrees of freedom as six minus the rank of its
constraints' Jacobian; unsatisfied() lists constraints that do not hold.js/kernel/assembly.js, worker ops partBuild, partDrop,
asmDistance, asmInterference, asmExport, asmMass, asmMesh): the
worker keeps one rebuilder per part (key = session + part id) so the exact
solids stay at hand; placed copies come from BRepBuilderAPI_Transform
with a gp_Trsf set by SetValues (handles the uniform scale), the
interference from BRepAlgoAPI_Common on pairs whose boxes overlap, the
distance and closest points from BRepExtrema_DistShapeShape
(shapeDistance() in occt.js, which part Measure uses too).matrix, color and group (the component
id). Their face and edge records are then reported in assembly
coordinates with the part's own as local. Component mode
(setComponentMode) picks whole groups and tints them;
setBodyMatrices moves them without rebuilding (live drags and
previews); attachGizmo / detachGizmo wrap TransformControls (vendored
unmodified from three.js 0.185.0); setMeasure draws dimension lines;
setSection takes a full spec.js/assembly/assembly.js) with its panels
constrain.js and transform.js; app.js switches environments
(setEnv), routes the shared commands through activeDoc() and hands the
Assemble tab's commands to assembly.command().backend/file.agi accepts .aoasm; nothing
else on the server changed.tests/assembly.test.mjs (matrices, entities, every constraint
type, drag, conflicts, degrees of freedom, the document) and
tests/assembly-kernel.test.mjs (placed solids, distance with closest
points, interference, scaled mass, STEP export read back, the sample
assembly built, re-found, solved, and a pin turned over into its hole).Not built yet (in rough order of use)
.aoasm cannot be placed into another.Asked for by the owner: "it should be able to place an assembly or parts, create projections from different angles and create 2D drawings of the selected faces. It should also allow the user to pick and label edges, faces, holes, radius etc. with customizable units and prefix or suffix. The drawing can be customized like Photoshop, like resolution or dpi, or using preset sizes like A4, A3, and it should be able to export to open source CAD formats and PDF. The drawing ratio should be 1:1 unless the user configures the drawing or parts to other ratios."
What the user gets
How it is built
js/drawing/document.js, .aodrw JSON): sheet, style,
sources (models by path, or kept inside), views (a base view has
dir and xdir; a projected view has parent and rel, its direction
is worked out from the parent each time, so editing the base view turns
the others with it), annotations. Points of an annotation are in its
view's own coordinates (model mm on the paper plane), so it moves and
scales with the view.js/kernel/drawing.js, worker op drwProject): the parts are
built per drawing with the same per-part rebuilders the assembly uses
(partBuild, keys drw...; partDrop now takes a key prefix so the
assembly and the drawing never drop each other's). HLRBRep_Algo with
an HLRAlgo_Projector on a gp_Ax2(origin, dir, xdir); the result
compounds give visible / hidden sharp, tangent ("Rg1") and outline
edges. This build has no Handle_HLRBRep_Algo: HLRBRep_HLRToShape
takes the algorithm itself and frees it with itself (delete only the
HLRToShape). Faces alone: itemShape() faces in a compound.js/drawing/geometry2d.js): the remover cuts curves into many
pieces where visibility changes or curves overlap (the sample's cross
hole: 539 raw pieces, 39 clean edges). Pieces are joined where they run
on smoothly, straight polylines become lines, circles are found by a
fit (a hole through a curved wall projects to a circle the kernel only
knows as a 3D curve), pieces lying on a circle already there are dropped.
It also answers hit tests and snap points (ends, middles, centres).js/drawing/layout.js): the sheet as plain primitives (line,
poly, circle, arc, fill, text) on layers with ISO 128 weights and dash
patterns. The screen and every export draw these same primitives:
js/io/drawsvg.js, pdf.js (own writer, Helvetica so no font is
embedded; text outside Latin-1 is drawn by the browser into a 1-bit
image), dxf.js, png.js (canvas plus a pHYs chunk). Text widths come
from Helvetica's metrics (font.js) so centring matches everywhere.js/drawing/sheet.js): presets, units, scales ("3:4" for 0.75),
orientations and the projection rule. First angle mirrors third angle
for side and corner views alike; changing the rule in Sheet Setup
swaps the side of placed views so they keep their direction.editor.js (the SVG sheet: camera, picking, dragging,
overlays), tools.js (Dimension, notes, text, projected views,
placement), browser.js (sheet, models, views), drawing.js (the
controller and its four panels). panel.js gained text, multi-line and
select rows, hideable sections and unit() / items(). The ribbon's
mode may be a list (Export, Inspect and View are part and assembly
only).file.agi accepts aodrw, pdf, dxf,
svg, png; init.agi registers .aodrw.tests/drawing.test.mjs (sheets, scales, view directions,
the projection rule, dimension text, edge clean-up, the document, the
layout of every annotation type, the SVG, PDF and DXF writers and the
PNG resolution chunk) and tests/drawing-kernel.test.mjs (real
projections: a block's views, hidden hole walls, a placed component,
a face alone, the whole sample drawing with every dimension on its
geometry, written to PDF and DXF).Not built yet (in rough order of use)
Asked for by the owner after trying assembly and drawing mode: (1) a mark over the model while the Orbit tool is on, like the orbit circle of desktop CAD; (2) ribbon labels that overflowed their buttons in the assembly and drawing tabs; (3) "tabs so I can quickly switch between different parts, assemblies or drawing sheets, and the drawing or assembly updated automatically if a part is updated while the linking assembly or drawing is open".
drawOrbitMark() in app.js draws #orbit-mark (an
SVG over the stage, no pointer events) while state.leftDrag is
orbit: a circle of 37 % of the shorter side, ticks at the quarters, a
centre cross; redrawn when the stage resizes. It is SVG, so it is shown
and hidden with the hidden attribute (an SVG element has no hidden
property).-webkit-line-clamp), and "Kernel Self-test"
keeps its hyphen (a non-breaking one). Checked by measuring every button
of every tab, assembly and drawing ones included, at 1280 x 800.js/tabs.js draws the strip under the view; app.js holds
tabs, activeTab, openTab, switchTo, closeTab, removeTab):
doc.snapshot() / doc.restore(snap) on all
three document kinds keep the data, the undo and redo history, the
saved state, the name and the path; restore is a reason of its own
for the change listeners ("the same document again", unlike reset).
The view goes with it (viewport.viewState() / setViewState(), the
sheet's drawing.viewState()).useRebuilder / dropRebuilder, keys part:<tab>), assemblies and
drawings their parts under asm:<tab>/ and drw:<tab>/ (dropped with
the tab through partDrop's prefix), drawings their projections per
tab. A drawing view is only projected again when its model's contents
changed (the model's fingerprint is part of the view's signature).files.readPath asks setOpenDocuments' lookup first,
so a document open in a tab is read as it is there, unsaved edits
included. Assemblies and drawings read their parts again whenever
their tab is shown (cheap: the kernel's caches answer), so an edit made
in a part's tab is in the assembly or drawing as soon as its tab is
clicked. A part changed in another window still needs saving there
and Refresh here.describe(). Now assembly.stopTools() and setTool() act
only while the assembly is shown, leaveDocument() only stops the
tools of the environment on show, and enter() turns component
picking off for parts and drawings.tests/tabs.test.mjs (snapshot and restore of every document
kind with their history, tab names, reads of open documents).Asked for by the owner: Wireframe could not be set while Fillet was open, and a Chamfer preview turned a wireframe model solid ("maintain the mesh visual style during the preview"); picking hidden edges in the Wireframe and "hidden edges" styles; "a basic texture tool: pick a colour and a texture of the part".
applyVisualStyle() only knew the bodies. The preview objects now carry
a role (result-solid, result-lines, result-hidden, the last a faint
copy of the edges drawn through the model) and the style shows or hides
them like the body's own, also when the style changes with the panel
open. The result keeps the part's appearance (bodyMaterial.clone()).itemUnderPointer
in viewport.js).js/appearance.js, the panel js/features/appearance.js,
View > Appearance in a part): a colour and one of ten finishes, saved in
the part as appearance: { color, texture, scale } (left out for the
default grey, so old parts are unchanged). Finishes set roughness and
metalness; glass is see through; five have a pattern drawn on a canvas
in code (brushed streaks, cast speckle, wood rings, carbon twill, rubber
grain; no image files), laid on by box projection (addUVs() gives the
meshes texture coordinates in mm, one tile per pattern size). Metals
reflect a small studio environment made once with the PMREM generator
(a grey room with bright panels), given only to the metal finishes so
the default look is as before. The part on show uses the shared body
material (viewport.setAppearance); assembly components and the
drawing panel's 3D view give each body its own (appearance on the
body record: the part's finish, the component's colour).tests/appearance.test.mjs (finishes, clean records, the part
document keeping them, patterns drawn the same every time).Asked for by the owner with screenshots of the reference CAD: lines close to level or upright snap to it; clicking a dimension while the Dimension tool is on edits it; size boxes while a shape is drawn (a slot's centre line with its length and, when not level or upright, its angle; then the diameter of its ends).
snapAt in sketcher.js): from a tool's anchor point
a stroke within 3 degrees of level or upright (ANGLE_SNAP), or within
the old few pixels, snaps to it; the Line tool then adds Horizontal or
Vertical. The Slot tool now has an anchor too and adds Horizontal or
Vertical between its centres.ctx.fields() takes { label, unit } and the new
ctx.live([{ value, at, hide }]) says what each box shows until a size is
typed and where on the sketch plane it sits (showFields places it,
falls back beside the pointer). The active box (Tab moves on) has an
accent border; typed text replaces the live value. Line: length beside
it, away from the angle, and the angle at its start; rectangle: width
and height outside two sides; circle: diameter just outside it; slot:
length and angle of the centre line (drawn dashed), then the diameter
past the far end. ctx.typedValue() reads a box of any sign (an angle of
0 or below).axisangle (points a, b;
planegcs p2p_angle, the direction from a to b measured from the
sketch X axis), drawn as an arc from a dashed reference along X. A typed
angle that is level or upright becomes Horizontal / Vertical instead.
The value editor takes it with its sign.hit.kind === "dim" to ctx.editDimension).tests/sketch-input.test.mjs (typed length and angle of a line
and kept by the solver, a typed 90 degrees, the slot's three sizes, a
level slot, a click on a dimension in Dimension mode).Asked for by the owner: when an assembly is opened and some parts are not where it says, a dialog lists them with Select File to relink them; links are saved relative to the assembly unless the part is under another root (user:/ against storage:/) or the assembly is not saved yet; the first save turns existing absolute links relative.
js/io/paths.js): relativeTo(file, target) (relative under
the same root, else the absolute path) and resolveFrom(file, link).
While an assembly or a drawing is open its links are absolute: they are
resolved in doc.reset from the file's own path, and written relative
again by doc.serializeFor(target) for the place the file is written to
(files.save takes the text as a function of that place), so Save As to
another folder keeps them right and a first save makes them relative.
A download (no ArozOS) keeps them absolute. An assembly a drawing shows
resolves its part links from its own file (resolvePartPaths).js/io/relink.js, shared): one row per file
that cannot be read, Select File (parts: files.openPartFile; a
drawing's models: files.openModel), and after each pick the other
missing files are tried under their old names in the picked folder.
Skip leaves them with a warning; Relink Part / Relink Model in the
browser's right click menu brings it back. Shown once when the document
is opened, not when its tab is shown again. A relink is an undo step; a
part picked outside ArozOS is kept inside the assembly.err.link), so a part that
reads but does not build is not offered for relinking.linkKey), and render() drops the parts whose entry points
elsewhere now. Found while testing: undo showed the relinked part still.tests/paths.test.mjs (relative and back, other roots, the
drive root, an assembly absolute while open and relative where saved,
Save As elsewhere, a first save, a drawing's models).Asked for by the owner: "when I select a sketch in earlier stages, please suppress all other layers (after the editing layer) before entering the sketch mode"; in Wireframe and Shaded with Hidden Edges, "make the lines hidden by a surface dotted lines" (a screenshot of the reference CAD); "add the remaining texture related functions and separate the texture and coloring into its own dedicated tab" (with a screenshot of the reference CAD's View tab: visual presets, shadows, reflections, ground plane, IBL, textures on).
rollBackTo in app.js):
opening a sketch that features come after rebuilds the model only up to
it (rebuild with upto, as editing a feature already did) and sets
state.rollbackAt: refreshWorkPlanes and refreshSketches leave out
what comes after it (a sketch used only by later features counts as
unused there, so it is drawn), the browser greys the later features
(setRollback, class rolled), and requestRebuild keeps the rolled
back bodies until closeSketch clears it and asks for the whole model
(with keepView, so the returning solids are not zoomed to). Later
geometry can no longer be projected into the sketch either, which would
loop back on it.viewport.js): the hidden copy of each body's
edges is a LineDashedMaterial with depthFunc: GreaterDepth, drawn
after the bodies, so it shows only where a surface is in front; dash and
gap are set from worldPerPixel() every frame (updateDashes), about
6 and 4 pixels. Wireframe no longer hides the bodies: a depth only copy
(body.depth, colorWrite: false, drawn first) lets the edges know what
covers them. Fillet and chamfer result previews do the same
(result-depth, result-hidden). In the dark theme the wireframe lines
are light (a MutationObserver on body.dark).ribbon.js, parts and assemblies): Material
(parts: Appearance, Paint Faces), Scene (Lighting, Reflections, Shadows,
Ground Plane) and Textures (Textures On). Visual Style stays on View.
files.openOther (file.agi now
allows jpg, jpeg, webp and gif), made at most 1024 pixels on its long
side and kept in the part as a JPEG data URL, PNG when it has see
through parts (js/io/image.js); the tile size is its width in mm.
Only data:image/png|jpeg|webp|gif;base64 URLs up to about 2 MB are
kept (normalizeAppearance), never SVG.js/features/paint.js): picked faces get a colour and
finish of their own, stored in appearance.faces as
{ body, centre, area, sig, color, texture }. sig is the kind of
surface from the kernel's face description (faceSignature: plane and
the way it faces, cylinder radius and axis). matchFaces finds a face
where it was, else the nearest face of the same kind within about
twice its size, plus the other pieces of it when a later feature split
it (same kind, area within 110 % of the face, bringing the pieces'
centre closer to where it was; found while testing: the sample's top
is cut in two by the cross hole once the plate is thicker). The
viewport draws painted faces through geometry groups and a material
per look (applyFaceLooks), in parts, assembly components (by
partBody) and the drawing panel's 3D view.localStorage under 3dmodeler.scene, not in
files; normalizeScene): five lighting presets (hemisphere and
headlight colours), reflections (metals mirror the studio environment,
glossy finishes a little; off: none), a ground shadow (a light that
lights nothing casts it on a shadow only plane under the model) and a
ground grid (1, 2 or 5 times a power of ten, about four cells across
the model); both hidden while sketching. Textures On drops every
pattern and picture.startFeature now closes it first.tests/appearance.test.mjs (pictures, rotation, face records,
signatures, matching after moves and splits, painting over and removing,
the scene) and tests/facepaint.test.mjs (the sample part painted, its
plate made thicker in the kernel: both pieces of the top keep the paint).Asked for by the owner: an animation beside a panel showing what each type does ("so user knows what to expect on each type of actions"); a revolve of two areas about the right-most edge failing ("The profile crosses the axis"); the export fineness as a list with the file size; a hole picture like desktop CAD's with the values where they apply, following Seat, Termination, Direction and Drill Point; the wheel zoom the other way.
js/features/illustrate.js, scenes and their
drawing in js/features/illustrations.js): a seg row of a panel with
illustrate: '<family>' gets a card beside the panel animating the chosen
item, previewing the one under the pointer. Scenes are a few boxes and
cylinders in model units drawn by a small isometric SVG renderer (faces
culled and sorted by depth, layer() for a part that sits on another,
above() to cut a pin entering a hole, outlines of round sides known
from the fixed view). The card is a sibling of the panel (the panel
scrolls, which would clip it) placed beside it every frame, left of it
when there is no room, under it on a narrow window. Families:
constraint (Mate, Flush, Angle, Tangent, Insert) and operation
(Join, Cut, Intersect, New Solid; Revolve through its seg row, Extrude
wired by hand as it builds its own panel). The i button in the panel
title and the card's close button store 3dmodeler.illustrations;
reduced motion shows the end state still.js/features/holefigure.js, a figure row in
panel.js): Seat replaces the old Hole row (None, Counterbore,
Countersink), Direction and Drill Point became choices instead of check
boxes, and the section is redrawn on every change, not to scale, with
each value where it applies (depth to the end of the round part, as the
kernel measures it). Labels carry data-focus, so a click puts the caret
in the box; spec.onFocus reports the box with the caret, whose size is
then coloured. The panel is wider (props-wide).exact) with a 1e-5 mm tolerance.js/io/exportdialog.js): five levels, Draft
0.5 mm to Very fine 0.002 mm, remembered in 3dmodeler.meshlevel. Each
choice meshes and writes the whole file in the background (kept, so
Export saves the same bytes) and shows its size and triangle count.
STEP and BREP have nothing to choose._handleMouseWheel
gets the delta reversed; pinching is unchanged), and the drawing sheet
the same way.panel.title() wrote the subtitle into the last child
of the title, now the i button.tests/illustrate.test.mjs (a scene for every type, every
frame well formed and rendered, the timing, culling and layering, every
hole combination with the right sizes written, the focus colour, the
export levels and sizes); tests/revolve.test.mjs (two areas about
their own edge at positions that round up, and an axis across an area
still refused).Asked for by the owner: "if I select 2D sketch and drag from a plane to a new direction that is vertical to that plane, create a new Work Plane that new sketches are created on" with an exact offset typed in (reference CAD screenshots); the walls of a hole missing in the wireframe; defaults for Hole (countersink, 3 mm, distance 10, drill point, 6 mm countersink) and Fillet / Chamfer (3 mm), each remembered for the session; Hide on a work plane "so it won't block future editing".
js/planedrag.js the drag math,
js/offsetbox.js the value box): viewport.startPlanePick takes an
optional drag handler; a press on a plane target that moves more than
5 px becomes a drag. The offset is the pointer's movement along the
normal as it shows on screen (dragging up when the plane is seen face
on), snapped to a step that suits the zoom. The app draws it as the
draft work plane; on release the box takes the exact value (formulas
allowed, the wheel steps it), and Enter adds the work plane and a sketch
on it in one doc.change, then opens the sketch. An offset of 0 sketches
on the plane itself. Only in Select (not while Orbit or Pan holds the
left button).js/silhouette.js): per body, the inner
edges of every face that is not flat, with the triangles beside each
(points matched by position, so a closed face's seam counts); for each
view the edges between a triangle facing the eye and one facing away
are drawn, solid and dashed like the other edges, recomputed only when
the view direction (or, in perspective, the camera) changes. Not in
Shaded.DEFAULTS in features/hole.js, and lastUsed (every
value but the direction) taken by the next new hole; KINDS[*].start
3 and lastSize in features/edges.js. Kept in memory, not saved.doc.setHidden, feature.hidden): only for work planes;
refreshWorkPlanes skips them, so they are neither drawn nor picked;
the browser greys them (hiddenitem).tests/silhouette.test.mjs (a cylinder from the side, the
outline on its seam, none along its axis, perspective, running
lengths; the drag math and snapping; hiding as one undo step that is
saved).The plan of 14.13, all of it, plus what using it asked for.
js/kernel/profile.js, pure, shared by the worker and the
page): type: "axis" and type: "point" features with a def, and work
planes with a def beside the old { base, offset }. References:
planes as before, axes { ref: "origin:x|y|z" | "axis", id } (or
{ ref: "line", line }, an edge kept as it was picked), points
{ ref: "origin" | "point", id | "vertex", at }. axisLine, pointAt,
workAxisLine, workPoint and workPlaneFrame resolve them, leaving
the feature out of its own lookup and stopping at depth 32 (so two
features defined by each other give nothing instead of looping).
Kinds: axis edge / cylinder / planes / points; point vertex / coords /
axisplane; plane offset / midplane / angle / points / tangent / normal.js/kernel/rebuild.js, edgeLine and
cylinderLine in occt.js): a work axis on an edge or a round face, and
a tangent plane, are found again in the replay on the solids before
them (findEdges / findFaces, so the panel stores the edge or face
with its description through edgeRefs / faceRefs), given to
resolveWork, and returned as result.lines for the page
(takeFaceFrames(frames, lines)). A vertex point keeps where it was.axis: { work });
Circular Pattern has Axis > Work Axis (axisRef); Mirror has Plane >
Work Plane (planeRef). The replay hands each its axis or plane as it is
now (withWorkAxis); a missing one is reported. document.usesOf finds
every reference, so deleting a work feature takes what uses it.js/features/workfeature.js, replacing plane.js); Plane is a ribbon
menu of the six kinds; Axis and Point are enabled. The viewport's
reference pick (startRefPick(want, handler)) offers flat faces and
planes, origin and work axes (the origin axes drawn while wanted),
straight edges (also in Shaded), round faces, the centre point, work
points and the corners of the model, with a marker under the pointer;
the browser's origin rows and work features feed it too
(viewport.offerRef). Work axes are dashed lines and work points small
diamonds, both kept the same size on screen. Hide and Show work on axes
and points like on planes.tests/workfeatures.test.mjs (every kind, parallel and
degenerate cases, a loop of planes, suppression, references and
dependents; in the kernel the axis of the boss face following the boss
when it moves, a circular pattern about it and its error once the axis
is deleted, an axis on an edge, a revolution about a work axis).The plans of 14.7 and 14.8, all of them, with the card and hint style of 14.23 for the new choices.
occt.js extrudeTool, js/features/extrude.js): Extents is
a segmented row with a card (Distance, To, To Next, Through All; the
Through All check box is gone, old files still read). extent.type:
"to" with extent.plane (any plane reference: face, origin, work
plane): parallel to the sketch it is an exact distance, otherwise the
prism is swept far enough and cut by the half space beyond the target
(cutBeyond). "next" sweeps as far as reach(), splits the prism by
the bodies (BRepAlgoAPI_Splitter) and keeps the pieces that touch the
profile, found as zero distance (BRepExtrema_DistShapeShape.Value())
from points on the profile (InnerSolution() is not reliable in this
build). extent.taper in degrees drafts the side faces about the
sketch plane (BRepOffsetAPI_DraftAngle): positive narrows, below 89,
not with Symmetric or Asymmetric. The panel picks the To plane with the
viewport's reference pick (14.25), the browser feeding it too; previews
run on the bodies before the feature (worker.preview with at).occt.js chamfer, js/features/edges.js): mode: "equal" |
"two" | "angle", distance2, angle, flip. The face a size is
measured on is the one most of the picked edges touch (the top of a box
whose top edges are picked), else the first by position; Flip takes the
other. Sizes and type are remembered for the next chamfer in the
session.sets: [{ edges, radius }] beside the
old edges + radius (one set is stored the old way). The panel lists
the sets one under the other, desktop CAD style (owner's request after
trying a drop-down): each line is the set's edge button, its radius box
and a cross that removes it (hidden while there is one set), with + Add
Set below. The active line is outlined; its edges are the viewport's
selection, so clicked edges go to it, and a click on another line's
button or radius switches. The list is a custom panel row
(panel.container(key)). Every pick button is one line now, ending in
an ellipsis instead of spilling out of its box.js/features/hole.js): Placement is From Sketch or
Linear (the default when no sketch with points is free). Linear picks a
face and two straight edges (startRefPick), and OK writes a sketch on
the face (both edges projected, a point, two pldistance dimensions)
and the hole in one undo step; editing the hole edits the two distances.
linearPoint (pure) places the preview point on the side of the click.thread: { designation, depth? } from THREADS (M2 to
M20, tap drill = major - pitch, which the diameter takes). Shown as
thread lines and a label in the hole section, after the name in the
browser, and as notes in Mass Properties. Not modelled.document.js, rebuild.js, browser.js):
data.end is the id of the last feature built ("" above them all; no
key when at the bottom). The replay reports later features as
rolled. doc.change puts features added at the end of the list where
the marker is and moves the marker past them (placeAtEnd), so every
panel inserts there without knowing. doc.setEnd, doc.endIndex. The
browser shows the marker before the first row not built, draggable,
highlighted while it is up the tree; right-click: Move to End, Move to
Top; a feature's menu: Move End of Part Here. Sketches, work features
and profiles below the marker are not drawn or offered.doc.canMove(id,
beforeId) returns why not (a feature before something it uses,
usesOf), doc.move(id, beforeId, built) moves a feature with the
sketch only it uses. While dragging, the drop line is red with the
reason in the status bar where the move is refused. Dropped in the gap
just above End of Part (built), the marker moves past it; when the
feature the marker is after moves away, the marker stays in place.
Limit: a sketch on a face names the face, not the feature that made
it, so moving it above that feature is allowed and then reported by the
rebuild.doc.setShared). Deviation from 14.8: a shared sketch keeps a row of
its own at its place in the history, tagged "shared", instead of being
listed under every feature that uses it (one row to edit, hide and
drag).hidden on features,
data.hiddenBodies (body numbers) for bodies. These are "visual"
changes: doc.change(label, fn, { visual: true }) emits "visual", the
app redraws without a rebuild or closing the open panel, and
geometryKey ignores hidden and shared. Hidden bodies are left out
of every pick (viewport.setHiddenBodies). Body numbers can shift when
an edit changes how many bodies there are.reportOpenFailures), at most eight.app.js): a second and a half after a change, every
unsaved tab (kind, name, path, text) goes to localStorage under a key
of this window, with an "alive" stamp refreshed every 5 s and zeroed on
pagehide. On start, entries whose window is gone are offered in one
Restore / Discard dialog; restored documents open in tabs, unsaved
(markUnsaved on all three document kinds). Closing the window through
the desktop's close button (saved or answered) drops the entry.tests/a6a7.test.mjs (taper both ways and refused symmetric,
To a work plane, To Next under a slab and with nothing ahead, every
chamfer type with Flip and two edges, two fillet radii and a set that
does not fit; End of Part in the replay; insertion at the marker,
setEnd, move with the group, the refused move, the marker keeping its
place, a drop above the marker; visual changes, validate, markUnsaved;
threads, linearPoint, the new cards).Owner's report (with two screenshots): "sometimes it can or cannot create a proper mesh and the mesh breaks, becomes non-manifold; if I try again it sometimes works. Make sure there is no non-manifold mesh when creating extrusions, and add a function that fixes it when the user sees it."
What was wrong. Reproduced with a random model generator (57 of 150
random parts leaked). The caps of an extrusion are the sketch region faces,
and those kept the finer mesh made when sketchRegions worked out the
profiles (0.05 mm). describe() then meshed the walls at 0.1 mm and left
faces that already had a mesh alone, so a cap's rim and the wall's rim had
different points: cracks all round the cap. A cap that a later boolean
merged or split got a fresh mesh, which is why it came and went. Exports at
another fineness and previews did the same to cached shapes. A second,
smaller cause: booleans ran in OpenCascade's default destructive mode and
could change the tolerances of their inputs, which are the cached results
of earlier features, so the next preview or rebuild of the same document
could come out different.
Fixes (js/kernel/occt.js, new js/kernel/heal.js):
describe() always meshes from scratch (BRepTools.Clean first), and the
region faces are cleaned after sketchRegions; isSound too. The
description of a body is cached per shape in rebuild.js
(described), so a rebuild that changed nothing meshes nothing (handed
out as copies: the buffers are transferred to the page).safeBoolean (all joins, cuts, intersects): SetNonDestructive(true);
the result is checked (BRepCheck_Analyzer and no open edges) and, when
broken, tried again with fuzzy values 1e-5 and 1e-4, and without the face
merging if that is what spoilt it; when nothing comes out sound the first
result is kept, as before. The To Next splitter is non destructive too.zeroThickness, from applyTool): a result
with an edge used by more than two faces (a block touching a cylinder
along a line, two profiles meeting at a corner, a cut leaving a wall of no
thickness) fails with "would touch itself with zero thickness along an
edge (near x, y, z) ... make the shapes overlap, or leave a gap", as other
CAD programs refuse zero-thickness geometry. Such a solid is valid to
OpenCascade but every slicer calls its mesh non-manifold.fallbackTriangles): a face the mesher gives up on is
triangulated from its outline in (u, v) (earclip.js, ear clipping with
holes) using the node parameters of the neighbouring faces' meshes
(PolygonOnTriangulation), so it meets them without cracks. Marked
patched on the face; never seen in testing after the fixes above, kept
as a guarantee that the view never shows a hole.describe() returns health: { open, multiple, empty, patched }; the app
says once in the status bar when a solid has any.weld() (OBJ / 3MF, and meshCheck) merges within 1e-5 mm across cell
walls instead of rounding to a 1e-4 grid, which could split two copies of
a corner a hair apart.heal).New commands.
js/inspect/check.js, worker op check):
per solid a table (closed solid, open edges, zero thickness, unmeshed
faces, js/inspect/health.js) and what a slicer would say of the mesh
(meshCheck in io/exchange.js); dots in the view mark the problems
(viewport.setMarkers: red open, amber zero thickness, purple patched
face). Repair... opens the Repair feature; it is greyed when nothing is
wrong. The panel checks again after every rebuild while it is open.js/features/repair.js, { type: "repair",
tolerance }, kernel repair -> heal): faces fixed one by one
(ShapeFix_Face), slivers narrower than the tolerance dropped, sewn
(BRepBuilderAPI_Sewing), shells closed into solids (MakeSolid,
ShapeFix_Solid, OrientClosedSolid), merged; a looser sewing (ten times
the tolerance) as a last try. The result is taken only when it is better
(a score of validity, open and zero-thickness edges, unmeshed faces) and
keeps the volume within 0.2 %; so Repair on a sound solid changes nothing.
It is a history feature, so an upstream edit that breaks the solid again
is repaired again. The panel shows a live before / after table and the
repaired solid as a preview; the browser shows the outcome (status
note) on hover and click. Zero thickness cannot be repaired: it needs a
change of the model, and the table and notes say so.Tests: tests/repair.test.mjs (the cap cracks, a feature after an
export at another fineness, the hood with a tapered cut touching its edge,
inputs left alone by a boolean, three zero-thickness cases and an overlap
that joins, the fallback mesh meeting its neighbours, ear clipping, weld
across a cell wall, Repair sewing six loose faces, a sound solid left
alone, the feature in a part, STEP import of loose faces) and
tests/meshfuzz.test.mjs (80 random parts with a fixed seed, every
feature's mesh watertight).
Tried in the browser pane: a hood over a slab with a tapered cut into its end (the owner's first screenshot) shows every face, Check Geometry says no problems and a watertight mesh, the STL export dialog has no warning; a disc touching the slab end is refused with the zero-thickness message on open; Repair shows its table and adds Repair1. Not tried: the owner's own part files (not available here); a real slicer.
Owner's request after 14.27: "continue the remaining phases in the proposal to finish the missing functions". Taken in the order that adds most for a user: A13, A10, A9, A8. A4 and A11 are left (see the end).
A13 Sweep, Loft, Draft (js/kernel/occt.js, js/sketch/chain.js,
js/features/sweep.js, loft.js, draft.js; 3D Model > Create and
Modify):
{ type: "sweep", sketch, regions, path: { sketch, curves },
operation }: profile areas picked as in Extrude, the path is curves of
another sketch drawn in the view (viewport.setAxes, one segment per
sample); a click takes every curve joined to it end to end
(connectedCurves), a click on a picked curve drops it, another curve of
the same sketch is added. chainCurves orders the curves and says which
way each is run; the wire starts at the end nearer the profile plane.
BRepOffsetAPI_MakePipe per region; a solid that comes out inside out
is turned (outward). The kernel builds a fold-over without complaint,
so a profile that reaches further from the path start than the tightest
arc radius is refused before sweeping.{ type: "loft", sketch, sections: [{ sketch, region }], ruled,
operation }: createProfiles({ multi: true }) picks one area per sketch
in click order (picks()); BRepOffsetAPI_ThruSections through the
outer wires (BRepTools.OuterWire, holes left out), CheckCompatibility.
Two neighbouring sections in one plane are refused (the kernel built a
flat solid from them). sketch is the first section, for the browser.{ type: "draft", faces, plane, angle, flip }: faces picked as
for Shell, the fixed plane by the reference pick (origin plane, work
plane, flat face); the rebuild resolves it to frame (withFrame);
BRepOffsetAPI_DraftAngle about that plane, pulled along its normal.sketchesOf(feature) (document.js) lists every sketch a feature uses;
usesOf, the browser, the free-sketch lists of Extrude / Hole and the
drawn sketches use it, so a path or section sketch counts as used.tryFeature returns the tool mesh for sweep and loft, the
bodies as they become for draft.A10 Exchange (js/io/exchange.js, js/io/exportdialog.js):
parseSTL (binary or ASCII, detected by
size and header), parseOBJ (polygons fanned, negative and v/vt/vn
indices), welded; at most MAX_TRIANGLES (1 000 000). Kept in the part
as { type: "mesh", format, source, data: { positions, indices } }
(base64 of the Float32 / Uint32 buffers, encodeMesh); above 8 MB the
user is asked first. The kernel ignores it (applyFeature), its data is
not hashed (geometryKey), so it costs the rebuild nothing; drawn pale
and never picked (viewport.setMeshes), hideable with the eye, left out
of export and Mass Properties.unit say so) and, for STL, Binary or
ASCII (toSTLText). Fineness and the choices are remembered per format.A9 View and inspect (js/materials.js, js/features/material.js,
viewport.js, app.js):
data.material = { id, density } from a list of
printing and machining materials or Custom; Mass Properties states the
mass ("502.40 g in Steel, mild"), else the PLA example as before.A8 Parameters (js/expr.js, js/parameters.js,
js/features/paramtable.js; 3D Model > Manage > Parameters):
data.parameters = [{ name, expr, comment }]; the table shows values as
you type, an unknown name, a loop (a -> b -> a) or a bad name on its
row, and OK stays off until all rows work.evaluate(text, scope) takes names; the app sets the open part's values
as the default scope (setScope) on every document change, so every
size box accepts parameter names.expr (in
degrees for angles; the editor shows the formula again), an extrusion
distance keeps extent.expr / expr2. Applying the table runs
applyParameters (new values for every kept formula) and solves the
sketches whose dimensions changed with the sketch solver, headless, in
the same undo step; a sketch that cannot meet the new sizes keeps its old
ones and the status bar says which.d3 = wall * 2 on the dimension.Tests: tests/a13.test.mjs (chains, a bent tube's volume, the tube
starting at the profile whatever order the path was picked, a straight
sweep cut, the fold-over refused, frustum loft, square to circle, sections
in one plane refused, a drafted box both ways, faces across the pull
refused, dependents), tests/a10.test.mjs (STL binary and ASCII and OBJ
read back watertight, damaged files refused, base64 round trip, inches,
the mesh feature in a rebuild), tests/a9.test.mjs (materials and
masses, the file keeps its material), tests/a8.test.mjs (names, order,
loops, kept formulas, a 40 x 20 x 10 block that becomes 60 x 30 x 6 by
its parameters through the headless solve and a rebuild). 38 files pass.
Tried in the browser pane (it was hidden, so through the page itself, not by mouse): the Parameters table (values while typing, a loop refused, width 40 -> 80 made the block 80 x 40 x 20), Material steel and the mass, an STL tetrahedron brought in as Mesh1 and left out of the STL export, the export dialog's Units and Encoding, F5 / F6, the Sweep panel opening with its notes. Not tried by hand: picking a sweep path, loft sections and draft faces in the view (the kernel side is covered by the tests).
Left from section 14: A4 stable references beyond the first step (naming faces by role, projected geometry that follows), A11 (touch and pen, localisation, the README that replaces this file as the handoff, desktop icon PNG, other browsers, performance), the rest of A8 and A9 listed above, and the sketcher gaps of A2 (offset, sketch patterns, ellipse, spline, text).
Owner: "proceed with next phase" (A4 was next in the order of 14.1). Phases A and C of the design in 14.5 are built, and a fault found on the way is fixed; phase B (sketches on faces) was mostly there and now also follows a face that turns.
Face names (js/kernel/naming.js, rebuild.js, occt.js): after each
feature the replay names every face of every solid (entry.names, once per
cache entry): the same face as before keeps its name; a trimmed, split or
merged face takes the name of the named face of before on the same surface
(surfaceKeyOf) that holds a point of it (a point of its largest mesh
triangle, pulled onto the face); new faces get a role - an extrusion's
<id>/start, end+, end- and side:<sketch curve id> (the curve its
edges lie on, seen along the sketch normal), an import's face:<n>, any
other feature's <id>/new. Faces cut in two keep one name. IsSame is only
asked between faces with the same centre and area (rounded), so naming
costs little (the sample part rebuilds as fast as before). Descriptions
carry face.name and edge.names (the pair of its faces).
References use them (occt.js; the rebuild calls useNames before
each feature, and every rebuild leaves the names of the bodies it returns
for the worker's operations):
names when stored (describeEdgeRefs); findEdges
tries the position, then the edge between the faces with those names
(nearest to where it was), then the signature as before.name (describeFaceRefs);
findFaces tries the name after the position.plane.face.name, from the
pick's face record); followFace finds the face by name first and, when
the face turned, turns the sketch frame with it (its X axis kept as near
as the new plane allows) - followNamedFace.tests/references.test.mjs was changed to say so.Projected geometry follows (phase C; rebuild.js followProjection,
project.js applyFollow, app.js followModel): a projected curve keeps
the model edge it came from (source: { body, mid, length, sig }; the
viewport's curvesOf hands it over, Linear holes too). The replay finds
each source edge on the solids before the sketch (followEdges, which
also fills in sig the first time), projects it again and reports the
curves that moved (projections in the rebuild result). The app moves
them in the sketch, solves the sketch with the headless solver, and
stores it with doc.amend (no undo step of its own: the user's change that
caused it undoes both; listeners hear "amend", which rebuilds but leaves
open panels and the sketcher alone). A lost edge stays where it was and is
said once; a sketch that cannot meet its constraints keeps its geometry
and says so; a pass counter stops a loop. source is kept out of the
sketch's cache key, so updating it rebuilds nothing after the sketch.
Profiles remember their curves (found while testing the above): a
profile is remembered by a point inside it, and when sketch geometry moves
(following the model, a parameter, any edit) the point can land in another
area - the cut then took the plate away instead of the hole. Every region
now carries the ids of the sketch curves around it (boundingCurves in
sketchRegions), stored as regionCurves by Extrude, Revolve and Sweep and
section.curves by Loft; pickedRegions and the panels' findRegion take
the area with the same curves when the point disagrees. Old features
without them work by point as before.
Tests: tests/a4.test.mjs (the face outline projected with sources,
a hole 10 from the right edge following the plate from 60 to 80 wide, the
wrong area a point alone picks, a circle following and a lost curve; the
sample part's names, a split face keeping one name, an edge knowing its
faces; a leaning side made to lean more: the fillet, the shell and a
sketch on it follow by name, and without names the fillet is lost).
Tried in the browser pane (hidden again, so through the page): a part whose plate width is a parameter, with a hole dimensioned from the projected right edge; width 60 -> 80 moved the hole with the edge (volume and centre of gravity checked: X 39.521 with the hole at x 70), and one undo brought back the plate and the hole as they were.
Still open from 14.5: names for the side faces of revolutions, sweeps,
lofts and holes (they are <id>/new, so references to them fall back to
the nearest such face), copies of a pattern share names (the nearest wins),
and a face that splits keeps one name (the nearest piece wins).
This section is for the model or person who continues the work (the earlier sessions were done by Claude Fable; the next ones are expected to be Claude Opus or Sonnet). Read sections 1, 2, 6 and 13 for the design and the owner's decisions, section 14 for what to build, and this section for how.
| Milestone | State | Notes |
|---|---|---|
| M0 scaffold | done | |
| M1 document, rebuild, picking, files | done | AGI file script and the desktop integration verified on a live server |
| M2 sketcher | done | Gaps listed in 14.3 |
| M3 extrude, sketch on face, projection, work plane | done | Offset work planes only |
| M4 hole, fillet, chamfer | done, without history based references | Edges are remembered by midpoint and length and fail loudly when moved (14.5) |
| M5 section views, measure, mass properties | done in a first form | Section planes fixed through the middle; Measure answers in a dialog (14.10) |
| M6 import and export | done | Export STEP, BREP, STL, OBJ, 3MF; import STEP |
| M7 touch, localisation, README | not started | 14.12 |
Done in the last session, after the table above was first written:
tryFeature in worker.js
returns the meshes of the bodies as they would become, with the index
ranges of the faces the feature makes (freshFaces() in occt.js, from
the maker's Modified() history); edges.js shows them with
viewport.setPreview(meshes, 'result'): the body in its own colour, the
new rounds or bevels in green, the real body as a pickable ghost. Test:
tests/preview-faces.test.mjs.edgeChains() in occt.js asks OpenCascade's own fillet builder
which edges it carries the feature along (rounded outlines), the panel
sends them to viewport.setEdgeChains(), and hover, selection and the
edge count ("8 edges in 1 tangent chain") use them; a click anywhere on a
picked chain drops it. Hidden parts of a highlighted edge are drawn faint.
Test: tests/chains.test.mjs.restCursor() in viewport.js).wheelStep() in js/ui.js, used by every
number row of panel.js, the Extrude distances and the sketch dimension
editor. One notch is 0.5 (landing on whole steps), a size never reaches
zero, a row can set max (countersink angle 179.5) and step. Test:
tests/wheel.test.mjs. In the dimension editor the wheel changes the box
and Enter applies it.faceInfo() now
asks gp_Pln.Direct(). This matters for sketches and work planes placed
on a chamfer face.isSound() in
occt.js (BRepCheck_Analyzer plus "every face meshes") rejects results
that OpenCascade reports as done but are invalid. Test:
tests/chamfer-after-fillet.test.mjs..props) or the model browser, gives the left button back
(releaseLeftButton in app.js).init.agi lists .step and .stp;
a STEP file opened with the app becomes a new part with one Imported
feature. Needs a live server check (14.2).Sketch roll back, dashed hidden edges, the Appearance tab (owner's request, 14.22). Tried in the browser pane: Sketch1 and Sketch2 of the sample part opened with the later features rolled back and greyed, the whole model back on Finish; Wireframe and Shaded with Hidden Edges dashed (and light lines on the dark theme); a fillet preview in Wireframe; wood turned 90 degrees; a picture chosen (a stand-in file picker) and laid on; Textures On off and on; the top and the boss of the sample painted, then the plate made 18 thick: both pieces of the top stayed red; shadows, the ground grid and Warm lighting on the sample assembly; the scene remembered after a reload. Not tried: a picture chosen through the ArozOS file selector (needs a live server).
Pictures of types, hole section, revolve fix, export sizes, wheel (owner's requests, 14.23). Tried in the browser pane: the constraint card for each type, the hover preview and the i button; the Extrude card; the Hole panel in every seat with Through All and Flipped, a click on a size label; STL, OBJ and 3MF exports whose downloaded size matched the estimate to the byte; the wheel zooming out when rolled away. The revolve fix was reproduced and checked in the kernel (tests), not in the owner's own sketch.
Offset sketch planes, outlines, defaults, hiding planes (owner's requests, 14.24). Tried in the browser pane: a drag off the sample's top face, 6 typed, Work Plane1 and a sketch on it facing the view; the outlines of the plate hole, the boss and the rounded corners in Shaded with Hidden Edges and Wireframe, following an orbit; Hide and Show of the work plane. The hole and fillet defaults were checked in the code only.
A12, work axes, points and planes (14.25). Tried in the browser pane: an axis on the boss face, a circular pattern of the cross hole about it, a midplane of the plate's top face and the XY plane (picked in the browser), a work point on a corner, a plane square to Z through it, a plane at 45 degrees to XZ about Z, and editing it. Not tried by hand: Tangent and Three Points planes, an axis through two points (covered by tests).
A6 and A7 (14.26). Tried in the browser pane on the sample part: End of Part dragged up and back (and by its menu), a refused drag (red line, reason in the status bar), a work plane dragged to the top, a hole dropped just above End of Part, the eyes on a work plane, a sketch and Solid1 (a hidden body not picked), Share Sketch and an extrusion from the shared sketch To the boss top with a 5 degree taper, To Next, a two-distance chamfer with Flip on a tangent chain, a two-set fillet, a linear M6 hole, the failure dialog on open, and Restore after a reload. Not tried: autosave with two windows open, the Distance and Angle chamfer on a model (covered by tests).
node tests/run.mjs passes, 39 files (after 14.27 to 14.29). The owner
has committed the app on branch v3.0.5; the work of 14.27 to 14.29 is not
committed. Do not commit or push unless the owner asks.
backend/ (today only backend/file.agi). If something
truly cannot be done with AGI, stop and ask the owner before using
anything else (Go code, a subservice, another endpoint).lib/, unmodified, with their LICENSE. Only
the system script folder (../script/, e.g. ao_module.js,
applocale.js) may be referenced.alert / confirm / prompt. Use ask() and tell()
from js/ui.js.index.html (<symbol id="ic-...">); add new ones there.state.bodies. Bring it in line when touching
Extrude (14.4 asks to rebuild its panel anyway): drop "New Solid" from
the Boolean row, and let a Join that does not touch the existing
material simply add a separate lump to the same body (fuse it; OCC keeps
both lumps in one compound / solid set). Keep reading old documents
that contain operation: "new" by treating it as join. Mirror and
Pattern (14.6) then only need "join". Confirm with the owner before
removing it if in doubt.applocale.js), when the strings are stable
(14.12).node tests/run.mjs (plain Node 20,
nothing to install; the app's package.json only marks .js files as ES
modules). The kernel tests load the real WASM from lib/occt/. Write the
test of a new kernel or model function first, then wire the interface..claude/launch.json
has a static server of src/web on port 8123 (webroot-static); open
/3D%20Modeler/index.html. Open / Save fall back to the browser's file
picker and a download; everything else works. The browser caches ES
modules hard: after an edit run fetch('<changed file>', { cache:
'reload' }) for each changed file in the page, then reload.
There is no global debug handle; inspect through the DOM, or import a
module in the console (await import('./js/...')).sh scripts/check-conventions.sh <files> from the
repository root (a hook also runs it after every edit).go build -o <scratch>/arozos.exe . from src/ (never build into
src/, the owner runs src/arozos.exe), copy src/system without
ao.db*, logs, cache, cluster*, mail, storage.json next to the
binary, link or copy src/web in as web, start it on a spare port,
register the first user through /system/auth/register from the browser
pane. If .claude/launch.json is changed for this, restore it byte for
byte afterwards..tmp and rename, with newline='' in Python, or Windows turns LF into
CRLF.index.html ribbon host, browser, viewport, panels, SVG icon symbols
css/style.css one style sheet, colour tokens on body / body.dark
js/app.js wiring: ribbon commands, modes, feature panels, files,
keys, autosave and restore (14.26)
js/ribbon.js the ribbon as one data table (tabs > groups > buttons)
js/browser.js model browser (tree) built from the document; End of
Part, drag to reorder, eyes, shared sketches (14.26)
js/ui.js ask(), tell(), menus, small DOM helpers
js/tabs.js the document tab strip under the view (14.18)
js/expr.js formula evaluation of size boxes
js/viewport.js three.js view: bodies, picking, overlays, preview,
sections, view cube, work planes, sketches in 3D
js/document/ document.js (feature list, undo, names, dependents),
sample.js (File > Sample Part), sampleasm.js (File >
Sample Assembly, parts kept inside the file),
sampledrw.js (File > Sample Drawing)
js/kernel/ client.js (main thread side of the worker),
worker.js (operations), rebuild.js (replay + cache),
occt.js (every OpenCascade call), profile.js (plane frames),
assembly.js (placed copies, interference, export),
drawing.js (hidden line projection of drawing views)
js/sketch/ model.js (data + solver translation), sketcher.js
(controller), tools.js (one state machine per tool),
render.js, geom.js, trim.js, project.js, solver.js
js/features/ panel.js (property panel builder), extrude.js, edges.js
(fillet + chamfer), hole.js, workfeature.js (work
plane, axis and point panels, 14.25),
appearance.js (the Appearance panel, 14.19, 14.22),
paint.js (Paint Faces, 14.22), illustrate.js and
illustrations.js (the card of pictures, 14.23),
holefigure.js (the Hole panel's section, 14.23)
js/appearance.js finishes, appearance records, canvas patterns, painted
face matching, lighting presets and the scene (14.19,
14.22)
js/assembly/ assembly mode (14.16): assembly.js (controller),
document.js (.aoasm), geometry.js (matrices, entities),
solver.js (constraints), browser.js, constrain.js and
transform.js (panels)
js/inspect/ measure.js and section.js, panels both modes share
js/drawing/ drawing mode (14.17): drawing.js (controller, panels),
document.js (.aodrw), sheet.js (sizes, scales,
directions), geometry2d.js (edge clean-up, picking),
layout.js (sheet -> primitives), format.js (dimension
text), font.js (Helvetica widths), editor.js (the SVG
sheet), tools.js (dimension, note, text, projected,
place), browser.js
js/silhouette.js outlines of round faces for the view (14.24)
js/planedrag.js dragging a plane into an offset sketch plane, with
offsetbox.js (the value box by the pointer) (14.24)
js/io/ files.js (AGI open / save / export, browser fallback),
exchange.js (STL, OBJ, 3MF writers), drawsvg.js,
pdf.js, dxf.js, png.js (drawing writers), paths.js
and relink.js (links between files, 14.21), image.js
(pictures for the Image finish, 14.22),
exportdialog.js (mesh fineness and size, 14.23)
backend/file.agi the only server script: ping, read, readBinary, write,
writeBinary; extension whitelist; 48 MB limit
lib/ occt (OpenCascade WASM), planegcs, three (r185)
tests/ run.mjs + one file per area
The data flow: every change goes through doc.change(label, fn) (one undo
step) -> app.js calls kernel.call('rebuild', { document }) -> the worker
replays features through applyFeature in rebuild.js, reusing cached
shapes up to the first changed feature -> describe() turns each body into
a mesh with an index range per face plus exact edges -> viewport.setBodies.
Faces and edges are identified by their index in that description; feature
references store positions (mid + length) until 14.5 lands.
Take Fillet / Chamfer (edges.js) or Hole (hole.js) as the model, not
Extrude (older, own panel code).
js/kernel/occt.js): a xxxTool() that builds the tool
shape and a xxx(oc, bodies, feature, ...) that applies it and returns
the new bodies. Run the result through isSound(). Throw an Error with
a sentence the user can act on. .delete() every embind object you
create that is not returned.tests/ (volume, bounding box, failure message).js/kernel/rebuild.js): a case 'xxx' in applyFeature.
If the feature depends on a sketch or plane, make sure
doc.dependents() in document.js follows it, so delete and edit
behave.js/kernel/worker.js): tryFeature already dispatches on
feature.type through kernel[feature.type]; add a preview branch if
the preview is a tool (as for Hole) rather than the result.js/document/document.js): add the type to TYPE_NAMES;
icon in FEATURE_ICONS (js/browser.js) and a <symbol> in
index.html.js/features/xxx.js): built with createPanel() from
panel.js; exports start(featureId, preselected), isOpen(),
cancel(), handleKey(event) and calls options.onClose(committed).
Commit through doc.change, new names from doc.newName(type).js/app.js): add it to featureTools and FEATURE_HINTS;
featureButton() maps the kind to its ribbon id; in startFeature()
decide whether model picking is on for it.js/ribbon.js): remove planned from the button and add
toggle: true.The kernel is replicad-opencascadejs@1.2.1, single thread build, vendored
in lib/occt/. Its type definitions are in the npm package
(dist/replicad_single.d.ts), not vendored: install it in a scratch folder
to read them before planning on a class.
new oc.gp_Pnt(x, y, z),
new oc.BRepPrimAPI_MakeRevol(face, axis, angle, false).TopExp (use TopExp_Explorer and IsSame),
shape maps and hashing (TopTools_*Map*, HashCode), TopoDS_Iterator,
BRep_Builder (so no BREP import), IGES, BRepFeat, LocOpe_DPrism,
BRepTools_History, BRepFilletAPI_MakeFillet2d, ChFi2d_*, solid /
face classifiers.BRepPrimAPI_MakeRevol,
BRepOffsetAPI_MakeThickSolid, MakePipe, MakePipeShell,
ThruSections, DraftAngle, MakeOffset, BRepBuilderAPI_Transform,
BRepBuilderAPI_Sewing, BRepPrimAPI_MakeHalfSpace, HLRBRep_*,
GeomAPI_Interpolate, StlAPI_Reader / Writer,
BRepAlgoAPI_Splitter, BRepCheck_Analyzer,
BRepExtrema_DistShapeShape (PointOnShape1/2), gp_Trsf with
SetMirror, SetRotation, SetScale, SetTranslation, the fillet
maker's NbContours, NbEdges, Edge, NewFaces, and Generated,
Modified, IsDeleted on builders.NCollection_List_TopoDS_Shape must be built from a JS array;
from a returned list only First(), Last() and RemoveFirst() are
typed. Probe before relying on more.new oc.X and most returned objects must be
.delete()d. Leaks show up as a WASM heap that grows across rebuilds.isSound().occt.js runs ShapeUpgrade_UnifySameDomain, so
faces from different features merge when coplanar. That is why naming by
history alone is not possible (14.5).README.md replaces this proposal as the handoff
document (14.12); keep this file as the design record.