Docs/CAD

Part workbench

A cad-part sheet renders the FeatureScript program as a real solid you can edit with direct manipulation. The workbench is laid out like a CAD tool, not a code editor with a preview.

Layout

RegionContents
Feature toolbar (bottom)One compact row of one-click icon tools (tooltip = name) in a floating pill at the bottom of the viewport, like the electrical sheet: Sketch · Extrude · Revolve · Hole · Pattern · Sweep · Loft · Fillet · Chamfer · Shell · Transform · Boolean · Rename · Appearance · Delete · Select/Move/Rotate · Measure · Section. View controls (fit, views, projection, wireframe, edges, grid, screenshot, export) sit at the end of the row.
Feature tree (left)One row per derived feature. Clicking a row opens its floating editor and shows the model at that feature. Clicking a sketch row re-enters sketch mode.
ViewportBabylon.js, Z-up right-handed. Per-body selection and hover as a crisp material tint (never a glow halo), move/rotate gizmos, two-point measure, section plane.
Feature dialogA small floating popover over the viewport with typed inputs, a green check to keep and a red X to cancel. It is never a modal.
Document panel (right)Closed by default; opened from the icon rail: Params · Source · Info · Issues.
Bodies listDerived bodies with an eye toggle. Visibility is view state only and is never written to the program.

Tools

ToolWhat it does
SketchA first-class sketch block on XY/XZ/YZ with a plane offset. Draw lines, rectangles, circles and arcs (arc = click the centre, the start point, then the end point); the line tool chains segments and closes a contour when you click the chain start. Snapping order is endpoint → centre → origin → 1 mm grid. The selected entity exposes dimensions (rectangle width/height, line length/angle, circle radius, arc radius/sweep) and lines can carry horizontal/vertical constraints — both rewrite the sketch block and the constraint list lives in its marker.
ExtrudeConsumes an existing sketch profile or a planar face of an existing body. Live preview: ghost geometry plus a draggable depth arrow (on the face and along its normal for a face profile). Operation = New solid · Add to body · Remove from body · Intersect (a face-only extrude defaults to Add to body, since the face already belongs to one). Boolean targets are captured before the tool body exists, so an extrude can never target itself.
RevolveRevolves a sketch polyline profile about X, Y or Z.
HoleA sketch cutter + boolean subtract, through or blind, placed by clicking the model.
PatternLinear steps or a circular sweep written with opPattern.
TransformNumeric translation + Euler XYZ, or viewport gizmos. A drag composes with the authored transform and writes translation + axis-angle.
BooleanUnion / subtract / intersect two bodies addressed by scene index.
FilletRounds the selected bodies' edges in the exact kernel (opFillet). Choose the radius and whether to affect all edges or only edges parallel to X/Y/Z.
ChamferCuts the selected bodies' edges (opChamfer) with the same body/edge-selection fields and a distance instead of a radius.
ShellHollows the selected bodies with a wall thickness (opShell) and opens one planar face group — Top (+Z), Bottom (−Z) or a side (+X/+Y) — so the cavity is open.
LoftInterpolates a solid through the two most recent sketch profiles (opLoft); the dialog picks Section 1 and Section 2, and editing either sketch updates the loft.
SweepSweeps the second-to-last sketch's closed profile along the most recent sketch's contour (opSweep); the dialog picks Profile sketch and Path sketch.
SuppressThe feature dialog's suppress action parks a block (statements commented, marker flagged) so the feature leaves the model but stays in the program; a Suppressed list under the feature tree restores it.
ReorderThe feature dialog's up/down arrows move a feature one position in the program. Moves that would change meaning are refused with a reason: body-index selectors, a feature before the sketch it consumes, or a body-consuming feature before any body exists.
Rename / AppearanceWrites setProperty NAME / APPEARANCE; the colour is carried to the derived body.
DeleteMarks the body dead in the program (opDeleteBodies) so later features can still query history.
Measure / SectionRead-only inspection: two-point measure, section plane per axis.
ExportSTEP and STL from the browser kernel, PNG screenshot, and .fs source.

Editing an existing feature

Click a feature row. The dialog reads its values back from the program, so a tool-made feature and a hand-written feature show the same editor. Tool features can be changed after the fact — for example switching an extrude from New solid to Add to body rewrites the block, adds/removes the opBoolean, and re-targets the editing context.

While the dialog is open the viewport stops evaluation after that feature, so you see the model at the state you are editing (not a rollback — saved revisions and branches are not implemented yet). The red X also reverts the source snapshot taken when the dialog opened.

Extruding a face of a body is the same dialog: the Faces & sketch profiles chip box lists picked body faces by area (Body 1 · 800 mm²) next to sketch faces, and clicking a face in the viewport toggles it — a sketch face under the pointer wins (its outline is drawn over the solids), and a body face toggles where no sketch face covers the pointer (hide the sketch to reach the face beneath its regions). The program keeps a geometric anchor (a world point on the face plus its outward normal) and compiles it to qPlanarFaceAt(qNthElement(qAllModifiableSolidBodies(), i), vector(…) * millimeter, vector(…)), so a rebuild that changes the body re-resolves the face; a rebuild that removes or moves it is a typed error asking for a re-pick, never a silently different face. Only planar faces can be extruded, and a face with a different normal starts a new face selection (an extrude has one direction); sketch faces and body faces can be mixed in one feature.

Authored opExtrude statements get the same treatment: they gain a depth field and the viewport depth arrow. Dragging rewrites the depth expression to a literal. They also always show the Operation control (New solid · Add to body · Remove from body · Intersect), which reads the program's own boolean step — a following opBoolean whose tool is the extrusion's body — and writes it: an existing step is rewritten in place, a new one is inserted as a target capture before the extrude plus opBoolean after it (so a cut/join can never target its own body), and New solid removes the step again. A program-written boolean keeps its own target expression; one written by the dialog also exposes the Target bodies picker. With no body existing before the extrude the operations stay visible but are disabled, with a one-line explanation.

Parameters

The Params panel lists numeric literals: isLength bounds ([min, default, max]) and var/const numeric initialisers. Editing rewrites only the literal, so expressions keep their structure. Expression editing is not implemented.

Starter source and templates

Starter programs live in packages/types/sld-types so a new page can be seeded without importing the editor chunk. A document can also declare // @template <page name> to resolve another project document as a kernel include — that is how a thin stage document derives from a shared template without copying geometry. See the authoring model.

Current limits

  • Modelling is sketch → extrude/revolve/hole/pattern/boolean/transform/fillet/chamfer/shell/loft/sweep. The phase-2 surface operations are all shipped. The Parameters pane edits numeric parameters and expressions over them (var half = wid / 2; shows its evaluated value and an expr chip; invalid or unknown-name expressions are refused). Features can be suppressed and restored (a reversible source edit, listed under the feature tree) and reordered with dependency guards. Sketch entities have editable dimensions and lines support horizontal/vertical constraints; remaining work is a constraint solver for coincident/equal/angle relationships and arbitrary-plane sketches.
  • Sketches support lines, rectangles, circles and arcs on the three world-aligned planes: no constraints/dimensions, no trim/fillet, and no sketch-on-arbitrary-face.
  • Extrude can use a planar face of a body (geometric anchor, re-resolved per evaluation), but face/edge picking for other tools is still the CFD mapping only: edge picking and a general topological-selection API (fillet/chamfer face or edge groups, sketches on a face) are not implemented, and a non-planar face cannot be extruded.
  • Feature rows are editable; reorder/suppress are not implemented.
  • STEP imports are reference bodies: you can measure and pick them, but authoring tools operate on the program's bodies and exports stay program-only.