[File] [PATCH] Magdir/cad AutoCAD Drawing Exchange Format; lower versions missing + old mime type
Jörg Jenderek
joerg.jen.der.ek at gmx.net
Fri Dec 9 14:22:54 UTC 2022
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hello,
Some weeks ago i update my inkscape graphic software. Just for
interest i looked what file formats it now can open, export or import
.
One listed extension is DXF. So i l looked for such samples.
When running file command version 5.43 on such DXF samples i get
sometimes an unexpected output like:
abydos.dxf: ASCII text
airplan2.dxf: ASCII text
airplane.dxf: AutoCAD Drawing Exchange Format, R11/R12
apple.dxf: AutoCAD Drawing Exchange Format
coreldraw2019-dxf2.5.dxf: AutoCAD Drawing Exchange Format
femur.dxf: AutoCAD Drawing Exchange Format
fmt-64-signature-id-99.dxf: AutoCAD Drawing Exchange Format
fmt-65-signature-id-100.dxf: AutoCAD Drawing Exchange Format
fmt-66-signature-id-101.dxf: AutoCAD Drawing Exchange Format
fmt-67-signature-id-102.dxf: AutoCAD Drawing Exchange Format
fmt-68-signature-id-103.dxf: AutoCAD Drawing Exchange Format
fmt-69-signature-id-104.dxf: AutoCAD Drawing Exchange Format
fmt-70-signature-id-105.dxf: AutoCAD Drawing Exchange Format
fmt-71-signature-id-106.dxf: AutoCAD Drawing Exchange Format
fmt-72-signature-id-107.dxf: AutoCAD Drawing Exchange Format
fmt-73-signature-id-108.dxf: AutoCAD Drawing Exchange Format
venus.dxf: AutoCAD Drawing Exchange Format
vette.dxf: AutoCAD Drawing Exchange Format
With option --extension correct 3 byte sequence dxf is shown and with
option -i old mime type application/x-dxf is shown.
For comparison reason i run the file format identification utility
TrID ( See https://mark0.net/soft-trid-e.html). This identifies
most examples (exception abydos.dxf) with low priority as "AutoCAD
Drawing eXchange Format" with variants (var.0 var.2 var.2/U) by
dxf-var0.trid.xml, dxf-var2.trid.xml and dxf-var2u.trid.xml.Here also
suffix DXF is shown but mime type here is image/vnd.dxf (See appended
trid-v-dxf.txt.gz).
For comparison reason i also run the file format identification
utility DROID ( See https://sourceforge.net/projects/droid/). This
identifies all "Drawing Interchange File Format (ASCII)" with mime
type image/vnd.dxf.
The sample airplane.dxf which is described by file command with
version phrase "R11/R12" is described with version phrase "R11/12".
For the most other samples where the other tools show no version
information it shows also a version. That is "lower". In sum i get 9
more versions ( From 1.0 til R9) by PUID fmt/64 til fmt/73.
(See appended droid-dxf.csv.gz).
Luckily with information given by other tools i also found page about
DXF on Wikipedia and on file formats archive team. There i also find
samples for download and suited software. That informations are now
expressed by comment lines inside Magdir/cad like:
# URL: http://fileformats.archiveteam.org/wiki/DXF
# https://en.wikipedia.org/wiki/AutoCAD_DXF
# Reference: http://mark0.net/download/triddefs_xml.7z/defs/d/
# dxf-var0.trid.xml dxf-var0u.trid.xml
# dxf-var2.trid.xml dxf-var2u.trid.xml
The detection happens inside Magdir/cad by starting lines like:
0 regex\^[\ \t]*0\r?\000$
>1 regex \^[\ \t]*SECTION\r?$
>>2 regex \^[\ \t]*2\r?$
>>>3 regex \^[\ \t]*HEADER\r?$ AutoCAD Drawing Exchange Format
!:mime application/x-dxf
Unfortunately some samples like airplan2.dxf have no header section
and some samples like abydos.dxf does not match the first test.
Unfortunately i have no time to understand full DXF specification,
used regular expression and have no original AutoCAD software so i do
not care about these minor annoyances and keep lines.
Instead of user defined mime type i use the official registered one,
that is also used by TrID and DROID. That is now expressed by line li
ke:
!:mime image/vnd.dxf
The sub classification with versions happens by lines like:
>>>>&1 search/8192 AC1006 \b, R10
>>>>&1 search/8192 AC1009 \b, R11/R12
...
>>>>&1 search/8192 AC1032 \b, version 2018
>>>>&1 search/8192 AC1035 \b, version 2021
So obviously code fragments for "older" version like R9 and before ar
e
missing. So according to documentations i add now lines for such
"older" version. This additional lines now looks like:
>>>>&1 search/8192 MC0.0 \b, 1.0
>>>>&1 search/8192 AC1.2 \b, 1.2
>>>>&1 search/8192 AC1.3 \b, 1.3
>>>>&1 search/8192 AC1.40 \b, 1.4
>>>>&1 search/8192 AC1.50 \b, 2.0
>>>>&1 search/8192 AC2.10 \b, 2.1
>>>>&1 search/8192 AC2.21 \b, 2.2
>>>>&1 search/8192 AC1002 \b, 2.5
>>>>&1 search/8192 AC1003 \b, 2.6
>>>>&1 search/8192 AC1004 \b, R9
So now older examples like coreldraw2019-dxf2.5.dxf and also DROID
samples like fmt-64-signature-id-99.dxf til
fmt-73-signature-id-108.dxf described with version sub classification
.
After applying the above mentioned modifications by patch
file-5.43-cad-dxf.diff then more of my inspected ASCII DXF samples
are now also described with version information. This now looks like:
abydos.dxf: ASCII text
airplan2.dxf: ASCII text
airplane.dxf: AutoCAD Drawing Exchange Format, R11/R12
apple.dxf: AutoCAD Drawing Exchange Format
coreldraw2019-dxf2.5.dxf: AutoCAD Drawing Exchange Format, 2.5
femur.dxf: AutoCAD Drawing Exchange Format
fmt-64-signature-id-99.dxf: AutoCAD Drawing Exchange Format, 1.0
fmt-65-signature-id-100.dxf: AutoCAD Drawing Exchange Format, 1.2
fmt-66-signature-id-101.dxf: AutoCAD Drawing Exchange Format, 1.3
fmt-67-signature-id-102.dxf: AutoCAD Drawing Exchange Format, 1.4
fmt-68-signature-id-103.dxf: AutoCAD Drawing Exchange Format, 2.0
fmt-69-signature-id-104.dxf: AutoCAD Drawing Exchange Format, 2.1
fmt-70-signature-id-105.dxf: AutoCAD Drawing Exchange Format, 2.2
fmt-71-signature-id-106.dxf: AutoCAD Drawing Exchange Format, 2.5
fmt-72-signature-id-107.dxf: AutoCAD Drawing Exchange Format, 2.6
fmt-73-signature-id-108.dxf: AutoCAD Drawing Exchange Format, R9
venus.dxf: AutoCAD Drawing Exchange Format
vette.dxf: AutoCAD Drawing Exchange Format
With best wishes,
Jörg Jenderek
- --
Jörg Jenderek
-----BEGIN PGP SIGNATURE-----
Comment: Using GnuPG with Thunderbird - https://www.enigmail.net/
iF0EARECAB0WIQS5/qNWKD4ASGOJGL+v8rHJQhrU1gUCY5NEvgAKCRCv8rHJQhrU
1niYAKDelJg08T8Znb9Zy7dae3liY47g3ACfS6BbYdg+xlvxV1tgJZTilwS9478=
=UeRC
-----END PGP SIGNATURE-----
-------------- next part --------------
--
File mailing list
File at astron.com
https://mailman.astron.com/mailman/listinfo/file
-------------- next part --------------
A non-text attachment was scrubbed...
Name: trid-v-dxf.txt.gz
Type: application/x-gzip
Size: 581 bytes
Desc: not available
URL: <https://mailman.astron.com/pipermail/file/attachments/20221209/4e573112/attachment.bin>
-------------- next part --------------
--- file-5.43/magic/Magdir/cad.old 2021-12-17 15:39:03.000000000 +0100
+++ file-5.43/magic/Magdir/cad 2022-12-09 14:55:53.633165900 +0100
@@ -308,2 +308,10 @@
# AutoCAD Drawing Exchange Format
+# Update: Joerg Jenderek
+# URL: http://fileformats.archiveteam.org/wiki/DXF
+# https://en.wikipedia.org/wiki/AutoCAD_DXF
+# Reference: http://mark0.net/download/triddefs_xml.7z/defs/d/
+# dxf-var0.trid.xml dxf-var0u.trid.xml dxf-var2.trid.xml dxf-var2u.trid.xml
+# Note: called "AutoCAD Drawing eXchange Format" by TrID and
+# "Drawing Interchange File Format (ASCII)" by DROID
+# GRR: some samples does not match 1st test like: abydos.dxf
0 regex \^[\ \t]*0\r?\000$
@@ -311,6 +319,30 @@
>>2 regex \^[\ \t]*2\r?$
+# GRR: some samples without HEADER section like: airplan2.dxf
>>>3 regex \^[\ \t]*HEADER\r?$ AutoCAD Drawing Exchange Format
-!:mime application/x-dxf
+#!:mime application/x-dxf
+!:mime image/vnd.dxf
!:ext dxf
+# DROID PUID fmt/64 fmt-64-signature-id-99.dxf
+>>>>&1 search/8192 MC0.0 \b, 1.0
+# DROID PUID fmt/65 fmt-65-signature-id-100.dxf
+>>>>&1 search/8192 AC1.2 \b, 1.2
+# DROID PUID fmt/66 fmt-66-signature-id-101.dxf
+>>>>&1 search/8192 AC1.3 \b, 1.3
+# DROID PUID fmt/67 fmt-67-signature-id-102.dxf
+>>>>&1 search/8192 AC1.40 \b, 1.4
+# DROID PUID fmt/68 fmt-68-signature-id-103.dxf
+>>>>&1 search/8192 AC1.50 \b, 2.0
+# DROID PUID fmt/69 fmt-69-signature-id-104.dxf
+>>>>&1 search/8192 AC2.10 \b, 2.1
+# DROID PUID fmt/70 fmt-70-signature-id-105.dxf
+>>>>&1 search/8192 AC2.21 \b, 2.2
+# DROID PUID fmt/71 fmt-71-signature-id-106.dxf
+>>>>&1 search/8192 AC1002 \b, 2.5
+# DROID PUID fmt/72 fmt-72-signature-id-107.dxf
+>>>>&1 search/8192 AC1003 \b, 2.6
+# DROID PUID fmt/73 fmt-73-signature-id-108.dxf
+>>>>&1 search/8192 AC1004 \b, R9
>>>>&1 search/8192 AC1006 \b, R10
+# http://cd.textfiles.com/amigaenv/DXF/OBJEKTE/LASTMINUTE/apple.dxf
+#>>>>&1 search/8192 AC1008 \b, Rfoo
>>>>&1 search/8192 AC1009 \b, R11/R12
-------------- next part --------------
A non-text attachment was scrubbed...
Name: file-5.43-cad-dxf.diff.sig
Type: application/octet-stream
Size: 960 bytes
Desc: not available
URL: <https://mailman.astron.com/pipermail/file/attachments/20221209/4e573112/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: droid_dxf.csv.gz
Type: application/x-gzip
Size: 712 bytes
Desc: not available
URL: <https://mailman.astron.com/pipermail/file/attachments/20221209/4e573112/attachment-0001.bin>
More information about the File
mailing list