Skip to content

Preserve ACIS modeler data when rewriting DWG files - #1350

Open
jogibear9988 wants to merge 1 commit into
DomCR:masterfrom
jogibear9988:codex/fix-dwg-modeler-preservation
Open

jogibear9988 wants to merge 1 commit into
DomCR:masterfrom
jogibear9988:codex/fix-dwg-modeler-preservation

Conversation

@jogibear9988

Copy link
Copy Markdown

Description

Rewriting a DWG containing Solid3D, Region or CadBody can lose imported ACIS geometry or its wireframe/revision data. The inline reader returns before consuming the complete modeler record, binary ASM payloads are not recognized, and R2013+ output does not write the AcDs geometry section.

This preserves the existing SAT/SAB/ASM payload bytes through DWG conversions, reads the rest of the modeler record at the correct position, and writes the geometry's AcDs data and handle indexes for R2013+. It uses master's public modeler GUID API and modeler templates, retaining material handle references alongside their raw mapping values.

Tasks done in this PR

  • Serialize inline SAT and binary modeler data and preserve points, wires, silhouettes, material mappings and revision metadata.
  • Write R2013+ AcDs geometry records with schema/data/handle indexes and read their data headers in local-offset order.
  • Add 14 regression cases: six source-version sample cases each converted to six target versions, SAT/ASM and wireframe roundtrips across six versions, and two DWG-to-DXF GUID cases.

Related Issues / Pull Requests

Extracted from #1316, source commit 52af836f. This PR contains one implementation commit on current master (90c6f871); it can be reviewed and merged independently. The aggregate PR #1316 remains unchanged and continues to hold the other fixes. Large-payload blob paging is a separate follow-up retained there.

The source behavior comes from acad-ts c4ecf35b, 319474b1 and 887fc2bc.

Notes for reviewer

A reproducible case is loading an existing samples/sample_AC1027.dwg, writing it with DwgWriter, then reading the result and comparing every modeler entity's AcisData by handle. ModelerGeometryWriterTests.SamplePayloadsSurviveVersionConversions performs this check for 36 source/target combinations. The synthetic tests also verify inline payloads, wireframe coordinates and GUID preservation through a subsequent DXF conversion.

Validation on this isolated branch:

  • dotnet test src/ACadSharp.Tests/ACadSharp.Tests.csproj -f net9.0 --filter FullyQualifiedName~ModelerGeometryWriterTests: 14 passed.
  • Full .NET 9 suite: 2,512 passed, 2 skipped, 3 failed. The failures are the previously observed ArcTests.CreateFromBulgeTest, ArcTests.GetCenter, and the culture/scientific-format case in DimensionStyleTests.GetLinearMeasurementText.
  • Library builds for net8.0, net9.0, net10.0, net48, netstandard2.0 and netstandard2.1.
  • git diff --check passes.

These are library roundtrip/build results; independent ODA conversion has not been run for this standalone PR. ACIS payload preservation does not provide a modeling engine.

AI-assisted port and extraction, with source comparison, isolated regression testing and review of the resulting diff.

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.

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

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant