DXF

From Tygron Support wiki
Revision as of 13:41, 28 November 2022 by Frank@tygron.nl (talk | contribs)
Jump to navigation Jump to search

DXF[1] is a file format to exchange CAD data from Autodesk. It is the "open" variant of the "closed" DWG[2] format.

DXF file data

A DXF file is subdivided in several sections. The sections in this file that we inspect are:

  • HEADER: contains location and scaling information
  • GEODATA: contains geo-location information
  • TABLES: containing definitions of layers
  • ENTITIES: containing 2 and 3 dimensional shapes
  • BLOCKS: containing 2 and 3 dimension shapes, reusable using INSERTS in ENTITIES.

Entities

DXF shapes.png

Currently, the following Autodesk CAD shape types are supported for entities and blocks:

  • LWPOLYLINES (2 dimensional line strings), including bulges.[3]
  • LINE (single lines).[4]
  • POLYLINE (3 dimensional line strings), currently only interpreted as 2 dimensional. The z-coordinate is ignored.[5]
  • HATCH (polygonal data constructed using other boundary entities).[6]
  • CIRCLE: full and partial circles, given a center point, radius and start and end angle.[7]
  • ELLIPSE: full and partial ellipses, given a center point, major and minor axis, rotation and start and end angle.[8]
  • ARC: curved lines given a center point and a radius.[9]
  • VERTEX: 2 dimensional point.[10]
  • POINT: Same as vertex, but 3 dimensional. Currently only interpreted as 2 dimensional. The z-coordinate is ignored.[11]
  • SPLINE: 2 dimensional Control point splines are currently supported.[12] Fit point splines are currently not supported.
  • INSERT: Predefined BLOCKS inserted at a point and with a rotation and a scale.[13]

Blocks

Blocks (BLOCKS) are parts in a CAD drawing that can be reused multiple times by inserting them at different locations with optional alternative rotations and scales. The usage of blocks in a DXF is supported.[14]

Blocks can consist of shapes similar as to those definable in entities, including the insertion (INSERT) of other blocks. Each of these shapes can belong to a different layer. BLOCKS can also have attribute defined (ATTDEF) for them. These attributes can contain any string value.

Each block is converted to one or more unique feature(s). Features within a block are kept separate when they belong to different layers. For example, a house block can consist of:

  • An inserted block for the house itself
  • A shape for the back garden
  • A shape for the front garden
  • A shape for the garden shed
  • A shape or block of the garage
  • A shape for the parking lane

where the inserted house block:

  • Has a rectangular shape that can be re-scaled for each insert into a parent block.
  • Has attribute definitions describing for example:
    • the floor height;
    • amount of floors;
    • the slanted roof height;
    • the amount of units in the building, or the unit size;

Layers

In the DXF file, entities are always assigned to one particular layer. In AutoCAD, layers can be turned on and off. This visibility does not influence whether or not the entities in this layer can be imported.


Line stiching

DXF line overlap.png

Not all lines are drawn as closed lines, even though they look closed visually. For example, splines have been encountered that look closed from far away but are actually overlapping. For lines that overlap between start and end point, a line-closing-algorithm will be executed.

Lines to Multi-Polygons

Shapes within a layer can be subtracted from each other, without the requirement of hatching the shape. For example, multiple line rings are drawn within each other. By subtracting these correctly, multi-polygons can be created with the expected inside and outside.

Colors

Colors are stored by index[15].

How-to's

References

  1. Cite error: Invalid <ref> tag; no text was provided for refs named ref-DXF
  2. Cite error: Invalid <ref> tag; no text was provided for refs named ref-DWG
  3. LWPOLYLINES ∙ Found at: https://knowledge.autodesk.com/support/autocad/learn-explore/caas/CloudHelp/cloudhelp/2022/ENU/AutoCAD-Core/files/GUID-392BF13C-D9E7-47A8-8E07-435296332279-htm.html ∙ (last visited: 26-9-2022)
  4. LINE ∙ Found at: https://knowledge.autodesk.com/support/autocad/learn-explore/caas/CloudHelp/cloudhelp/2022/ENU/AutoCAD-Core/files/GUID-DB0FA734-8F5C-4000-92FF-89BA2D42CA21-htm.html ∙ (last visited: 26-9-2022)
  5. POLYLINE ∙ Found at: https://knowledge.autodesk.com/support/autocad/learn-explore/caas/CloudHelp/cloudhelp/2022/ENU/AutoCAD-Core/files/GUID-392BF13C-D9E7-47A8-8E07-435296332279-htm.html ∙ (last visited: 26-9-2022)
  6. HATCH ∙ Found at: https://knowledge.autodesk.com/support/autocad/learn-explore/caas/CloudHelp/cloudhelp/2023/ENU/AutoCAD-Core/files/GUID-27C104F2-B687-4025-B50B-A58E37329832-htm.html?us_oa=akn-us&us_si=8126699c-9f97-4fa3-9b23-fa556e058edb&us_st=Hatch ∙ (last visited: 26-9-2022)
  7. CIRCLE ∙ Found at: https://knowledge.autodesk.com/support/autocad/learn-explore/caas/CloudHelp/cloudhelp/2022/ENU/AutoCAD-Core/files/GUID-EDC69C38-6651-46DA-AFCC-56F2EB0A6AC6-htm.html ∙ (last visited: 26-9-2022)
  8. ELLIPSE ∙ Found at: https://knowledge.autodesk.com/support/autocad/learn-explore/caas/CloudHelp/cloudhelp/2022/ENU/AutoCAD-Core/files/GUID-2461D382-B7E5-44B3-A34C-735CE0089C8D-htm.html ∙ (last visited: 26-9-2022)
  9. ARC ∙ Found at: https://knowledge.autodesk.com/support/autocad/learn-explore/caas/CloudHelp/cloudhelp/2022/ENU/AutoCAD-Core/files/GUID-C78378FD-4704-4D0A-9D86-82FCBB118097-htm.html ∙ (last visited: 26-9-2022)
  10. VERTEX ∙ Found at: https://knowledge.autodesk.com/support/autocad/learn-explore/caas/CloudHelp/cloudhelp/2023/ENU/AutoCAD-Core/files/GUID-84591B48-71B9-4258-B287-CD2391C946D2-htm.html ∙ (last visited: 26-9-2022)
  11. POINT ∙ Found at: https://knowledge.autodesk.com/support/autocad/learn-explore/caas/CloudHelp/cloudhelp/2023/ENU/AutoCAD-Core/files/GUID-3F5861A1-9A63-42A6-8F12-3395771BAA6D-htm.html?us_oa=akn-us&us_si=cd548ae9-dde6-4a75-bb71-c74923034ef2&us_st=Point ∙ (last visited: 26-9-2022)
  12. SPLINE ∙ Found at: https://knowledge.autodesk.com/support/autocad/learn-explore/caas/CloudHelp/cloudhelp/2023/ENU/AutoCAD-Core/files/GUID-58316136-30EB-499C-ACAD-31D0C653B2B2-htm.html ∙ (last visited: 26-9-2022)
  13. INSERT ∙ Found at: https://knowledge.autodesk.com/support/autocad/learn-explore/caas/CloudHelp/cloudhelp/2023/ENU/AutoCAD-Core/files/GUID-BC0FD3C1-3BFC-4C5D-AB9A-BF480D5084BE-htm.html ∙ (last visited: 26-9-2022)
  14. BLOCKS ∙ Found at: https://knowledge.autodesk.com/support/autocad/learn-explore/caas/CloudHelp/cloudhelp/2023/ENU/AutoCAD-Core/files/GUID-7410E7FB-3E0D-4411-B8F6-DBD59C71E87D-htm.html ∙ (last visited: 26-9-2022)
  15. AutoCAD Color Index (ACI) RGB equivalents ∙ Found at: https://gohtx.com/acadcolors.php ∙ (last visited: 26-9-2022)