Skip to content

feat(parametric): guide model to use BOSL2 for organic/curved shapes#152

Draft
eve-assistant-bot[bot] wants to merge 1 commit into
masterfrom
eve/issue-65-organic-shapes
Draft

feat(parametric): guide model to use BOSL2 for organic/curved shapes#152
eve-assistant-bot[bot] wants to merge 1 commit into
masterfrom
eve/issue-65-organic-shapes

Conversation

@eve-assistant-bot
Copy link
Copy Markdown
Contributor

@eve-assistant-bot eve-assistant-bot Bot commented May 11, 2026

Closes #65

Root cause

When a user asked for a Datsun 280z tail light, the parametric-chat generator defaulted to bare OpenSCAD primitives (cylinder(), linear_extrude(), rotate_extrude()) and tried to chain them into a freeform shape. Those primitives can't represent splines, swept profiles, or lofted surfaces — so the top curve flattened out, there was no "spline tool" equivalent the model knew to use, and the pocket trace couldn't follow the body's Bezier outline. The result was faceted/blocky geometry that didn't capture the user's intent.

This is the same class of failure as #42 (screws/bolts collapsing because cylinder() can't form helical threads). The fix follows the same playbook: tell the LLM explicitly to reach for BOSL2's higher-level primitives, which are already preloaded in the WASM runtime.

What changed

Pure prompt change to supabase/functions/parametric-chat/index.ts (STRICT_CODE_PROMPT):

  • New "Organic and Curved Geometry (CRITICAL)" section listing the BOSL2 includes (std.scad, skin.scad, beziers.scad, rounding.scad) and the right primitive for each shape class:
    • path_sweep(shape, path) — the "spline tool" equivalent: sweep a 2D cross-section along a 3D path. For tail-light/headlight bodies, tubes following a curve, swept handles, fillet trim.
    • skin([profile_a, profile_b, ...], slices=N) — loft/blend between cross-sections. For tapered shells, blended transitions, fuselage-like bodies.
    • bezier_curve() / bezpath_curve() — generate a smooth curve from control points; feed into path_sweep or polygon.
    • offset_sweep() and round_corners() — chamfered/rounded extrusions and edge rounding.
  • Sets the $fn floor to 64, with 128–256 recommended for organic surfaces so swept Bezier geometry stays smooth (low $fn is a common cause of "faceted" results).
  • One worked example added to the existing few-shot block — a Datsun 280z teardrop tail light using bezpath_curve for both the 3D body path and the 2D teardrop cross-section, then path_sweep to assemble them. Mirrors the existing mug example in style and length.

No new runtime dependencies, no changes to the OpenSCAD WASM worker, no changes to package-lock.json. BOSL2 is already preloaded under /libraries/BOSL2/.

Sample test prompts

Once shipped, users should be able to ask for any of these and get smooth swept geometry instead of faceted primitives:

  • a Datsun 280z teardrop tail light (the reporter's original ask)
  • a curved car fender panel
  • a swept handle following a spline
  • a tapered fuselage lofted between three cross-sections
  • a smooth pocket traced along a Bezier curve
  • an ergonomic computer mouse shell

Validation

  • npm install --no-audit --prefer-offline succeeded; package-lock.json restored to baseline so the lockfile is unchanged.
  • npm run typecheck (tsc -b --noEmit) — passes cleanly.
  • npm run lint:supabase (deno lint supabase) — passes (19 files checked, no diagnostics).

Authored by Eve (Zach's AI agent) on behalf of Adam.


Summary by cubic

Guides the parametric-chat generator to use BOSL2 sweep/loft/bezier primitives for organic shapes, fixing faceted results like the Datsun 280z tail light in #65. Adds a worked example and smoother $fn defaults; no runtime changes.

  • New Features
    • Added a CRITICAL guidance block in STRICT_CODE_PROMPT with include <BOSL2/std.scad>, skin.scad, beziers.scad, rounding.scad, and when to use path_sweep, skin, Bezier curves, offset_sweep, and round_corners.
    • Set $fn floor to 64 (recommend 128–256 for organic surfaces) and encourage exposing control points/radii as parameters.
    • Added a few-shot example: Datsun 280z teardrop tail light using bezpath_curve + path_sweep.
    • No runtime or dependency changes; BOSL2 is already preloaded.

Written for commit e387520. Summary will update on new commits.

… shapes (#65)

Freeform and curved shapes (car body panels, tail lights, ergonomic
grips, smooth pockets) were rendering as faceted/blocky geometry because
the model defaulted to bare cylinder() / linear_extrude() / rotate_extrude()
chains. Those primitives cannot represent splines, swept profiles, or
lofted surfaces — the user who tried to model a Datsun 280z tail light
couldn't form the top curve, use the "spline tool", or trace the pocket.

Adds explicit guidance + a worked example to the STRICT_CODE_PROMPT
in supabase/functions/parametric-chat/index.ts telling the model to:

- include <BOSL2/std.scad> plus skin.scad / beziers.scad / rounding.scad
- reach for path_sweep() (sweep a 2D profile along a 3D path — the
  "spline tool" equivalent) and skin() (loft between cross-sections)
- generate smooth curves with bezier_curve() / bezpath_curve() instead
  of stacking cylinders
- use offset_sweep() and round_corners() for chamfered/rounded edges
- set $fn = 64 minimum (128–256 for organic surfaces) so swept Bezier
  geometry stays smooth
- expose control points, radii, and slice counts as snake_case parameters

The new few-shot example walks through the user's exact use case — a
teardrop tail-light body swept along a 3D Bezier path — so the model
has a direct template for this kind of request.

Same playbook as the #42 BOSL2 fix for threaded fasteners. No new
runtime dependencies — BOSL2 is already preloaded.

Sample prompts users can now try:
- "a Datsun 280z teardrop tail light"
- "a curved car fender panel"
- "a swept handle following a spline"
- "a tapered fuselage lofted between three cross-sections"

Closes #65

Authored by Eve (Zach's AI agent) on behalf of Adam.
@vercel
Copy link
Copy Markdown

vercel Bot commented May 11, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
cadam Ready Ready Preview, Comment May 11, 2026 2:09pm

Request Review

@supabase
Copy link
Copy Markdown

supabase Bot commented May 11, 2026

Updates to Preview Branch (eve/issue-65-organic-shapes) ↗︎

Deployments Status Updated
Database ⏸️ Mon, 11 May 2026 14:09:06 UTC
Services ⏸️ Mon, 11 May 2026 14:09:06 UTC
APIs ⏸️ Mon, 11 May 2026 14:09:06 UTC

Tasks are run on every commit but only new migration files are pushed.
Close and reopen this PR if you want to apply changes from existing seed or migration files.

Tasks Status Updated
Configurations ⏸️ Mon, 11 May 2026 14:09:06 UTC
Migrations ⏸️ Mon, 11 May 2026 14:09:06 UTC
Seeding ⏸️ Mon, 11 May 2026 14:09:06 UTC
Edge Functions ⏸️ Mon, 11 May 2026 14:09:06 UTC

❌ Branch Error • Mon, 11 May 2026 14:10:32 UTC

failed to clone repo: unexpected client error: unexpected requesting "https://x-access-token:ghs_AWZjFN6EBhLndMRxUemX7lKgfEtpR04WxPP9@github.com/Adam-CAD/CADAM.git/info/refs?service=git-upload-pack" status code: 500

View logs for this Workflow Run ↗︎.
Learn more about Supabase for Git ↗︎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Organic shapes

0 participants