Skip to content

DXF of each 2D-cut part's flat face in the build pack - #60

Merged
sushilm20 merged 4 commits into
mainfrom
feat/dxf-flat-parts
Oct 29, 2026
Merged

sushilm20 merged 4 commits into
mainfrom
feat/dxf-flat-parts

Conversation

@sushilm20

@sushilm20 sushilm20 commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Owner requests:

  • "do dxf for parts it detects as a flat piece"
  • "it only does the dxf if the panel is like 3mm or less, otherwise it should be 3dp step file"

What

Each 2D-cut part 3 mm thick or less now gets a DXF of its flat face in the build pack, next to its STEP file.

Onshape endpoint and cost

  • The v9 OpenAPI has no translation option that picks a face. Its DXF options (sheetMetalFlat, flatPatternAsync, bend lines) are for sheet-metal flat patterns.
  • So the Worker reads the documented GET /api/v9/parts/d/{did}/{w|v}/{wvid}/e/{eid}/partid/{pid}/bodydetails?configuration=…&includeGeometricData=true.
  • When the response names a spline or ellipse, it also reads …/partid/{pid}/tessellatededges.
  • Cost: one billable request per 2D-cut part, or two with a spline or ellipse. Both go through onshapeFetcher, the per-poll budget, and the ledger (body-details, tessellated-edges). There is no translation and no polling.
  • In each poll, geometry reads come after STEP starts and polls. A rate limit on geometry therefore never costs a STEP its deadline.

Drawing

  • packages/shared/src/dxf.ts picks the largest planar face of the part's solid body and draws it as seen from outside the part, in millimetres.
  • Lines and arcs are exact; closed circular edges become circles. Anything else comes from Onshape's tessellation.
  • The output is R12 ASCII with $INSUNITS 4, on layer CUT.
  • The face is rejected in these cases:
    • it is a pocket floor;
    • the part has no flat face on its far side;
    • a loop on the face is a blind recess and does not run through to that far side.
  • The browser does the drawing, because parsing a 400-hole plate took 10–26 ms in Node, over the free plan's 10 ms. The Worker only stores Onshape's JSON for an hour and serves it at /api/exports/{jobId}/files/{i}.body|.edges.

Thickness rule

  • A flat plate is a DXF cut part only at 3 mm or less. The rule allows 0.005 mm of tolerance, so 1/8 in (3.175 mm) is printed.
  • In the classifier, the thickness comes from the name, description, or configuration: "6mm Side Plate", "1/8 in", "300x200x3mm", or Thickness=3+mm.
  • In the export, the same rule applies to tagged plates. When nothing states the thickness, it is measured from the body details already read, with no extra request.
  • A thicker flat part becomes a 3D print: STEP only, filed in 3D_print/, with the note "flat, 6 mm thick: over 3 mm, so 3D printed". The note appears in the Make panel and in MANIFEST.txt.
  • A person's manual choice always wins.

Files

  • In the ZIP, 2D_cut/{stepFileName}.dxf sits beside the STEP.
  • MANIFEST.txt lists each DXF with its size and thickness. A DXF that fails gets its own section, and its failure never fails the STEP.
  • The workbook's Make sheet gains a "DXF file" column.
  • pnpm sample:step now includes a DXF in the committed sample ZIP.

Tests

  • DXF drawing: face choice, arc direction, holes, splines, pocket floor, blind recess, and the thickness measured from geometry.
  • Thickness rule: exactly 3 mm, 3.0001 mm, 3.2 mm, 1/8 in, a configuration value, a name with no thickness, a manual override, and a team tag.
  • Export job: request paths, the order of work within a poll and the budget, and a DXF failure that leaves the STEP intact.
  • ZIP: the manifest, including notes.
  • Workbook: the Make sheet column.
  • Worker integration against mock Onshape.
  • Smoke: the downloaded ZIP holds the DXF.

Checks run locally: eslint, typecheck, unit tests (310), smoke (11), build.

Not verified live

No Onshape request was made, so these still need a live check:

  • The real body details shape: the vector form, midPoint on arc edges, isOrientedWithFace, area, and face loops that list every face's edges.
  • Whether parts linked from other documents need linkDocumentId.
  • How large the response is for a big plate.
  • That the DXF opens at the right size in LightBurn, Inkscape, or CAM.

Reads the part's body details (one Onshape request; one more for tessellated
edges only when it has a spline or ellipse) beside its STEP, and the browser
draws the largest planar face as an R12 DXF in millimetres. Files sit beside
the STEP in 2D_cut/, MANIFEST.txt lists each DXF with size and thickness or
its failure, and the Make sheet gains a DXF file column.
@greptile-apps

greptile-apps Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The changes since the previous review appear safe to merge; no new actionable issue was established.

Summary

Adds browser-drawn DXF files beside STEP files for thin, flat parts.

  • 2D-cut parts get a DXF of their flat face in the build pack.
  • Flat parts over 3 mm thick are assigned to 3D printing.

All four supplied threads are unnumbered and were manually resolved by sushilm20 without explanatory replies. No duplicate comments were added.

Reviews (3) · Last reviewed commit: "Greptile: only thickness-keyed configura..." · Reviewed by Greptile

Comment thread packages/shared/src/dxf.ts Resolved
Comment thread apps/worker/src/step-export.ts Resolved
…lates; geometry reads after STEP polls

Owner rule: a DXF only for a flat part 3 mm thick or less; a thicker one is a 3D
print. The classifier reads a stated thickness from the name or configuration,
and the export applies the same rule to tagged plates and to the thickness
measured from the body details it already reads. A person's choice wins.

Greptile: reject a pocket-floor face and blind recesses so the DXF never cuts
the wrong shape, and read DXF geometry after STEP starts and polls so a rate
limit on it cannot cost a STEP its deadline.
@sushilm20

Copy link
Copy Markdown
Contributor Author

@greptile review

Comment thread packages/shared/src/thickness.ts Resolved
Comment thread apps/web/src/app/useControlKit.ts Resolved
… are thickness; workbook DXF names say when the export's measurement decides
@sushilm20

Copy link
Copy Markdown
Contributor Author

@greptile review

@sushilm20
sushilm20 merged commit e492b8d into main Oct 29, 2026
2 checks passed
@sushilm20
sushilm20 deleted the feat/dxf-flat-parts branch October 29, 2026 03:00
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.

1 participant