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…
A floor plan is more than just a series of pixels on a screen. When an export feature converts that digital design into a format usable by Computer-Aided Design (CAD) software, it is crucial that the exported file preserves the intended meaning and dimensions of the original design. The export feature in FloorDraft, a 2D floor-plan editor, is designed to address this challenge.
In this process, three distinct scales must be kept separate: the relationship between drawing coordinates and real-world dimensions, the viewport zoom, and the scale used to print the result. Only the first of these scales should be included in the model-to-CAD conversion. The software stores a calibration factor in millimetres per pixel alongside the design. When exporting to a DXF file, this calibration factor is divided by 1, 10, or 1000 to reflect the desired units - millimetres, centimetres, or metres.
This multiplier is then applied to the geometry, while the file's unit setting is updated to match. For instance, a line of 320 coordinates with a calibration of 12.5 millimetres per unit represents 4000 millimetres. In a centimetre DXF file, this length should be exported as 400, and in a metre file as 4. Simply changing the unit metadata without adjusting the coordinates can disrupt this relationship and result in inaccurate measurements.
Other critical aspects include text height and dimension offsets. For example, a text height of 100 millimetres becomes 0.1 units in a drawing based on metres. Geometry can be correct while annotations become oversized if they cross a different conversion path.
The vertical axis of the CAD drawing runs upwards, whereas in the editor it runs downwards. The export feature addresses this by negating the vertical coordinate during the conversion process. This reflection not only affects endpoints but also furniture insertion angles and door arcs. Negating a centre point but leaving the rotation unconverted can result in objects that have the correct position but incorrect orientation.
When exporting a door symbol, it is important to note that the symbol does not necessarily cut the wall behind it. In FloorDraft, the opening associated with a wall contributes an interval that is removed from the wall geometry during export. If this distinction is not maintained during the handoff to the CAD application, the user may see a door on screen but assume there is also an opening in the exported wall.
Before exporting, FloorDraft performs several checks to ensure the file can be exported coherently and that the recipient can trust the measurements. These checks include ensuring a calibrated reference is not negative or non-finite, a referenced wall exists, linked openings are within their respective walls, and overlapping openings on the same wall are avoided. The software also identifies estimated dimensions and free openings as warnings rather than silent claims of accuracy.
Finally, a compact acceptance fixture for testing the exporter includes a known-length wall, a linked door, a free opening, and a rotated piece of furniture. The user should verify the distance, structure, orientation, readability, warnings, and view independence of the exported file. These are suggested acceptance checks, but they do not guarantee that every CAD application has been tested. Opening the fixture in the application your recipient uses will catch practical interoperability problems.
Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.