Skip to main content
SimpleGeometry lets you describe a part (or sheet) outline directly, as a set of straight lines and arcs, instead of supplying a DXF file. It’s the right choice when your parts come from a configurator, a database, or your own CAD kernel and you’d rather hand NestAPI the geometry than round-trip through files.
Builder libraries are coming. We plan to publish helper libraries that let you build NestAPI geometry from your own representation with a fluent builder — AddPart()AddOuterLine(...)BeginInnerPolygon()... — and produce the packaged request for you. Until those ship, the format below is what you construct and encode by hand. The shape is the same either way, so anything you build now stays valid.

The model

A SimpleGeometry is a list of parts. Each part has one outer boundary and zero or more inner boundaries (holes). Each boundary is a closed loop of primitives — lines and arcs.
Every primitive is tagged with a PrimitiveType discriminator — "Line" or "Arc" — and this field is required on each one. The value is case-sensitive. SimpleLine SimpleArc

Winding and arcs

Closure and winding direction

Each boundary must be a closed loop: the primitives are taken in order, each one’s end meeting the next one’s start, and the last meeting the first. Closure is not validated — an open or self-crossing loop fails silently rather than returning an error, so make sure your outlines close exactly. You do not need to supply a particular winding direction. NestAPI normalizes every boundary (it reverses any loop that arrives clockwise), and the outer-vs-hole distinction is decided purely by whether you place a polygon in Outer or in Inners — never by its direction. Supply each loop in whichever order is natural for you.

Arc geometry

An arc is defined by its start point, its centre, and a signed sweep — you do not pass a radius or an end point:
  • The radius is taken from the distance between the start point and the centre, so the start point must lie on the arc.
  • OffsetAngleRadians is the angle swept about the centre, in radians. Positive sweeps counter-clockwise; negative sweeps clockwise. Its magnitude is the arc’s included angle — π (≈ 3.14159) for a semicircle, π/2 for a quarter.
  • The end point is derived: the start point rotated about the centre by OffsetAngleRadians.
  • Do not pass 0 — a zero sweep is degenerate.

Example

A 200 × 100 part with a 40 × 20 rectangular hole, using lines only:
An arc primitive — here a semicircle from (200, 40) to (200, 60) about centre (200, 50), sweeping counter-clockwise (bulging out to x = 190):
Flip the sign to -3.14159 for the same semicircle sweeping clockwise (bulging to x = 210).

Packaging and submitting

SimpleGeometry is not sent as a top-level request field. Each part carries its geometry as an encoded string, and you flag the encoding on the part. The packaging is specific:
1

Serialize the SimpleGeometry to JSON

Produce the JSON shown above. Keep the PrimitiveType discriminator on every primitive.
2

Zip it, then base64-encode

Write the JSON as a single entry inside a ZIP archive (a standard zip container — not raw gzip/deflate), then base64-encode the archive bytes. NestAPI reads the first entry of the archive.
3

Attach it to the part and flag the encoding

Put the base64 string in the part’s EncodedPartJson and set GeometryDefinitionType to PreZippedBase64SimpleGeometry.
4

Submit

POST /v1/nesting/geometry with the parts (and sheets) in the Request body, as usual — see the nesting workflow.
So a single part in the request body ends up like:
Sheets work the same way: a sheet outline can be supplied as SimpleGeometry in EncodedSheetJson with the same GeometryDefinitionType. (Rectangular stock is more often described by dimensions — see parts & sheets.)

When to use it

  • Use SimpleGeometry when you already hold outline geometry (lines/arcs) and don’t want to emit and re-import DXF files.
  • Use DXF (POST /v1/nesting) when your parts originate from CAD as files.
  • Use parametric (POST /v1/nesting/parametric) when parts are described by parameters rather than explicit outlines.
See geometry types for the full comparison.