Open general

POST /create-part: parametric mechanical parts (primitives + booleans) to STEP

John Lauer · 4d ago

The gap

Adom tools that need simple machined or bought mechanical parts (a standoff, a spacer, a shaft hub, a motor envelope) have no way to make their STEP on the shared OCCT service. The endpoints that make geometry are package or board recipes: /create-chip (chip_3d package families), /create-footprint (pads on board stock), /compose-vias, /laser-etch. So each tool falls back to a local CadQuery script, and the geometry no longer comes from one service.

A probe showed /create-footprint will extrude an 8 mm round pad with a 3.2 mm drill through 62 mm of "board" (job ec9e862ef70943e7). That is a misuse, not a part: it carries pad copper and board stock, and it cannot make a D-flat, a counterbore, a chamfer or a union of two cylinders.

Request: POST /create-part

A JSON solid built from primitives with booleans, returned as a named, coloured STEP (async job like the others):

{
  "name": "rig-hub-5mm-d",
  "units": "mm",
  "color": "#b9bdc3",
  "material": "6061 aluminium",
  "body": {"union": [
    {"cylinder": {"d": 14.0, "h": 1.0, "at": [0, 0, 0]}},
    {"cylinder": {"d": 7.98, "h": 1.5, "at": [0, 0, 1.0]}},
    {"cylinder": {"d": 8.0, "h": 6.0, "at": [0, 0, 2.5]}}
  ]},
  "cut": [
    {"dshaft": {"d": 5.02, "flat": 4.52, "h": 20, "at": [0, 0, -5]}},
    {"cylinder": {"d": 2.5, "h": 6, "at": [0, 0, 5.5], "axis": [1, 0, 0]}}
  ],
  "chamfer": [{"edges": "top-outer", "size": 0.3}]
}

Primitives that would cover most fixtures: box, cylinder (with axis), tube (od, id), dshaft (d, flat), extrude (a 2D outline polygon or arcs, with holes), revolve (a 2D profile), fillet and chamfer by edge selector, and translate / rotate on any node. A second form, POST /create-assembly, would take a list of named parts (STEP job ids or inline specs) with 4x4 placements and colours and return one assembly STEP.

Concrete first use

An encoder test fixture needs four turned parts: an 8 mm x 62 mm standoff with M3 tapped ends, a 7 x 5.02 x 1.283 mm ground spacer, a magnet holder (14 mm OD, a 10 x 4 mm magnet pocket, a 5 mm bore 9.5 mm deep), and the hub above (D bore, spigot, flange, M3 set-screw hole). It also needs a NEMA 17 envelope (42.3 mm square body with chamfered corners, 22 mm pilot, 5 mm D-shafts both ends). Each of these is a few primitives.

Why it belongs on the service

  • One kernel and one STEP writer for every Adom tool, the same as conversion.
  • The result converts straight to GLB on the same service with colours preserved.
  • No tool has to install CadQuery or OCP.

0 Replies

Log in to reply.