Everything after the version map is
the model, written as an MFC CArchive stream. The first parts, up to the
options, have the same layout in every file seen and are described field by field below.
The objects after them follow the class versions in the map and are not decoded here.
All numbers are little-endian, and every string is a
CString.
Layout
| Part | Size | Contents |
|---|---|---|
| Model fields | 20 | Five u32 values of unknown meaning. |
| Thumbnail | varies | A CDib object: a new class record, an image type, a length and a PNG. |
| Unknown | 15 | 01 00 00 00 and eleven zero bytes. |
| Options | varies | Named groups of typed values: units, pages, slideshow and others. |
| Objects | to the end | Materials, layers, component definitions, entities and attributes. |
Model fields
Straight after the map’s end entry come five 32-bit numbers. Their meaning is not known. Files before SketchUp 2017 have only the first three.
| Offset | Size | Type | Name | Seen |
|---|---|---|---|---|
| 0 | 4 | u32 | Unknown 1 | 1 or 2. |
| 4 | 4 | u32 | Unknown 2 | 1200 (B0 04 00 00) in every file. |
| 8 | 4 | u32 | Unknown 3 | A small number: 1, 2 or 6 in the classic files seen. |
| 12 | 4 | u32 | Unknown 4 | Differs from file to file: 4,878, 9,107 and 48,947 seen. |
| 16 | 4 | u32 | Unknown 5 | 0 in the files seen. |
01 00 00 00 B0 04 00 00 06 00 00 00 0E 13 00 00 00 00 00 00
Five fields lead straight to the thumbnail’s class record. The explorer’s parser checks this: a file whose map is followed by only three fields is a SketchUp 3 to 2016 model.
Thumbnail
The first object after the map is a CDib, the picture SketchUp shows in its
file dialogs. It holds a complete PNG file.
| Offset | Size | Type | Name | Meaning |
|---|---|---|---|---|
| 0 | 10 | class record | Class | FF FF 03 00 04 00 43 44 69 62: a new class, schema 3, the 4-letter name CDib. |
| 10 | 4 | u32 | Image type | 4 for the PNG thumbnail. JPEG textures inside materials use the same class with type 1. |
| 14 | 4 | u32 | Length | The size of the image in bytes. |
| 18 | length | bytes | Image | A complete PNG file, starting 89 50 4E 47. |
FF FF 03 00 04 00 43 44 69 62 04 00 00 00 xx xx xx xx 89 50 4E 47 …
The thumbnails in the 2017 and 2018 files seen are PNGs of 256 × 256 pixels. The explorer shows the thumbnail straight from the file.
After the thumbnail
Fifteen bytes whose meaning is not known: 01 00 00 00 and then eleven zero
bytes, in every file seen. Older files have one zero byte fewer. The explorer skips to
the next string marker and reports a run of another length.
01 00 00 00 00 00 00 00 00 00 00 00 00 00 00
Options
Next come the model’s options, in named groups.
| Part | Type | Meaning |
|---|---|---|
| Unknown string | CString | Empty in every file seen. |
| Unknown | u32 | 2 in every file seen. |
| Group count | u32 | The number of option groups that follow: 4 or 5 seen. |
| Groups | Each a CString name, then its options, then an empty CString that ends the group. |
Each option is a key, a type byte and a value:
| Part | Type | Meaning |
|---|---|---|
| Key | CString | The option’s name. |
| Type | u8 | How the value is stored (below). |
| Value | varies | The value. |
| Type | Value |
|---|---|
| 4 | i32, a signed 32-bit integer |
| 6 | f64, a 64-bit floating-point number |
| 7 | u8, true or false: 0 false, 1 true |
| 10 | CString |
Two options from the PageOptions group, ShowTransition set to
true and TransitionTime set to 2.0:
FF FE FF 0E 53 00 68 00 6F 00 77 00 54 00 72 00 61 00 6E 00 73 00 69 00 74 00 69 00 6F 00 6E 00 07 01
FF FE FF 0E 54 00 72 00 61 00 6E 00 73 00 69 00 74 00 69 00 6F 00 6E 00 54 00 69 00 6D 00 65 00 06 00 00 00 00 00 00 00 40
Groups seen:
| Group | Options seen |
|---|---|
PrintOptions | none (an empty group) |
PageOptions | ShowTransition, TransitionTime |
SlideshowOptions | LoopSlideshow, SlideTime |
UnitsOptions | LengthPrecision, LengthFormat, LengthUnit, LengthSnapEnabled, LengthSnapLength, AnglePrecision, AngleSnapEnabled, SnapAngle, SuppressUnitsDisplay, ForceInchDisplay, AreaUnit, VolumeUnit, AreaPrecision, VolumePrecision and others |
NamedOptions |
The same key, type and value form appears elsewhere in the stream, in attribute
dictionaries: LastModifiedByKey with type 10 and an empty string
(0A FF FE FF 00), VersionKey with type 4 and 1000
(04 E8 03 00 00).
To read the options: read the empty string, the u32 2 and the group count. For each group, read its name; then, until the next string is empty, read a key, a type byte and a value of that type; then read the empty string. A type other than 4, 6, 7 or 10 is not known, and the explorer stops there.
The objects
The rest of the file is the model itself as CArchive objects: materials,
layers, component definitions, groups, faces, edges, vertices, text, dimensions,
scenes and their attributes, each introduced by a class tag
and laid out according to its class version in the map. These layouts are not decoded
here, and the explorer shows the rest of the file as one range. Two lists can still be
found in it by searching.
The entity preamble
Every entity’s record starts with a short preamble between its class tag and its
first field. In this format the preamble is one byte longer than in files before
SketchUp 2017: a material or layer with no attributes has 00 00 00 before
its name, not 00 00. This goes with CEntity at version 5.
OpenSKP’s reader reads no persistent-ID mask before version 17 and a mask and ID bytes
from 17 on, and SketchUp 2017 is the release that gave entities persistent IDs, so the
extra byte is most likely where a persistent ID would be marked. That is an inference;
the layout of an entity that does carry an ID was not checked here.
Materials
The materials are written as a u32 count, then the first material with the
CMaterial class record (FF FF 0C 00 09 00 and the name),
then the others, each with that class’s 8000 | index tag, such as
11 80. Each material starts with the three-byte preamble
00 00 00 when it carries no attributes, and then its name as a
CString.
xx xx xx xx FF FF 0C 00 09 00 43 4D 61 74 65 72 69 61 6C 00 00 00 FF FE FF …
Layers
The layers (called tags in later SketchUp) follow the same pattern: a u32 count, the
first layer with the CLayer class record (FF FF 02 00 06 00
43 4C 61 79 65 72), the others with its tag, and each with the same preamble
and its name.
How the explorer finds them
- Search the object stream for the class name with its length before it (for
materials
09 00andCMaterial), and check forFF FFand a schema in front of it. - Read the u32 count just before the class record.
- After the name, skip up to eight zero bytes to the first CString: the first name.
- Look for the next tag with the top bit set that is followed by zero bytes and a string: that is the class’s tag and the second name.
- Search for that tag again, read the name after it, and repeat until the count is reached.
So the lists are found by searching, not by reading every object, and the explorer labels them so. An object that carries attributes has a longer preamble, and its name is missed: in one SketchUp 2018 file 32 of 36 material names were found. The explorer then shows how many of the count it found.