Skip to content

Port acad-ts fixes back to here - #1316

Open
jogibear9988 wants to merge 15 commits into
DomCR:masterfrom
jogibear9988:codex/port-acad-ts-dwg-improvements
Open

jogibear9988 wants to merge 15 commits into
DomCR:masterfrom
jogibear9988:codex/port-acad-ts-dwg-improvements

Conversation

@jogibear9988

@jogibear9988 jogibear9988 commented Oct 18, 2026 •

Copy link
Copy Markdown

Preserves CAD content during DWG rewrites, fixes FIELD graph output and MTEXT plain-text extraction, and adds R12 ASCII/binary DXF, R12 DWG I/O, R13 DWG export and R2007 DWG export.

The branch is rebased on master 90c6f871 (v3.8.35). It contains 15 implementation/test commits; documentation-only commits and Markdown changes have been removed.

Changes:

  • Preserve SAT/SAB/ASM geometry, wireframes, material mappings and revision GUIDs, including paged R2013+ AcDs storage.
  • Preserve visual styles, table content/formatting/references, EED, XRecord handles, DIMASSOC point references and frame-only MTEXT layouts.
  • Recover space ownership and viewport references; implement transforms, font XData roundtrips and reader reuse.
  • Prepare orphan FIELD ownership/handles before HANDSEED and class-table output, and serialize nested FIELD records without duplicates.
  • Strip MTEXT formatting codes, render stacked fractions and handle missing terminators safely.
  • Add legacy DXF/DWG serialization with native fixtures and R2007 CRC64/Reed–Solomon page encoding.

Validation of the unchanged implementation: .NET 9 reports 2,679 passed, 2 skipped, 3 known failures (two Arc floating-point equality assertions and one DimensionStyle culture-formatting assertion). All six library targets build. Native-fixture/CRC, FIELD graph, Unicode, multiple-page and R2007 parity checks pass. git diff --check passes. Documentation removal was verified to leave implementation, tests and fixtures byte-for-byte unchanged.

Independent ODA conversion of the C# R12/R2007 DWG outputs has not been run. R12 DWG retains limited primitive/text/block/attribute/polyline/mesh and basic table/header coverage; its reader uses Windows-1252, and extended data, overflow polylines and SHAPE/DIMENSION/VIEWPORT geometry are not retained. The default paper-size viewport is omitted. ACIS preservation does not provide a modeling engine.

AI-assisted implementation, with source comparison, conflict-resolution review and the validation above.

@jogibear9988 jogibear9988 changed the title Port missing DWG geometry, serialization and pre-sync fixes from acad-ts Port DWG preservation fixes and add R12 DXF / R13 DWG support Oct 19, 2026
@DomCR

DomCR commented Oct 21, 2026

Copy link
Copy Markdown
Owner

Hi @jogibear9988,

Thanks for your interest in the project, but this PR doesn't seem to be focus on anything in particular, please check the guidelines for the contributions https://github.com/DomCR/ACadSharp?tab=contributing-ov-file.

@DomCR DomCR added the invalid This doesn't seem right label Oct 21, 2026
@jogibear9988

Copy link
Copy Markdown
Author

Sorry, only thought to bring back changes I did in my ported TS version. I'll get that you cannot merge them like this, cause it's to huge and unspecific. (and maybe to less tested).
I still will update it whenever in acad-ts smth was changed so someone can use this as a diff between the versions.

@DomCR

DomCR commented Oct 21, 2026

Copy link
Copy Markdown
Owner

I've had a quick look at the PR, there are some interesting things that I want to include in the library, but as you well said, I cannot merge this as it is right now.

You can leave this one open if you want and I'll be taking a look at the changes that I may be interested and merge them into the library in other PRs.

@jogibear9988

jogibear9988 commented Oct 21, 2026 •

Copy link
Copy Markdown
Author

If you change smth, I'll convert it back at some time also.
I'll look to stay in sync.

@jogibear9988
jogibear9988 force-pushed the codex/port-acad-ts-dwg-improvements branch from 581fd21 to 2d681f5 Compare October 26, 2026 16:38
@jogibear9988 jogibear9988 changed the title Port DWG preservation fixes and add R12 DXF / R13 DWG support Port acad-ts preservation and MTEXT fixes; add legacy DWG/DXF support Oct 26, 2026
@jogibear9988

Copy link
Copy Markdown
Author

@DomCR If you'd like to, I also can create a pull request for each fix? Should I? Do you need also a issue then or is a pull request enough?

Port the remaining acad-ts c4ecf35b, 319474b1 and 887fc2bc behavior after
upstream's modeler refactor: preserve SAT/SAB and ASM payloads, wireframes,
material mappings and revision metadata, and emit R2013+ AcDs geometry.
Keep upstream DXF serialization, public Guid/HasWireframeData APIs and
hard-ownership history handles. Remove duplicated entity-writer cases.

Round-trip imported sample payloads across DWG versions and verify that
the public revision GUID survives DWG-to-DXF conversion.
Port acad-ts 3b9358f2. Store payloads above 256 KiB in ordered blob01 pages, construct a dynamic segment directory and preserve mixed inline/blob records. Cover threshold, exact page boundaries, partial pages and three-page records for Solid3D, Region and CadBody in R2013/R2018.

Validation: all 18 modeler regression tests pass.
Port remaining layout fixes from acad-ts aea83296 and 319474b1: fixed-width XRecord handles, legacy EED byte counts and big-endian codepage indexes, frame-only MTEXT fields, empty CadValue strings and block representation ownership. Serialize full DIMASSOC geometry paths, intersections and nested point references, and suppress duplicate queued objects.

Validation: eight new layout regressions and 45 focused modeler/XData/layout tests pass against the original sample drawings.
Port acad-ts aea83296's fixed version-specific sequence, R2010 property operations and R2013 extended values. Preserve true edge colors and clone retained arrays independently. Enable serialization for supported modern versions.

Validation: R2010/R2013/R2018 original sample styles retain their values and operations, and all 18 modeler regressions pass.
Port acad-ts c95eeb20, aea83296 and 319474b1 table fixes. Bind field/block/attribute/style and linetype references, retain linked-data fields, cell geometry collections and owned fields, and preserve standard cell-style roles. Correct top borders and R2007 row-style layouts; migrate pre-2007 table-style roundtrip metadata.

Validation: modern table regressions retain block attributes, fields, linked data, multiple geometry records and empty strings in R2010/R2013/R2018; existing table and modeler tests pass.
Port pre-sync acad-ts c4ecf35b and 94a49da4. Attach entities identified as model/paper space even when Inventor omits block ownership, supplement legacy chains without duplicates, resolve base/named UCS values and bind viewport visual styles.

Validation: ownership/viewport template regressions and all 18 modeler tests pass.
Port pre-sync acad-ts 94a49da4 and c95eeb20. Transform leader anchors, normalized directions, break pairs, rotations and scaled dimensions; derive wall bounds from justification, height and thickness and keep dimensions consistent under transforms. Preserve TextAngle's C# enum semantics.

Validation: regressions cover rotated/scaled leader geometry and nonuniformly scaled wall bounds.
Port pre-sync acad-ts e324dd83 for DWG and DXF. Synthesize font-family and bold/italic XData without mutating source records, restore FontFlags during template construction, preserve custom ACAD records and existing pitch/charset bits, and exclude SHX styles.

Validation: DWG/DXF public roundtrips plus SHX and existing-bit preservation regressions pass.
Port pre-sync acad-ts 494357c5 and its empty-text-stream correction. Retain independent reader cursors over shared buffers across objects, reset text-stream emptiness on repositioning and queue each valid handle only once.

Validation: existing DWG sample reader tests and a present-after-absent text-stream regression pass.
Port the shared TABLEROW_END typo correction from pre-sync acad-ts c95eeb20.
@jogibear9988
jogibear9988 force-pushed the codex/port-acad-ts-dwg-improvements branch from 2d681f5 to 05059da Compare October 28, 2026 15:37
@jogibear9988 jogibear9988 changed the title Port acad-ts preservation and MTEXT fixes; add legacy DWG/DXF support Port acad-ts preservation, FIELD and MTEXT fixes; add legacy formats Oct 28, 2026
@DomCR

DomCR commented Oct 28, 2026

Copy link
Copy Markdown
Owner

@DomCR If you'd like to, I also can create a pull request for each fix? Should I? Do you need also a issue then or is a pull request enough?

Sure, opening an issue is not needed.

I would recommend to open 1 PR at a time, the repo is already experiencing an overflow of PRs and is quite difficult to keep up.

Thanks.

Port acad-ts 6bbc81cd and a0843a3c. R12 uses byte-aligned records,
legacy symbol tables, CRC checks, unique handles and sequence addresses.
R2007 uses RS-protected pages, CRC64, repeated maps and Unicode metadata;
the reader accepts uncompressed metadata and system pages.

Validate R12 against the native fixture and strict CRC checks. Reproduce
native R2007 header parity and both CRC seeds, exercise 2,500-line page
boundaries, and enable the existing R2007 single-object writer cases.
Extend the optional ODA conversion tests without claiming they ran here.
Port acad-ts 5bf4c0ee and 60b92017. FIELDLIST references can contain orphan
fields whose handles and owners have not been assigned. Register their
parent graphs before HANDSEED and the DXF class table, preserve existing
child/dictionary ownership, and enqueue nested FIELD records for output.
Retain C# observable child collections and existing handle deduplication.

Six regressions cover list/dictionary roots, nested references, child-first
order, high handles, extension dictionaries and stable repeated writes.
@jogibear9988 jogibear9988 changed the title Port acad-ts preservation, FIELD and MTEXT fixes; add legacy formats Port acad-ts fixes back to here Oct 28, 2026
@jogibear9988

This comment was marked as off-topic.

This branch has not been deployed

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

Labels

invalid This doesn't seem right

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants