Conversation
|
Rebased on current master (which now includes #1149) and added one commit. Following the discussion in #1152, I audited the AcDs writer field by field against chapter 24 of the .dwg file specification, and that audit found one real defect: in the search segment, the per-handle index stored the record's directory position instead of its rank in the sorted handle order. The two coincide when the directory is already sorted by handle, which is why every file opened fine so far; a file saved by AutoCAD with out-of-order handles shows the correct behavior. The new commit fixes it and adds regression tests built from that file. |
|
Rebased on current master (3.6.51). Beyond the rebase the only change is in the AcDs round-trip tests: they now read the written section back through the Prototype1b reader, since the old AcDs reader went away with #1154. The writer itself is untouched, and the build and those tests are green on the new master. |
|
Hi @ilCosmico, I'm currently looking into the implementation of Prototype1b, I won't be able to check the writer until the reader is stable. Keep in mind that the writer is always more difficult to implement, there has to be a manual testing with different softwares to ensure that the fil I'll come back to this one after I'm more familiar with the Prototype1b section, thanks. |
|
Hi @DomCR, understood, and I appreciate how careful you're being with the checks. No rush on my end, I'm on vacation for the next week. Thanks for the update! |
Pre-2013 targets carry the payload as character-swapped SAT text in the entity codes 1 and 3; 2013+ targets store the binary payload in the ACDSDATA section, paired by owner handle.
Pre-2013 targets carry the payload in the entity stream (version 1 blocks or a version 2 raw file); R2013+ targets store the binary payload in the AcDs data section in the AutoCAD fresh-save layout, with the section ids assigned and the empty section written in AC1018+ file headers. The object reader follows the R2013+ modeler entity layout so the round-trip sections read back.
… and 3 A SAT line longer than a group value continues in code 3 groups. The cut now falls on the last space that fits, so a token never spans two groups: the restore reads the tokens group by group and rejects one split in the middle.
…rmat The subclass exists since the 2007 format together with its only field, the History ID (350). The older formats stop the entity at AcDbModelerGeometry: a subclass marker without its field makes AutoCAD discard the whole DXF.
b2f9c94 to
098d7a3
Compare
|
Rebased on today's master. The first three commits are the same work moved onto the reworked writers: Two commits are new, both found by opening the written files in Autodesk DWG TrueView. A long SAT line is cut at a space between groups 1 and 3, so a token never spans two groups. The Files were checked at R2000, R2004, R2007, R2010 and R2013, in both formats, and they all open. The one file missing is the R2007 DWG, which this writer does not support yet (#452). |
|
As mentioned I want to refactor the ACIS schema and handling inside the library, implementing the writers before that it will make the task more difficult. Depens on: Once the refactor and and re-structure is finished I'll take this one. |
|
Hi @DomCR, now that #1174 is in, this PR conflicts with master in the R2013+ modeler geometry read of It would also help to have #1268 in first. Since #1174 the DXF reader keeps only the last 310 line of an ACDSDATA record, so the DXF 2013+ files written by this PR no longer read back whole. More generally, for my open PRs: do you prefer that I rebase as soon as master moves, or only when you are about to review them? |
|
Hi @ilCosmico, Thanks for the fix in #1268 I really missed that one. For this one, I think that I want to go in another direction regarding the writer, the DataSorage section has a lot of info that we are not using but we may need in the future, this writer it works but is just passing the raw info without recreating the original structure. So what I would like to do for the writer is to recreate the Scheme that we use in the reader and make a generic writer that can adapt to future implementations. Don't colse it yet, the work is useful and it will help with the implementation.
I can give you a heads up when I start a review, that way you can update the branch only when needed. |
|
Thanks, that makes sense, I'll leave it open as a reference. When your writer is ready, I can run it on the files I used for this PR and check them in DWG TrueView, if that helps. |
This is the write side of #1139 (reading the ACIS payload of 3DSOLID, REGION and BODY), now merged. The DWG and DXF writers used to skip those entities; they now write the ACIS payload back.
The payload is the same SAT or SAB byte stream regardless of the file type. Only the container changes with the version, so the writer puts the bytes where each version expects them:
The R2013 and later modeler geometry entity read path is aligned with the same layout (no ACIS empty bit and no silhouette block before the wireframe), so the reader and writer agree.
Tests cover the SAT text codec, the DXF ACDSDATA section, and the DXF SAT round-trip, next to the existing writer tests.
One dependency worth noting: R2013 and later DWG files also need the small viewport reference-type fix in #1149 to open cleanly in AutoCAD.