Skip to content

CAD: choose the DWG/DXF version to write (e.g. AutoCAD 2013) #489

Closed

Description

@KnifeLemon

From discussion #483: save DWG/DXF in an older AutoCAD version, e.g. a 2026 drawing as 2013, so older AutoCAD/CAD programs can open it.

Today every DWG and DXF Filee writes is AutoCAD 2018 (AC1032), see CadFile.OutputVersion in src/Filee.Engines/Cad/CadFile.cs.

Idea:

  • A version choice on the CAD presets (DWG → DWG, DXF → DXF, DWG ↔ DXF): 2018 (default), 2013, 2010, 2007, 2004, 2000 — limited to the versions ACadSharp can write; check which ones round-trip.
  • DXF below 2007 isn't UTF-8: Korean/Chinese text needs the drawing's code page ($DWGCODEPAGE), so check that text survives.
  • Entities the older version doesn't have should be dropped or simplified with a clear note, not fail the whole file.
  • Tests: write each version and read it back.

Activity

  1. self-assigned this
    on Oct 23, 2026
  2. cre8ive-marketing commented on Oct 23, 2026

    @cre8ive-marketing
    Collaborator

    @KnifeLemon Happy to take this one if you'd like to assign it to us. It fits the CAD work in #471.

    The plan: one option on CAD presets, DWG/DXF version (Same as the source, AutoCAD 2018, 2013, 2010, 2007, 2004 or 2000), passed to ACadSharp's writer. ACadSharp is already in Filee, so nothing new is added. We'd also add a test that reads each written version back.

  3. KnifeLemon commented on Oct 23, 2026

    @KnifeLemon
    OwnerAuthor

    Thanks @cre8ive-marketing, it's yours! The plan looks right. Two things I checked in ACadSharp 3.8.0 (the version Filee ships) that the PR should handle:

    1. DWG 2007 can't be written. DwgWriter throws CadNotSupportedException for AC1021; R14, 2000, 2004, 2010, 2013 and 2018 work, and DXF works for all of them. So either leave 2007 out of the DWG choices or write 2004 for it, and decide what "Same as the source" does for a 2007 DWG (2010 seems the natural choice).
    2. Text in versions before 2007. R14/2000/2004 store text in the drawing's code page ($DWGCODEPAGE), not UTF-8, and ACadSharp encodes with that code page as is, without \U+XXXX escapes. A 2018 drawing with Korean or Chinese text often still says ANSI_1252, so saving it as 2004 would turn the text into ?. Please pick the code page from the text when writing an older version (ANSI_949 Korean, 936 Simplified Chinese, 950 Traditional Chinese, 932 Japanese …) and write any character the code page can't hold as \U+XXXX, so mixed scripts survive too.

    For the tests: besides reading each written version back, include a drawing with Korean and Chinese text saved as 2000/2004 and check the text comes back unchanged.

  4. cre8ive-marketing commented on Oct 23, 2026

    @cre8ive-marketing
    Collaborator

    @KnifeLemon #497 adds this. It isn't released yet.

    • Version choice on DWG/DXF presets: 2018 (default), 2013, 2010, 2007, 2004, 2000, or the source's own. DWG → DWG and DXF → DXF are routes now.
    • DWG 2007: chosen, it's written as 2004, which AutoCAD 2007 opens. Kept from a 2007 source, it's written as 2010, as you suggested.
    • Code page: for 2004 and older, it's picked from the text (ANSI_949, 936, 950, 932 …), and anything that page can't hold is written as \U+XXXX. One finding: ACadSharp 3.8 doesn't know the name ANSI_949 (it writes UTF-8 / 1252), so Korean is encoded through KCS5601 and the DXF header is renamed to ANSI_949 after writing.
    • Newer objects (tables and arc dimensions before 2004, multileaders and PDF underlays before 2007, meshes before 2010) are left out with a note instead of failing the file.
    • Tests: every version × DWG/DXF reads back with its entities, and Korean, Chinese and mixed text come back unchanged at 2000 and 2004.
  5. added a commit that references this issue on Oct 23, 2026
  6. cre8ive-marketing commented on Oct 25, 2026

    @cre8ive-marketing
    Collaborator

    Update: Filee 2.1.0 is out with #497. DWG and DXF presets have a version choice (2018, 2013, 2010, 2007, 2004, 2000, or the source's own). Update from About → Check now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

enhancementNew feature or request

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions