Author Topic: sh3d-v53.trid.xml for eTek's Home 3D design *.sh3d (v5.3)  (Read 4452 times)

jenderek

  • Sr. Member
  • ****
  • Posts: 375
sh3d-v53.trid.xml for eTek's Home 3D design *.sh3d (v5.3)
« on: March 18, 2018, 04:42:10 PM »
Hello,

some days ago i must create a floor plan. So i used interior design
application "Sweet Home 3D" version 5.7 to do this work found at
http://www.sweethome3d.com. My created plans are stored as files with
name extension ".sh3d".

When i use TrID software (found at http://mark0.net/soft-trid-e.html) to
identify SH3D files, i got "ZIP compressed archive" as file type
description (see appended output/trid-old.txt).

But some examples like SweetHome3DExample2.sh3d found in Gallery section
with URL http://www.sweethome3d.com/gallery.jsp are identified by
standard Unix file identifying command as "Java archive data (JAR)" (see
appended output/file-5.32.txt).

So i know foobar.sh3d is just a ZIP archive. So i run tridscan to
generate a specific definition file. The first pattern is magic of file
header by XML construct:

   <Bytes>504B0304140008080800</Bytes>
   <ASCII> P K</ASCII>
   <Pos>0</Pos>

To understand pattern of definition file look at ZIP specification in
APPNOTE.TXT found at https://pkware.cachefly.net/webdocs/casestudies/ .

Then do interpreting byte values. Local file header signature
(504B0304), Version needed to extract (1400h=2.0) General purpose flag
(08080h), Compression method (8~deflated). So mention that first zip
member is deflated compressed with version 2.0 in remark line.

If the bit at offset 3 (0x08) of the general-purpose flags field is set,
then the CRC-32 and Compressed and Uncompressedfile sizes are not known
when the header is written. The fields in the local header are filled
with zero. This is expressed by XML construct:

   <Bytes>0000000000000000000000000400</Bytes>
   <Pos>14</Pos>

The last 2 bytes (0400) in this expression means that file name has a
length of 4. That name is "Home". That is expressed by XML construct:

   <Bytes>486F6D65</Bytes>
   <ASCII> H o m e</ASCII>
   <Pos>30</Pos>

So first ZIP archive member is always a file with name "Home". This can
be verified by looking at display of ZIP extracting tool ( look at
output\7z-l.txt created by command 7z l *.sh3h)

The sh3d files also contain a file named "Home.xml". This is expressed
in global string section by:

   <String>HOME.XMLPK</String>

According to information from Sweet Home 3D developer Emmanuel Puybaret
this file format was introduced in version 5.3 So mention this in file type
line and call trid definition file sh3d-v53.trid.xml. Add URL pointing to
that information in forum by line:

   <RefURL>
http://www.sweethome3d.com/support/forum/viewthread_thread,8431
   </RefURL>

So older file may have no "Home.xml" member or are not packed inside a ZIP
container. Because no own mime type is registered for SH3D files so i
still use ZIP characteristic by XML construct:

   <Mime>application/zip</Mime>

With new trid definition file now all inspected SH3D archive are
recognized (see appended output/trid-new.txt). TrID definition, some
examples and output are stored in archive sh3d.zip. I hope that the XML
file can be used in future version of triddefs.

With best wishes
J?rg Jenderek

Mark0

  • Administrator
  • Hero Member
  • *****
  • Posts: 2743
    • Mark0's Home Page
Re: sh3d-v53.trid.xml for eTek's Home 3D design *.sh3d (v5.3)
« Reply #1 on: March 18, 2018, 06:48:46 PM »
Thanks for the new def.
I have found some other SH3D files (some older), so I'll refine it a bit and maybe make it more generic.