Skip to main content

Polylines, DXF and the Solid API

From drafted contours to production-ready solids

drawing

Extruded polyline2d

Introduction

Aluminium profiles for windows, sliding doors, and façade systems are often designed in AutoCAD as simple 2D polylines. These contours precisely define the shape of a profile—but on their own, they’re just the starting point.

The moment you introduce automation or configurators, those polylines need to turn into real geometry: extruded to length, cut into mitered segments, machined with additional features, and equipped with connection points for reliable assembly.

At that stage, CAD drawings are no longer enough. Geometry needs to be explicit, structured, and machine-ready. This short article shows how we make that transition—turning AutoCAD polylines into a clean, neutral JSON representation that powers automated modeling and assembly.

You can find the full working code in our example GitHub repository.


From DXF to a Single Source of Truth for Geometry

DXF is an incredibly capable format—and it even supports 3D—but in practice it is most often used as a 2D drafting container. That flexibility is also its biggest drawback: a DXF file can contain layers, blocks, construction geometry, annotations, and multiple alternative contours. Before you can even use the geometry, you first have to decide what actually matters.

Rather than pushing this complexity downstream, we made a deliberate choice to move the semantic decision upstream.

Inside AutoCAD (or compatible AutoCAD-style tools), we use a dedicated exporter that extracts only the intended polyline contours and writes them into a clean, purpose-built JSON format. This exporter is implemented in AutoLISP—with a little help from AI. An example JSON file and the export.lsp script (tested with the 4MCAD clone) can be found in the project’s resource folder. Please note: We export multiple polylines that represent inner and outer loops of the region / face to be extruded.

This JSON format is directly supported by our Curve API, meaning what you export is exactly what the API consumes—no guessing, no filtering, no interpretation layers in between.

The result is a lightweight, text-based representation of geometry that focuses purely on what matters:

  • explicit contours via points array
  • exact arcs via bulges
  • clear closure and orientation

This JSON file becomes a neutral single source of truth for contour geometry.

Because it’s plain text, it fits naturally into modern development workflows:

  • it can be versioned and reviewed in Github
  • it can be hosted and loaded via URL
  • and it can be consumed directly by ClassCAD without any preprocessing

In short, DXF remains where it belongs: a powerful authoring format for designers.
The exported JSON becomes the exchange and runtime format—explicit, deterministic, and designed for automation.


From Curve to Solid: The Straightest Path

Once exported, the JSON contour is consumed directly by the Curve API using api.curve.polyline2d. From there, the transition to 3D is immediate: api.solid.extrusion turns the 2D profile into a production-ready solid. Make sure that the polylines are all closed and do not overlap to guarantee a correct extruded solid.

This is the most direct path from a drafted profile to a solid model: no layer parsing, no heuristics, no ambiguity—just explicit curves, explicit solids, and a pipeline built for automation.


Try It Yourself in the Browser!

You can run the entire workflow directly in the browser using WASM—no installation required.
The first load may take a moment, but after that it’s smooth sailing.

git clone https://github.com/awv-informatik/buerli-examples
Follow the README