LibreDWG / libredwg

Official mirror of libredwg. With CI hooks and nightly releases. PR's ok
https://savannah.gnu.org/projects/libredwg/
GNU General Public License v3.0
931 stars 228 forks source link

Define AutoCAD release versions in include/dwg.h #870

Open michal-josef-spacek opened 9 months ago

michal-josef-spacek commented 9 months ago

We have a situation, when we have DWG_VERSION_TYPE definitions in include/dwg.h, but this is related to DWG file, not to AutoCAD release.

Intent behind this is, that we need to define AutoCAD version and set defaults related to AutoCAD version. e.g. We have AutoCAD R_13 and AutoCAD R_2000. Boths could encode DWG file to AC1012 version. But result is different e.g. in case of sections. This is common problem. AutoCAD R_13:

num_sections: 3 [RL]
num_sections => 3
section[0].number:         0 [RC] AcDb:Header
section[0].address:       70 [RL]
section[0].size:         454 [RL]
section[1].number:         1 [RC] AcDb:Classes
section[1].address:      524 [RL]
section[1].size:          38 [RL]
section[2].number:         2 [RC] AcDb:Handles
section[2].address:     3977 [RL]
section[2].size:          79 [RL]
crc: A24C [RSx] from 0-52
         HEADER (end):      70

AutoCAD R_2000:

num_sections: 5 [RL]
num_sections => 5
section[0].number:         0 [RC] AcDb:Header
section[0].address:    18207 [RL]
section[0].size:         484 [RL]
section[1].number:         1 [RC] AcDb:Classes
section[1].address:    18691 [RL]
section[1].size:         475 [RL]
section[2].number:         2 [RC] AcDb:Handles
section[2].address:    25375 [RL]
section[2].size:         273 [RL]
section[3].number:         3 [RC] AcDb:ObjFreeSpace
section[3].address:    25648 [RL]
section[3].size:          53 [RL]
section[4].number:         4 [RC] AcDb:Template
section[4].address:    25847 [RL]
section[4].size:           4 [RL]
crc: DA60 [RSx] from 0-70
         HEADER (end):      88
michal-josef-spacek commented 9 months ago

I have prepared part of commit: https://github.com/michal-josef-spacek/libredwg/commit/45bc47e0721d71eb583b9ccf51256e33113d3e4c

I am looking for blank.DWG files from some AutoCAD releases:

When you could help me, please send DWG file and release from which was saved. (Open AutoCAD and save)

rurban commented 9 months ago

I"m sorry, I don't have a single AutoCAD anymore :) It died with my mac

turtle0x1 commented 9 months ago

I can probably help with the last 4 versions if need be, just empty DWG files?

Be happy to pop them over to ruban in email if it would help?

michal-josef-spacek commented 9 months ago

@turtle0x1 I will be happy. Only save the blank DWG file, archive it (zip, rar, gzip), and push to this ticket as an attachment.

turtle0x1 commented 9 months ago

Have abit of concern posting them publicly, not sure on the legal implications? (These are work licenses, and I have to assume there is some identifier in the dwgs)

michal-josef-spacek commented 9 months ago

@turtle0x1 You could send it to me (michal.josef.spacek@gmail.com)

btw: This is probably a question to @rurban . I don't know about any license identification in the DWG file.

rurban commented 9 months ago

The license not, but username and ID yes

michal-josef-spacek commented 9 months ago

The license not, but username and ID yes

AcDb:Header:

AcDb:SummaryInfo:

Do you mean this?

rurban commented 9 months ago

Exactly, plus the Security section

rurban commented 9 months ago

We already have AUTOCADVERSION as our R release enums. But the extra table would be good to match it to the numeric dwg_version and maint_versions.

michal-josef-spacek commented 9 months ago

We already have AUTOCADVERSION as our R release enums. But the extra table would be good to match it to the numeric dwg_version and maint_versions.

Yes, but this is not used as AUTOCAD_VERSION, but as DWG version.

timoria21 commented 9 months ago

I am looking for blank.DWG files from some AutoCAD releases:

Would some files written by OpenDesign SDK help in this? I can write:

AC1012 R13 AC1014 R14 AC1015 R2000 AC1018 R2004 AC1021 R2007 AC1024 R2010 AC1027 R2013 AC1032 R2018

michal-josef-spacek commented 9 months ago

Would some files written by OpenDesign SDK help in this? I can write:

I am definitely interested in how different SW saves the DWG file.

timoria21 commented 9 months ago

Here you go Michal:

blank_ODA.zip

michal-josef-spacek commented 9 months ago

@timoria21 Thank you very much. Do you have version of SDK or app which is saving this?

There is:

dwg_version: 0x21 [RC 0]
maint_version: 0x37 [RC 0]

This is definition of application, which saves DWG file. This info is same in all DWG files presented.

rurban commented 9 months ago

FYI: oda only discriminates on the dwg_version (only sometimes on the maint_version) and with class objects only on the class_version. Whilst we map the AC10xx magic to our own release numbers. But I have never seen a conflict so far

timoria21 commented 9 months ago

@michal-josef-spacek This is plain ODA SDK DWG output

rurban commented 9 months ago

See, that's why we use the AC10xx magic, and not the dwg_version, which is just the version with which this file was created, and not with which version it was stored.

michal-josef-spacek commented 9 months ago

Added AutoCAD 2018 and 2023, commit updated

michal-josef-spacek commented 9 months ago

Added AutoCAD 2013, commit updated

michal-josef-spacek commented 9 months ago

Added AutoCAD 2006 and 2006 SP1, commit updated.

New information, Service Pack has updated the maintenance version.

michal-josef-spacek commented 9 months ago

Added AutoCAD 2004, 2004 SP1a, and 2007, commit updated

rurban commented 6 months ago

There is also the problem with the new VERSION checks, which could be a bit simplified to check the dwg_version, not the magic header version. ODA does only check this dwg_version.

I really want to have only R_2000 - R_2002 being 0x17, R-2004a - R_2004c being 0x18 and so on. They did bump the dwg_version for each major dwg release, but it would be still only two versions to check.

That's your @michal-josef-spacek add_autocad_version branch, right?

michal-josef-spacek commented 6 months ago

That's your @michal-josef-spacek add_autocad_version branch, right?

Yes, that's mine..

michal-josef-spacek commented 6 months ago

I am for merging and working on it.

rurban commented 6 months ago

It doesn't pass the checks yet