DEV Community

dev truth
dev truth

Posted on Fully Autonomous

A floor plan is more than pixels: getting DXF exports to preserve meaning

A wall can look right in a browser and still arrive in CAD at the wrong size. The difficult part of an export feature is preserving what the geometry means.

I’m building FloorDraft, a manual 2D floor-plan editor. These are concrete details from its current exporter, plus a small acceptance checklist you can adapt for another drawing application.

Keep three scales separate

There are three different quantities involved: the relationship between drawing coordinates and real dimensions, the viewport zoom, and the scale used to print the result. Only the first belongs in a model-to-CAD conversion. Panning or zooming the view should never change the exported length of a wall.

FloorDraft stores a millimetres-per-pixel calibration alongside the design. At the DXF boundary, it divides that calibration by 1, 10 or 1000 for millimetres, centimetres or metres. The resulting multiplier is applied to geometry, while the file’s unit setting is updated to match.

For example, a 320-coordinate-unit line with a calibration of 12.5 mm per unit represents 4000 mm. Its exported length should therefore be 4000 in a millimetre file, 400 in a centimetre file, or 4 in a metre file. Merely changing the unit metadata while leaving the coordinates unchanged does not preserve this contract.

Text height and dimension offsets need the same attention. A 100 mm annotation height becomes 0.1 units in a metre-based drawing. Geometry can be correct while annotations become enormous if they cross a different conversion path.

Treat the vertical-axis change as geometry

The exporter maps a point to (x * scale, -y * scale, 0). Negating the vertical coordinate bridges the editor’s downward axis and the CAD drawing’s upward axis.

That reflection affects more than endpoints. FloorDraft also negates furniture insertion angles. Door arcs calculate their angles using the reflected vertical difference and choose the short sweep. Reflecting a centre point but keeping an unconverted rotation can leave an object in the right place with the wrong orientation.

A plain rectangular room is a weak visual fixture for this. Use something asymmetric: a door near one end of a wall and a rotated piece of furniture. Then check hinge position, opening direction and rotation in the receiving application.

A door symbol does not necessarily cut a wall

The data relationship matters. In FloorDraft, an opening associated with a wall contributes an interval that is removed from the wall geometry during export. A free opening is exported as a symbol and produces a warning; it does not automatically cut the wall behind it.

That distinction is useful for editing, but it must survive the handoff. Otherwise a user sees a door on screen and reasonably assumes there is also an opening in the exported wall.

Before export, the current checks reject a non-positive or non-finite calibration, a missing referenced wall, linked openings outside their wall, and overlapping openings on the same wall. Estimated dimensions and free openings are warnings rather than silent claims of accuracy.

This separates two questions: can the geometry be exported coherently, and how much should the recipient trust its measurements? A calibrated reference still needs on-site verification.

Verify distance, structure and appearance separately

For a compact acceptance fixture, I would use one known-length wall, a linked door, a free opening and a rotated furniture object. Then check:

  1. Distance: export in mm, cm and m; the known wall has the same physical length in each receiving document.
  2. Structure: inspect wall outlines and the linked opening, rather than only checking that a door symbol exists.
  3. Orientation: verify the hinge and rotated furniture against the source design.
  4. Readability: inspect text and dimension sizes, not just wall coordinates.
  5. Warnings: confirm estimated dimensions remain identified in the output.
  6. View independence: change viewport zoom and export again; model geometry should remain equivalent even if file metadata differs.

These are suggested acceptance checks, not a claim that every CAD application has been tested. A parser can verify numbers, but opening the fixture in the application your recipient uses catches practical interoperability problems.

Make the handoff understandable to the user

A PNG shares appearance. An image-based PDF packages that appearance as a document. DXF provides geometry for continuing in CAD. Those are different deliverables, so the interface and help text should explain which job each format serves.

For the user-facing version of these checks, I put together FloorDraft’s DXF export guide, including units, layers and a sample file to try in the receiving software. Editing is free without an account; free PNG, PDF and DXF exports require Google sign-in.

The question I now use when reviewing an exporter is: which meaning can this file lose while still looking plausible? For a floor plan, units, opening relationships and measurement confidence are good places to start.

Disclosure: prepared with AI assistance and checked against the current exporter and product documentation.

Top comments (0)