Sketchup file format

From Fab Lab Wiki - by NMÍ Kvikan
Jump to navigation Jump to search

The sketchup file format is cryptic and hasn't been reverse-engineered by anybody in the 'verse, until now. Working with files with version code 6.4.112 I've started to figure out how the format is laid out.

General

Text strings appear to be stored in UCS2 two-byte format, meaning that instead of "Sketchup" in ASCII you'd have "S.k.e.t.c.h.u.p" where the dots are bytes with hex value 0x00. All strings are in this format unless otherwise noted.

Header

The first four bytes of the file are 0xFF 0XFE 0xFF 0x0E followed by the text string "Sketchup Model" (encoded as described above). After this, 0xFF 0xFE 0xFF 0x09, then the version code enclosed in curly brackets, like "{6.4.112}". After this, 29 bytes of header information that I haven't decyphered.

Version map

Starting at offset 85 is a block dubbed CVersionMap, ASCII encoded. This appears to be a mapping describing [www.collada.org Collada] markup codes. Each code is a string followed by an 8 byte code that probably refers to a location in the file or something about how Sketchup stores things.

Since the strings are of variable length and don't appear to be terminated, I'm guessing they're always read in the same order by Sketchup which pays mostly attention the the 8 byte codes.

This map terminates at byte 1864 after the string "End-Of-Version-Map"

PNG thumbnail

Bytes 1865-1898 are CDIB data, probably containing information about the PNG thumbnail that follows.

So from 1899 and onwards for a while is a PNG image which is a thumbnail of the

The thumbnail can be extracted using:

$ dd bs=1 skip=1899 count=1454 if=foo.skp of=foo.png

The count of 1454 seems long enough to cover most thumbnails, but you might have to tweak it a bit to get the PNG file to work.

And from there on...

That's it so far I'm afraid!