Commit Graph

137 Commits

Author SHA1 Message Date
NiJingzhe 237702c7a8 feat(examples): unnumbered self-contained layout with per-example out/
- rename every numbered example (04/08/10/11/7ep scripts, 12/16/20/21 dirs)
  to clean names; each example now writes artifacts to its own out/ folder
- examples/README rewritten as a category index (part / assembly / reverse
  engineering / FEM); stale run_examples.py reference removed
- flange_plate gains the quickstart FTC part (model.py + external verify.py
  + README); u_link/ap242/flange demo builders read the new asset paths
- ap242_gmsh_volume_mesh gains render_views.py for the demo gallery

fix(artifacts): round-trip-stable geometry fingerprint bounds

AddOptimal bounds wobble by one shape-tolerance quantum between a fresh
shape and the same shape read back from BRep bytes, so definitions sitting
on a quantization cell edge failed every package re-validation. Quantize
bounds at a fixed 1e-4 mm grid, far coarser than the wobble; full suite
green (1503 passed). Stored packages captured before this change must be
recaptured.
2026-09-07 05:46:15 +08:00
NiJingzhe 7a8404f03e feat(skill): harness-specific host bindings for 7 compile targets
- skillproj.toml: targets omp,opencode + zcode,claudecode,codex,dsh,kimicode
- single-part-modeling: 5 host-binding pairs -> 10 (ask tool, TODO tool,
  REPL/script hypothesis loop, plan state machine, isolated image review)
- zcode+claudecode share one block per binding (AskUserQuestion/TodoWrite/
  Agent-Task); codex = plain-text batched questions + update_plan + user as
  fallback reviewer; dsh/kimicode = conservative fallback pending native
  tool mapping
- references README generalizes the omp-only wording
2026-09-07 02:29:24 +08:00
Ni Jingzhe 19bb3bd588 Merge pull request #43 from So3Lab/feat/ql-playbook-absorb-guide
docs(skill): absorb QL selection guide into the verified playbook
2026-09-06 20:52:25 +08:00
NiJingzhe 3f9d52d155 docs(skill): elevate in-time tagging to a playbook ground rule
State the ordering discipline positively: a tag lands in the step right
after the operation that produced its targets, because projections into
later outputs are computed at op time. Rule 2 keeps the ownership
half (resolved-list targets), rule 3 owns the timing half, and both name
the same surface error so the misleading 'not owned' message resolves to
the right defect.
2026-09-06 19:56:29 +08:00
NiJingzhe c35bddd6bd docs(skill): absorb QL selection guide into the verified playbook
The hand-written guide at references/docs/guides/ql-selection-playbook.md
sat inside the generated-docs mirror directory under a title identical to
the verified playbook, so agents entering via SKILL.md saw only the older
unpinned copy. Merge its unique content (selection loop, predicate
vocabulary, shared-boundary failure signatures, bore->rim chamfer and
face->datum recipes, lineage routes, facts printing) into
references/ql-playbook.md and retire the guide.

Recipe snippets were re-executed against dev @ 94e3e3e (11/11) before
merging; two session-path corrections came out of that run and are now
documented in Ground rule 2: apply_tag_rselection targets must be a
resolved list, and tags must land before the next operation consumes the
shape.
2026-09-06 19:49:11 +08:00
NiJingzhe c0bfabb3a3 chore: relicense to Apache-2.0
Replaces the AGPL-3.0 license text with the canonical Apache License 2.0
and updates every reference: pyproject trove classifier, both README
license sections, and the skill frontmatter. The article drafts under
docs/ are untracked and were updated separately.
2026-09-06 18:42:33 +08:00
NiJingzhe fb29140206 merge: integrate dev (PR #36 viewer re-composer) into 2.1.0-open 2026-09-06 03:58:44 +08:00
NiJingzhe 3e319e4987 feat(render): agent-facing guard + readable labels
Two agent-SDK quality rulings from the u_link misrender review:

- zero-hit guard: requesting a highlight tag that matches no geometry now
  raises with the missing tag names and likely causes (typo / wrong build
  stage) instead of silently labelling empty air — the guard immediately
  caught two real misuses (S1 blank labelled with S3-stage tags; flange
  fillet tag lost to a downstream feature rewrite)
- label typography: all font sizes move to final-image-pixel semantics
  scaled by supersample; callout lower bound 12->18, legend 10->12 with
  wider cap, panel title floor raised; margins scale with font size so
  large text does not overflow panels
- fix surfaced while verifying: candidate dataset names referenced by
  callouts did not survive the macOS worker hop (surface_group_N vs
  surface_groups_N) — re-anchoring silently no-op'd on darwin; naming
  aligned and verified end-to-end (occluded rim-fillet anchor re-anchors
  onto the visible lower half of the same ring)
2026-09-06 03:41:15 +08:00
Ni Jingzhe d8c5b4e8fe Merge pull request #36 from So3Lab/feat/viewer-re-composer
feat(viewer): re-studio composer round — BRep renderer component, flat UI, context injection
2026-09-06 03:13:00 +08:00
NiJingzhe 26da5e2170 feat(render)!: one pipeline — annotated 1-4 panel grid, studio by default
Design ruling: exactly one way to produce annotated multi-view renders.

- render_screenshot_rpath always routes through the multi-view grid
  engine: view='auto' = the default four-view set, an explicit preset
  name or (elevation, azimuth) pair = a single full-frame panel, views=
  accepts up to four (elevation, azimuth, label) triples (more are
  rejected). The separate single-view code path is deleted (engine,
  worker 'sdk' mode and its dispatch), along with the studio-vs-grid
  rejection contract
- style defaults to 'studio': the default output is now a black-stage
  four-panel grid with camera-derived three-point lighting per panel,
  tubed edge ink, supersampling and light-on-dark labels/legend;
  style='standard' remains the explicit flat diagnostic look
  (render_shape_views_rpath pins standard to keep its inspect semantics)
- zoom applies to single-panel renders; view_up applies to every panel
- framing parity verified at pixel level: single-panel studio through
  the new path matches the deleted single-view path output (mean diff
  0.59, 1.38% pixels), so render_showcase.py and existing studio assets
  are stable
- tests: >4 views rejected, explicit view routes through the grid
  engine as one panel, default style is studio (differs from explicit
  standard), real-render assertions made behavioral instead of size
  thresholds; 31/31 incl. integration suite; API doc regenerated
2026-09-06 03:06:18 +08:00
NiJingzhe 0e240e3f70 feat(render): unify SDK rendering into one API over one engine
- render_screenshot_rpath now accepts raw TopoDS_Shape entries alongside
  SDK solids: the STEP inspection family renders through the same public
  entry with the same edge ink, supersampling and (for solids) tag
  highlights/callouts — one API at SDK level, one engine below it
- edge ink + supersampling pushed DOWN into the shared multi-view grid
  engine (_render_polydata_views_in_process): the default 4-panel
  diagnostic grid and render_shape_views_rpath (inspect channel) now
  draw tubed BRep edges with LANCZOS supersampling like the single-view
  path; grid review score 9/10 (was thin 1px lines)
- render_shape_views_rpath keeps its signature as the inspect-family
  convenience entry (dpi sizing contract preserved: 3240x2160) and gains
  the 0.04mm edge deflection cap; it is no longer the only way to render
  raw shapes
- ty config: unresolved-import ignored repo-wide — OCP/VTK ship no .pyi
  stubs and examples import sibling modules, so import resolution was
  ~900 diagnostics of environmental noise (verified: zero real defects
  in the class); replaces the duck-typing workaround with natural
  isinstance(TopoDS_Shape) checks
- gates: 13/13 render tests, mixed [Solid, raw] input smoke, grid visual
  review, API docs regenerated, step-inspection domain doc notes the
  unified entry
2026-09-06 02:41:44 +08:00
NiJingzhe 94f3b1657f feat(render): three.js-grade BRep edge ink for the VTK single-view path
Closes the edge-crispness gap against the three.js viewer; the single-view
standard style now matches its 'light metal + dark ink' look (8/10 vs 9/10
in side-by-side review; remaining gap is lighting, not edges):

- tubed edge ink enabled for BOTH styles (was studio-only): dark
  (0.145, 0.165, 0.196) vtkTubeFilter tubes, width as span fraction
  (default lowered 0.0026 -> 0.0019 after visual iteration); tube sides
  10 -> 14; edge_width_scale=0 falls back to the legacy thin lines
- edge discretization decoupled from the surface tessellation: dedicated
  0.04 mm chord-error cap (was the shared 0.35 surface deflection), so
  curved edges stay smooth once tubed — same philosophy as the viewer's
  .lines.glb assets
- deterministic supersampling: render at integer factor (default 2,
  validated 1-3) and LANCZOS-downsample; FXAA off when supersampling;
  legend text scales with the factor so the final look is preserved
- coincident-topology polygon offset added (shared walls after booleans)
- tests: supersample writes the requested image size at factors 1/2/3,
  out-of-range factor rejected; 13/13 pass; API doc regenerated

Default single-view output changes once, deliberately (thin light lines
-> crisp dark ink); supersample=1 + edge_width_scale=0 restores the
legacy 1:1 look.
2026-09-06 02:15:38 +08:00
NiJingzhe bdee2e16c4 feat(render): opt-in studio style, tubed BRep edges, tessellation and camera-roll controls
Reviewed keep of the BLDC-GIF render pipeline changes (all opt-in; the
default inspection path is byte-identical, verified by A/B render):

- render_screenshot_rpath: + linear_deflection / angular_deflection
  (tighten tessellation for high-res diagnosis), style='studio'
  (product-shot look: black stage, camera-derived three-point lighting,
  metal specular), edge_width_scale (tubed-edge radius as span fraction,
  validated [0, 0.02]), view_up (explicit camera roll for inclined
  orbits)
- BRep edges as vtkTubeFilter geometry in studio style: LineWidth is
  capped ~3px on macOS, so edges must be geometry to stay readable at
  high resolution / for small features
- contracts: unknown style, studio+views grid and out-of-range
  edge_width_scale are rejected with guidance errors
- tests: three rejection contracts + studio/standard divergence smoke
  (size-threshold assertion replaced with a behavioral one: outputs must
  differ); 11/11 pass
- API doc regenerated via tools/auto_docs_gen.py (also picked up the
  view_up parameter the hand edit had missed)
- examples/20 render_showcase.py: four-module axial explode (ESC /
  motor / two-stage reducer / output shaft) with concentric radius-band
  peeling, inclined camera orbit, exploded turntable GIF export
2026-09-06 02:01:27 +08:00
auua 6c74001ab3 feat(cli): Encapsulate the export function into a CLI tool. 2026-09-05 23:51:42 +08:00
NiJingzhe cdfc0ee904 docs(skill): re-studio workflow rewritten for the composer round
- reverse-engineering-studio.md: free-form composer (entity/op chips,
  [label](token) serialization, IME-safe Enter), operation tips as a
  markdown registry (viewer/server/operations/, mtime-hot, errors named),
  submission schema incl. operations + operation_context, self-contained
  artifact rule (transcription = literals, extraction harnesses beside
  the case), kernel-ordering facts (bores before blend fillets; fitter
  to_dict unique_knots contract), artifact names the UI polls
- step-reconstruction.md: route to the studio variant when a human
  operator is available
- SKILL.md: workflow count corrected to six; viewer/README.md updated
  for the composer + tips registry
2026-09-05 14:35:20 +08:00
NiJingzhe e5ed7b547e feat(viewer): reverse-engineering studio — human-annotated STEP reconstruction loop
Interactive re-mode (re.html) plus a local case server implementing the
ppt-master handshake: the human selects faces / draws regions / labels intent
on the original STEP, the browser composes a submission with server-side
entity context, and a waiting agent reconstructs per the existing
reconstruction contract and writes artifacts the UI polls back.

- viewer/server (stdlib-only): STEP -> synthesized Scene 2.0 projection
  (GLB + entity sidecars, same shape as package scenes), region resolve
  (centroid projection + front-facing filter), entity descriptors,
  atomic submissions, ndjson side recording, --daemon/--wait/--wait-only/
  --shutdown CLI with lockfile and 590s budget
- viewer/src: extract shared cad-three/entity-facts modules (main.ts now
  consumes them), new SceneView class (assembly/picking/highlight) reused
  by both studio viewports
- re-mode UI: annotation canvas (circle/lasso), intent palette, context
  preview, submit flow, rebuilt v3 package loading, comparison image,
  feature tree, evaluation tab
- governance: only the browser writes submission.json; UI never edits
  geometry — code stays the single source of truth
- tests: 6 server tests (scene contract, region math, submission context
  + named failures, wait handshake exit codes, HTTP endpoints)
2026-09-05 00:30:46 +08:00
NiJingzhe 48c77c2055 feat(histcad): pure training-data translation, tools under research/histjson
Generated sources carry the model only: the dual-path constraint fallback,
SKETCH_CONFLICTS/SKETCH_TIER_FALLBACKS audit globals and strict=False
inspection are gone from translated code. Tier decisions and conflict
auditing moved to translation time: auto mode solves each feature's
constrained sketch prefix in-process (preflight), emits sketch tier when it
solves AND reproduces the transcribed coordinates (max point move <= 1e-3,
the drift gate), otherwise transcribed geometry; diagnostics go to the
sidecar report (<case>.ftc.py.report.json).

Root causes found by the new histcad_conflicts.py residual analyzer and
fixed in the translator:
- point-pair H/V distances are directed: sign now taken from coordinates
  (the stored length is a magnitude) — was the top Fusion conflict source
- Tangent on arcs needs an endpoint selector: picked as the nearest shared
  junction with the other curve
- MajorRadius/MinorRadius store full axis lengths: halved to semi-axes
  (solver was stretching ellipses 2x)
- Horizontal/Vertical flat line lists map each line individually
- variadic Equal chains get per-pair constraint ids (duplicate-id crash)
- Coincident entries whose refs pooled onto the same point are elided:
  degenerate point-coincident equations made the solver Jacobian singular
  and showed exact-geometry sketches as conflicting

SDK: constrain_concentric_rsketch now accepts ellipse targets (backend
resolves the ellipse center point).

Validation (100-case samples, constraints=auto): Fusion360 72 pass,
sketch-tier retention 77.5% (conflicts: 19 diverged + 1 conflicting);
DeepCAD 83 pass, retention 85.0% (9 diverged, 0 solver-conflicting).
Demos regenerated, volumes reconcile to STEP. Purity pinned by
test/test_histcad_translation_output.py (9 tests). Full suite 1489 passed.
2026-09-04 14:28:49 +08:00
NiJingzhe b496530363 feat(helix): handedness parameter for right/left helices
make_helix_redge/make_helix_rwire/helical_sweep_rsolid accept
handedness='Right'|'Left'. The kernel negates the u component of the
cylinder 2-D line, mirroring the winding while keeping the ascent
direction: sampled chirality asserts +5 turns CCW (right) vs -5 turns
CW (left) with identical rise, length, and sweep volume.

FreeCAD: Part::Helix stays the right-handed path; left-handed helices
materialize through Part.makeHelix(..., lefthand=True) since Part::Helix
cannot express mirrored winding via placement (rotations preserve
chirality).
2026-09-04 05:36:27 +08:00
NiJingzhe e05231312f feat(chamfer): asymmetric angled chamfers via angle + reference_direction
chamfer_rsolid(distance, angle=, reference_direction=) drives an
asymmetric chamfer: the second leg is distance * tan(angle) and the
distance itself lands on the adjacent face whose outward normal best
matches reference_direction (resolved per edge through incident-face
tracking). Without angle the symmetric behavior is unchanged.

Kernel: tracked_chamfer gains distance2/edge_face_pairs and uses OCC's
SetDists(d1, d2, contour, face), whose first distance lands on the
passed face — verified by chamfer-face bbox placement tests.
FreeCAD: Part::Chamfer Edges tuples use distance2 when recorded.
Graph params record angle, reference_direction, and distance2.
2026-09-04 05:34:26 +08:00
NiJingzhe 23fcc6a4e1 feat(ellipse): full ellipse support at geometry tier, sketch tier, and FreeCAD translation
- Geometry tier: make_ellipse_redge/rwire/rface with major_direction
  orientation; exact OCC Geom_Ellipse geometry (area pi*a*b).
- Sketch tier: add_ellipse_rsketch derives the shape from three solving
  points (center, major-axis end, minor-axis end) so radius constraints
  solve natively; constrain_major_radius_rsketch and
  constrain_minor_radius_rsketch drive point distances; fix pins all
  three points; promotion builds an ellipse profile branch.
- Solved entities report center/axis points, radii, and major-axis angle.
- FreeCAD: Part.Ellipse(S1, S2, Center) three-point construction in both
  Sketcher materialization and wire fallback; major radius maps to the
  native Radius constraint, minor radius to a reference distance on the
  solved minor-axis point (FreeCAD has no native minor-radius
  constraint; noted in mapping status); geometry-tier emitter uses
  _kernel_ellipse_from_params.
- QL curve_type('ELLIPSE') verified against promoted faces.
- 14 new tests; API doc pages regenerated.
2026-09-04 05:29:19 +08:00
NiJingzhe d57835232a feat(sketch): HistCAD constraint coverage — driving angle, line distance, point alignment, normal, mirror, midpoint
- Driving angle lowering: addAngle folds directed 0-360 values to the
  undirected magnitude; the solve keeps the branch nearest the initial
  geometry. Angle measurement normalizes to [0, 360).
- constrain_line_distance_rsketch: minimum offset between lines via a
  signed point-line distance (initial side preserved).
- constrain_points_horizontal/vertical_rsketch for two-point alignment.
- constrain_normal_rsketch (line through curve center),
  constrain_mirror_rsketch (entity mirror decomposed to point symmetric
  pairs with nearest-initial endpoint pairing), and
  constrain_midpoint_points_rsketch (two-point midpoint via helper
  segments: equal length + parallel through the shared point).
- Repair: symmetric lowering no longer uses py-slvs addSymmetricLine,
  which mirrors about the workplane u-axis regardless of the axis entity;
  it now decomposes to midpoint-on-line + perpendicular. Regression
  tests cover vertical and diagonal axes.
- FreeCAD translator: new kinds map to Sketcher Angle/Distance (point to
  line)/point-form Horizontal/Vertical/PointOnObject (center on line)/
  Symmetric (line mirror and three-point midpoint); priority map,
  emitter registry, capabilities, and canonical op set updated.
- 24 new tests (solve semantics, side/basin behavior, serialization
  round-trip, FCStd script mapping) + regenerated API doc pages.
2026-09-04 05:14:09 +08:00
NiJingzhe 8261a28545 feat(render): multi-view screenshots with tags, callouts, legend and axes
render_screenshot_rpath now defaults to a multi-view grid instead of a
single view: one PNG with a panel per SCREENSHOT_VIEWS entry (isometric,
top, front, side), carrying the same highlight-tag color groups, callout
labels (2-D leader-line style, projected per panel), legend and — new
for the grid engine — per-panel axis triads.

- The multi-view grid engine (_render_polydata_views[_in_process])
  gains show_axes: a vtkAxesActor per panel, sized from the visible
  bounds, forwarded through the macOS render worker protocol.
- _render_sdk_screenshot_rpath keeps all of its view-independent
  tag-to-group / callout-anchor / legend computation and routes through
  the grid engine when views is provided; image_size (pixels) maps to
  inches*dpi=100 so pixel dimensions are preserved.
- Public API: new views parameter; default (view='auto') resolves to
  SCREENSHOT_VIEWS; an explicit view keeps the legacy single-view path
  unchanged. zoom only applies to the single-view camera.
- render_shape_views_rpath is unchanged: it remains the raw-TopoDS_Shape
  entry for the STEP inspection family; both entries now share one grid
  engine with identical annotation capabilities.

BEHAVIOR CHANGE: the default output of render_screenshot_rpath switches
from a single-view image to the 4-panel grid. Callers passing an
explicit view are unaffected.

ty: no new diagnostics (1043 before and after). Auto-doc pages
regenerated. Full suite: 1432 passed, 5 skipped (7 new tests: wiring,
custom views, legacy single-view routing, two real renders, constant
shape, empty-views rejection).
2026-09-04 03:52:21 +08:00
NiJingzhe fe05205cae docs(skill): drop fix-history narration from the QL playbook
Skill references state current conventions and current limitations, not
repair history: the plane-axes convention moves to Pattern A (planar
profiles share the box axis convention, width along global x for a +z
normal), and the boundaries list keeps only the still-true behavior
(reference-axis branch switches the in-plane basis discontinuously near
~25° from vertical). Verification stamps updated to dev @ 13c797f.
2026-09-03 18:15:31 +08:00
NiJingzhe 09241caeff docs(skill): add QL selection playbook from verified harnesses
33/33 checks across four verification harnesses (extrude family,
primitives, sweep/loft, D-boss boolean seam + seam fillet) on dev
@ 7dcf2ef. Documents the naming-channel reach matrix (op-kwarg names
survive booleans; edge-source names survive modifiers; plain user face
tags project through nothing), the boolean seam recipe
(origin_role body/tool + incident_to distinct), and the current engine
boundaries. Boundary #5 records the plane-axes fix on this branch.
2026-09-03 17:57:55 +08:00
NiJingzhe eaa6d46458 chore(example): drop 2D drawing scripts from u_link_motor_mount
The drawing declarations were exploratory scaffolding for the dxf engine
and outlived their purpose once the engine contracts landed; example
keeps only the 3D modeling chain (u_link/shell/assembly/export/verify).
Generated artifacts (dxf/png/diag/action-log) were already removed from
out/ — only 3D exports remain. Workflow doc now points at driving the
loop directly via SheetPlan (solve/evaluate/apply/render) with the
diag_png auto-diagnostic instead of the deleted driver script.
2026-09-01 19:10:41 +08:00
NiJingzhe 6c0f9ee3a6 feat(dxf): 1-DOF annotation model, rad inner-arc variant, auto-diag loop
- Direction-first placement: once at/side is fixed the text has exactly
  one DOF (slide along the line); rad candidates run outer (s=3..27)
  then inner-arc (s<0, line through center, arrow flips to point at the
  arc from the center side, deepening ladder for tight centers)
- Linear dims gain slide; dimension line auto-extends (derived, never
  hand-placed) to cover text that leaves the measured span; narrow
  spans place outside with elongation directly; _lin_geometry is the
  single derivation shared by solver and apply
- rad action surface reduced to at(+s); rot is line direction only (R2),
  out removed; dia/rad split insert (baseline-left anchor, matches
  set_placement rendering) from anchor (OBB center, collision/eval) —
  fixes text rendered half-width off its registered OBB
- Leader fixes: multiline elbow moved above the text box (old elbow
  crossed line 2), no-space fallback no longer crashes unpacking None,
  seg-over-text check references the right loop variable
- SheetDecl.diag_png: solve()/apply() auto-refresh the annotated
  conflict image and return a must-read instruction — visual feedback
  is the first-class agent-in-the-loop channel
- test/test_dxf_engine.py: 18 tests covering the above contracts plus
  render determinism; API pages regenerated
2026-09-01 19:10:33 +08:00
NiJingzhe 37c46ccad5 Merge branch 'dev' into feat/dxf-engine 2026-09-01 13:39:14 +08:00
NiJingzhe 48b23fbe7e docs(skill): consolidate workflows to four goal routes
The FTC convention dissolved the sketch-feature-modeling discriminator
(planar profiles are sketch tier inside every part source), and
standard-part usage belongs to the assembly route. Workflow set: 6 -> 4.

- sketch-feature-modeling merged into single-part-modeling: new standing
  discipline 'Sketch tier is the default part form' carries the sketch
  gates (solve status + remaining DOF before promotion, promotion
  preserves measured geometry, stable entity ids, intentional free DOF
  recorded); capability detail stays in domains/sketch-and-features.md
- single-part-modeling gains the hard rule: if the requirement can be
  satisfied by a standard part or based on one, scad.std.* MUST be the
  basis; single std part stays here via domains/standard-parts.md,
  mechanisms mating several route to assembly
- standard-part-assembly merged into assembly-product-build: scope now
  includes stdlib mechanisms; new step 3 selects std components first
  and computes the kinematics explicitly (center distance from tooth
  counts and module, backlash, ratios, measured bearing/gear seats);
  mesh-consistency gates added; steps renumbered 1-10
- routing table and references/README workflow table reduced to four
  goal rows; step-reconstruction's citation of the removed workflow
  replaced with the sketch/geometry tier pointer; mirrors rebuilt
2026-09-01 02:21:24 +08:00
NiJingzhe efe9751bdf docs(skill): feature tree convention discipline; mandatory read in all workflows
Codify the FTC coding standard as references/discipline/
feature-tree-convention.md:

- the block paradigm sketch -> basic body op -> bool -> modifier as
  explicit dataflow (body = op(body, tools)), one application call
  per block, no accumulator state
- mandatory boundary comments '# ---- feature: <slug> (<role>) ----'
  with closed role vocabulary (build|add|subtract|intersect|modify|
  pattern|annotate) and tier annotations profile=/path=; slugs are
  stable identities, never sequence numbers
- tier rules: closed planar profiles and planar sweep paths are sketch
  API only (tangency is a constraint, not hand-computed coordinates;
  open-chain promotion is legal, closedness is a consumer contract);
  geometry tier is restricted to non-planar 3D curves, transcribed
  geometry with unknown constraints, and tool bodies whose shape is
  completely contained in a primitive form — primitives are never a
  shortcut for a profiled feature
- modify blocks select via QL predicates + exactly(n) cardinality;
  parameter guards stay in source, geometric verification stays
  external; block ordering defers to feature-ordering.md

Wire it as required reading into every workflow on this branch (all
six): single-part (standing discipline + Role 4 reading), sketch-
feature (required_domains + build step), assembly-product (per-part
authoring step), step-reconstruction (build step, geometry-tier
honesty), standard-part-assembly (custom parts step), export-and-
translation (source edits while making a package current). SKILL.md
global rule 3 points at the convention for part-source form. Mirrors
rebuilt via tools/skillbuild.py.
2026-09-01 02:13:50 +08:00
NiJingzhe a5e6bf8eb6 feat(core)!: QL-only topology enumeration — remove bare getter list form
Plural topology getters (get_edges/get_faces/get_wires/get_vertices/
get_solids/get_inner_wires/get_edge_occurrences and the Compound
variants) now accept ONLY an index. The no-argument list form raises a
SimpleCADError with migration guidance (enumerate via
ql.<kind>().resolve(shape), pick via get_X(index)). This closes the
selection channel that escapes the graph: Python loops over bare lists
lose the predicate, capture kernel artifacts (the periodic-face seam
edges that broke FCStd translation), and leave no cardinality contract.

- each shape class keeps its enumeration logic as private _iter_<kind>();
  indexed picks record geo-select nodes as before (contract test added);
  Compound getters gain the same indexed recording they lacked
- _TopologySelectionList (the __getitem__ recording vehicle, which also
  made get_X()[i] a silent escape hatch) is retired
- all 109 internal call sites, 165 test call sites, and 31 example call
  sites migrated: SDK/tests use the private channel, user-facing
  examples use ql.<kind>().resolve(...)
- QL _resolve_scope_items switches to the private channel; scene
  contract profile descriptions synced; error strings recommending
  bracket indexing rewritten
- skill docs: strict prohibition added to SKILL.md global rules (new
  rule 6), core README contract statement rewritten, solid/wire/face/
  shell/tagged_mixin pages re-exemplified with QL, geometric-validation
  anti-pattern section updated; mirrors rebuilt via tools/skillbuild.py

Gates: full suite 1418 passed / 5 skipped; translator suites 133 passed;
u_link stage verifiers + render check ALL PASS; scadpkg->FCStd
retranslation verified (5 visible deliverables, 167-object editable
tree).
2026-09-01 02:09:29 +08:00
NiJingzhe 19f8300cb1 docs(skill): restructure drawing workflow into roles with the agent-in-the-loop layout cycle
Mirror the single-part-modeling role architecture: Role 1 Drawing
Requirement Confirmer (blocking ask round -> DRAWING.md), Role 2 Sheet
Planner (view roster + R5 coverage ledger), Role 3 Layout Arbiter, Role 4
Visual Reviewer (delegated PNG verdict, repair: loop), Role 5 Drawing
Exporter — with the Role 3/4 alternation running per sheet.

Role 3 now carries the engine's core layout method as an explicit
validate-and-rollback cycle: viz colored review image (ok/unsolved/warn/
accepted + free-movement corridors) -> plan.evaluate() digested
violations/corridors -> action-log JSON (rad/dia/lin/lead/accept) ->
plan.apply() with reject-and-rollback residuals -> pixel diff of the two
replays -> repeat until warn=0. Record the division of labor (engine owns
deterministic truth, agent owns discrete arbitration) and the
action-log-as-decision-log invariant. Route evaluate/apply in the domain
API groups.
2026-08-31 16:09:30 +08:00
NiJingzhe 40dc5354a5 docs(skill): engineering drawing workflow, domain, and generated API pages
Add references/workflows/engineering-drawing.md (preliminary staged
workflow: preconditions -> declare views -> declare datums/dims -> solve
and audit -> render and visual review) and references/domains/
engineering-drawing.md (capability boundary, R1-R7 solver contract, API
groups, known engine limits, failure modes). Route the new goal in
SKILL.md.

Backfill docstrings for the dxf_engine public surface (declaration
dataclasses, SheetPlan, render_plan) so auto_docs_gen can produce their
API pages under references/docs/api/ with an Engineering Drawings index
section, following the inspect/brep sub-namespace pattern.
2026-08-31 12:59:41 +08:00
NiJingzhe 3e205983a5 docs(skill): opencode question payload workflow; add u_link_motor_mount example
Teach the single-part modeling workflow how to design the Role 1 question
payload for opencode's native question tool (header-keyed ledger rows,
recommended-first ordering, free-text passthrough). Include the
u_link_motor_mount worked example: requirements/build plan, part and
assembly scripts, export pipeline, and the staged verify/probe scripts.
The DXF drawing scripts land separately with the dxf_engine branch.
2026-08-31 12:46:59 +08:00
NiJingzhe 59101def5c fix(inspect): absorb transient macOS VTK render crashes with backoff
VTK offscreen rendering on macOS crashes natively (SIGTRAP/SIGSEGV/SIGBUS)
under heavy system load. Raise worker attempts 3 -> 6 with real backoff
(0.5/1/2/4/8s) so crash bursts are absorbed, decode signal names in the
failure details, and raise a structured SimpleCADError telling callers
(LLM agents included) to retry the same render call instead of treating
the interface as broken. Also validate the written image artifact instead
of trusting vtkImageWriter.Write() return semantics, and document the
transient-failure retry guidance in the skill reference.
2026-08-31 12:46:59 +08:00
NiJingzhe 152bbf3432 refactor!: reorganize package root into themed subpackages
- operators/: _support + geometry/features/boolean/transform/selection/sketch/product
- product/: semantic value model, solver, occurrence, packages, capture
- topology/: model, tagging, tracking, autotag (package re-exports model symbols)
- params/: units, expr, tolerance, frame
- recording/: graph, serializer, source_mapping
- _internal/: canonical_json, vendor_warning_filters, semantic, mesh, brep_region

Root shrinks from 46 to 7 modules. Drop the legacy geometry/boolean/transform/
selection monolith copies and the operations.py facade; unified operator
exports now live in operators/__init__ with monkeypatch mirroring preserved.
Remove the legacy evolve generators and their example/tests/docs. Import paths
for simplecadapi.topology keep working via package re-export; update all
in-repo consumers, tests, tools/auto_docs_gen source tables, and regenerate
the skill API reference docs.
2026-08-31 12:46:57 +08:00
Jiahang Shen 26bd7e922a feat(inspect): add manufacturing feature highlights (#23)
* feat(inspect): add manufacturing feature highlights

* docs(inspect): normalize manufacturing API references
2026-08-30 12:14:58 +08:00
NiJingzhe aba251f604 Revert "fix(skill): keep live tree harness-neutral"
This reverts commit 062eea6da0.
2026-08-26 02:26:09 +08:00
NiJingzhe 062eea6da0 fix(skill): keep live tree harness-neutral 2026-08-26 02:12:00 +08:00
NiJingzhe 955dbce7b5 docs(skill): make part modeling verifier-led 2026-08-26 01:48:00 +08:00
NiJingzhe 0bd286a865 docs(skill): clarify part requirement workflow 2026-08-26 01:47:40 +08:00
Ni Jingzhe d21ab944f0 docs(skill): QL selection playbook guide (#20)
Dedicated topic page for QL selection, every snippet executed against
the SDK before landing:

- the selection loop: probe -> card -> read -> exactly(n)
- predicate vocabulary (geometry / naming / lineage) with the two
  verified gotchas: coordinates take ranges (float noise), one property
  is never enough after booleans or blends
- root-blend recipe via shared_boundary with a failure-signature table:
  tangency (axis-to-wall distance == radius) splits the card into two
  arcs and crashes TopOpeBRepDS at any radius; overhang yields half/extra
  arcs and aborts; generalize by comparing card shape with the imagined
  intersection curve and hunting the singular point
- tagged-bore chamfer recipe absorbing incident_to seam edges,
  scope-scoped apply_tag_rselection ownership, single-GraphSession
- face -> sketch datum plane derivation (make_sketch_rsketch takes a
  plane mapping, never a Face) plus largest-face ordering pattern
- lineage routes: generated_faces_tag vs output_role (kernel-proven
  generated) vs op() touched-set superset

Wired from the edge-selection defaults in geometric-validation.md and
the SKILL.md references list; no new routing targets.

skillbuild: omp/opencode now ship 373 files each.
2026-08-23 11:54:55 +08:00
Ni Jingzhe 075f88e342 feat(skill): routing SOP from load-order discipline + audit-driven fixes (#19)
Rewrite SKILL.md in the routed-authority register (mandatory numbered
load order, hard rules, routing-discipline table): deterministic route
selection, forbidden route-choice menus, one pre-scripted discriminator
question for ambiguous requests, authority precedence, and an
execution-discipline section that binds every gate to a named artifact.

Apply S1-S8 from design-docs/skill-solution.md plus five deeper
patterns from session-audit-01a02469 evidence:

- S1 Ask-or-Record gate + mounting/load brief fields; S6 companion line
- S2 selection-evidence gate before fillet/chamfer (card + cardinality
  assertion + highlight render), anti-patterns named
- S3 edge-selection defaults: shared_boundary first, index getters only
  for intentional picks; wired into the workflow step
- S4 check-definition protocol (posture vs path, verification vs design
  geometry, feedback-to-predicate)
- S5 fastener envelopes precede geometry as brief inputs
- S6 visual acceptance minimum replaces 'Visual plausibility'
- S7 reading-an-API-page contract + external-dependency boundary
- S8 a run analysis ends in a verdict

Deeper audit patterns folded in: acceptance set before geometry,
own-the-methods/ask-the-requirements split, assumptions as brief fields
with derivation tracking, enumeration-is-not-repair, and
discriminating-evidence selection.
2026-08-23 01:38:45 +08:00
Ni Jingzhe c454a3af10 feat(skill): per-harness skillbuild toolchain replaces skill-pack (#18)
* feat(skill): replace skill-pack with per-harness conditional compiler

skillbuild compiles the skill tree into per-target harness builds:
- <!-- skill:if omp,!claude --> blocks include text only for matching
  targets; name-list conditions only, no else/nesting, fail-loud on
  unknown targets and unpaired/nested directives
- fence-aware: directive-looking lines inside code fences are literal
- layout is the filesystem; tree root configured in skillproj.toml
- post-build assertion: zero directive residue, SKILL.md frontmatter
  name check

Migration to the new model:
- docs/skill/ becomes the self-contained source root (SKILL.md,
  references/, generated api/stdlib/core/guides now under
  references/docs/; SDK_OVERVIEW/LICENSE/inspect are ordinary tree
  files)
- auto_docs_gen output redirected into the tree (docs/api ->
  docs/skill/references/docs/api, likewise stdlib)
- skills/simplecadapi/ is now the compiled omp target output;
  dist/generic/simplecadapi the generic target
- dropped skill-pack entry point (plus dangling evolve/make-export
  entries and their orphaned test), release workflow builds via
  skillbuild + tar; README updated

First real conditional block: harness reading paths in SKILL.md
(skill:// mount on omp vs disk-relative on generic).

Verified: 59 tests pass (skillbuild 31, auto_docs_gen 19, persistence
regression 9); both targets build; outputs residue-clean; full suite
collects (1376 tests).

* refactor(tools): auto_docs_gen moves out of the installed package

tools/ scripts are repo-checkout dev scripts, not packaged CLIs:
- auto_docs_gen.py now lives in tools/ beside the other generators;
  auto_tools/ package removed entirely
- path resolution simplifies: repo root = parent of tools/, fail-loud
  if pyproject.toml missing; site-packages/cwd fallback branches were
  dead code once the script stopped shipping in the wheel
- auto-docs-gen console script dropped from [project.scripts];
  release.yml and README invoke python tools/auto_docs_gen.py
- MANIFEST.in stale src/auto_tools include removed; CadQuery-free
  runtime scan no longer needs the auto_tools filter
- run_examples.py retired (user removal): README example-runner text
  updated to direct examples/ scripts; dangling runner-contract test
  (runpy.run_path into the deleted script) removed

Verified: 53 tests pass (auto_docs_gen + skill_build + ocp runtime
scan) and test_example_model_contract passes; regeneration from
tools/ is byte-identical (zero docs drift).

* refactor(skill): strip harness and build-tool content from the skill tree

The skill is plain harness-neutral content again:
- SKILL.md 'Reading skill files' section removed (the omp skill://
  mount block and its !omp complement were the only conditional
  blocks; the tree compiles identically for every target now)
- references/README.md: build-tool meta removed ('per-harness
  conditional compilation', skillbuild packaging/validation claims —
  link validation was never implemented, so the claim was false)
- live test now asserts the tree stays harness-neutral (zero blocks)
- skillproj.toml targets aligned with the user's output table
  (omp -> skills/simplecadapi-omp, opencode -> skills/simplecadapi-opencode;
  leftover 'generic' entry had no output and failed the build)
- compiled outputs are regenerable artifacts: skills/simplecadapi/
  untracked from git, skills/simplecadapi-*/ gitignored, release.yml
  and README build via skillbuild and tar the omp output directly
  (bsdtar has no --transform; inner dir keeps its suffixed name)

Verified: 49 tests pass; both targets build 372 files with zero
conditional blocks; no omp/conditional/directive residue in the tree
or outputs.

* chore(docs): drop stale architecture review and design notes
2026-08-22 20:20:49 +08:00
NiJingzhe f5727fe642 refacot(skill&docs): reorgnize skill for better function routing and adding diciplins from text to cad 2026-08-21 20:35:34 +08:00
NiJingzhe cb720dd1f3 docs(stdlib): regenerate pages for ring-gear sweep migration and bearing builder
Picks up the twisted-sweep docstrings from the ring-gear migration and
the new build_ball_bearing durable builder in the stdlib index.
2026-08-21 15:41:27 +08:00
NiJingzhe a4ba70640b docs(api): document primitive placement parameters from source docstrings
The make_box_rsolid docstring was a single sentence with no Args
section, so the generated page had no Parameters section and the
bottom_face_center semantics (geometric center of the bottom face:
centered along x/y, full depth upward along z from the point's height,
not a corner) were undocumented — exactly the gap behind the four-bar
web misplacement. Add Args sections to make_box_rsolid,
make_cylinder_rsolid, and make_cone_rsolid in both the public facade
and the kernel implementation file (both define the functions), phrased
without colons inside descriptions so the docstring parser does not
split them into new parameter entries. Regenerate docs/api/, which also
picks up pages stale from earlier PR changes (capture include_scene,
MJCF closure_count, ring-gear sweep docstrings).
2026-08-21 15:41:10 +08:00
NiJingzhe bc0a967c85 feat: propagate public connectors to exporters 2026-08-20 14:52:47 +08:00
NiJingzhe e1df185f5b Merge cadir/dev into feat/prt-and-assemble 2026-08-19 14:42:27 +08:00
NiJingzhe e6896d7baf fix: preserve nested assembly state 2026-08-19 14:02:58 +08:00
NiJingzhe ba1e06a489 feat: expand product exporters and FEM workflow 2026-08-18 01:36:44 +08:00