Everything after the version map is
the model, written as one MFC CArchive stream. The stream has a single root,
the body of a CSketchUpModel, and every other object is reached from it. So
the whole stream can be read in order: start at the root, follow each object tag, and use
the schema of each class to know its layout. The class layouts are on the
Classes page. All numbers are little-endian,
and every string is a CString.
The explorer reads the whole stream this way. The real SketchUp 2017 and 2018 files available to this site decode to their last byte.
The root model
The first thing after the map’s end entry is the body of CSketchUpModel: its fields, in order, with no tag of its own. Which fields exist depends on the schema of CSketchUpModel: 26 in SketchUp 2017, 28 in 2018, and on up to 2020. The conditions below use that schema.
| Field | Type | Condition | Meaning |
|---|---|---|---|
| prologue_word_1 | u32 | schema ≥ 7 | Published but its meaning is not named. 1 or 2 in the files seen. |
| prologue_word_2 | u32 | schema ≥ 7 | Published but its meaning is not named. 1200 in the files seen. |
| license_product_family | u32 | schema ≥ 18 | skppy’s name; 2 in the files seen. |
| next_persistent_id | u64 | schema ≥ 26 | The next persistent ID the model will give out. It was shown as two unknown u32s before: 4,878 and 0 in one file is the single number 4,878. |
| thumbnail_dib | object<CDib> | schema > 3 | The thumbnail. |
| redefine_thumbnail_on_save | bool | schema > 3 | 1 in every file seen. |
| root_behavior | inline CComponentBehavior | The model’s own behaviour as a component. | |
| description | CString | The model’s description. | |
| options | options | schema ≥ 21 | The option groups. |
| model_properties | object<CAttributeContainer> | schema ≥ 21 | Model-level attribute dictionaries. |
| camera_leading_object | object | schema ≥ 21 | |
| camera | object<CCamera> or old camera | Old camera below schema 11 (see CCamera). | |
| rendering_options | inline CRenderingOptions | ||
| obsolete_vertex_count | u32 | ||
| validity_check_performed | u32 | schema ≥ 18 | |
| root_component | inline CComponent | Materials, layers, definitions, entities, relationships. | |
| shadow_info | inline CShadowInfo | The location and shadow settings. | |
| pages | inline CPageList | schema ≥ 12 | The scenes. |
| model_axes | inline CSketchCS | The model’s axes. | |
| state_words | 16 × u32 | Published but not named. | |
| tail_options | options | schema < 21 | The option groups, moved here in the older files. |
| dimension_style | inline CDimensionStyle | schema ≥ 8 | |
| text_style | inline CTextStyle | schema ≥ 10 | |
| fonts | inline CFontManager | ||
| background_image | object<CBackgroundImage> | schema = 13 or above 14 | |
| styles | inline CSkpStyleManager | schema ≥ 14 | The styles. |
| watermarks | inline CWatermarkManager | schema ≥ 16 | |
| final_state | u32 | schema ≥ 20 | Not named. |
| final_flag | bool | schema ≥ 22 | |
| active_schemata | list of objects | schema ≥ 24 | CSchemaZipFile objects: classifications such as IFC 2x3 bundled with the model. Not in skppy’s reference; seen in real files, where the list holds one IFC 2x3 file. |
| trailing_word | u32 | schema ≥ 28 | A last 32-bit number at the very end of SketchUp 2018 files (values 1 and 2 seen). Its meaning is not known. |
01 00 00 00 B0 04 00 00 02 00 00 00 0E 13 00 00 00 00 00 00
Thumbnail
The thumbnail is a CDib object, usually the first object after the root fields. The picture SketchUp shows in its file dialogs: a complete PNG file.
| Field | Type | Meaning |
|---|---|---|
| Class tag | class record | FF FF 03 00 04 00 43 44 69 62: a new class, schema 3, the name CDib. |
| image_format | u32 | 4 for the PNG thumbnail; 1 for a JPEG texture. |
| byte_count | u32 | The size of the image. |
| image_bytes | bytes | A complete PNG or JPEG file. |
| format_1_suffix | u32 | Only at schema 3 or above and only for format 1: a further u32 after a JPEG. |
FF FF 03 00 04 00 43 44 69 62 04 00 00 00 19 11 00 00 89 50 4E 47 …
The thumbnails seen are PNGs of 256 × 256 pixels. The explorer shows the thumbnail and every JPEG or PNG texture straight from the file.
Behaviour and description
After the thumbnail, the 15 bytes that used to look unknown are two published fields. redefine_thumbnail_on_save is 1, and the model’s root CComponentBehavior follows: CEntity’s attribute reference (2 bytes, 0) and its sparse persistent-ID mask (1 byte, 0: no ID on the model’s own entity), is_2d, cuts_opening, the u32 snap_to, the u8 camera_flags and the u32 no_scale_mask, all zero in the files seen. The bytes are 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00.
Then the description: a CString, empty in every file seen.
Options
The model’s options are a COptionsManager: a u32 version (2 in every file seen), a u32 count of providers, and for each provider a CString name and its options, ending with an empty name.
Each option is a key, a type byte and a value (the same typed value as in attribute dictionaries).
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 |
Typed values
A typed value is a type byte followed by what it selects. The same form is used in options and in attribute dictionaries (LastModifiedByKey, VersionKey).
| Code | Value | Meaning |
|---|---|---|
| 0 | nothing | empty |
| 1 | not published | no source gives its width; the explorer stops if it meets one |
| 2 | u8 | an 8-bit integer (I1) |
| 3 | u16 | a 16-bit integer (I2) |
| 4 | i32 | a 32-bit integer (I4) |
| 5 | f32 | a single-precision float (R4) |
| 6 | f64 | a double (R8) |
| 7 | u8 | true or false |
| 8 | u32 | a colour; its bytes are R, G, B, A |
| 9 | u32 | a time: a Unix time (OpenSKP calls it time_t) |
| 10 | CString | a string |
| 11 | u32 count, then that many typed values | an array; each item has its own type byte |
| 12 | f64 | a length, in inches (OpenSKP agrees) |
| 13 | f64 | an area |
| 14 | f64 | a weight |
| 15 | f64 | a force |
| 16 | f64 | a currency amount |
| 17 | 3 f64 | a point |
| 18 | 3 f64 | a vector |
| 19 | 3 f64 | a unit vector |
| 20 | 16 f64 | a transform |
The widths are skppy’s (options_payloads.py), and OpenSKP agrees where it reads the same codes. The meanings come from lining the codes up with SketchUp’s own tags 0x38A5 to 0x38B7 in the later files (TypedValueI1, I2, I4, R4, R8, Bool, Color, Time, String, Array, Length, Area, Weight, Force, Currency, Point, Vector, UnitVector, Transform; from openskp-rs’s list of SketchUp’s tag names): code = tag − 0x38A3. That line-up is an inference, but it fits every width the two sources give, and OpenSKP independently reads 9 as a time and 12 as a length.
The objects
The root component holds the materials, the layers, the definitions, the entities and the relationships, and the rest of the file is reached from there. Each object is introduced by a tag and laid out according to its class’s schema. The Classes page gives every layout.
Materials
The materials are in the root component’s CMaterialManager: a u32 count, then the objects. The first has the CMaterial class record and the others the class’s 8000 | slot tag, and each starts with its CEntity: the two-byte attribute reference (00 00 when it has none) and the sparse persistent-ID mask byte, then that ID’s bytes.
After its name a material without a texture has a bool 0, four colour bytes (such as D3 BD 90 FF), an empty display name, its type, its colorize type, a transparency f64 and a flag saying whether the transparency applies (see CMaterial).
Layers
The layers (called tags in later SketchUp) follow the same pattern in the CLayerManager. Each layer holds, after its name and a hidden flag, a whole CMaterial for the colour it shows in the Tags panel.
Geometry
The entities of a component are objects: CFace, CEdge, CGroup, CComponentInstance, CText, CDimensionLinear, CConstructionPoint and the rest, each in its class’s layout. A face has a plane and a list of CLoops, a loop a list of CEdgeUses, an edge use points at its CEdge, and an edge points at two CVertex objects. Vertices and edges are written where they are first used, as new objects in the stream, and referred to by slot after that.