Introduction
These are the models saved by Trimble’s SketchUp
2017, 2018, 2019 and 2020. SketchUp 2017 came out in November 2016. The file is an MFC
archive: the model is written with the CArchive class of Microsoft’s MFC
library, which stores strings, numbers and objects in a compact binary form.
The container is the same as in earlier SketchUp files, but SketchUp 2017 changed the parts already in it, so a reader written for the older files loses its place in these:
- Entities. The class
CEntity, which every entity is built on, went from schema 3 to 5. An entity now carries a sparse persistent ID after its attribute reference: a mask byte and one byte per set bit. Materials and layers start00 00before their names in older files and00 00 00in these, the extra byte being a zero mask. - The root model. Schema 26 adds
next_persistent_id, a u64, among the root’s first fields.
The files examined for this site were saved by SketchUp 2017 (17.1) and
2018 (18.0), and these decode completely. SketchUp 2019 and 2020 follow
skppy’s schema gates (custom line styles, layer folders, section plane names); no real
file from those releases was available here.
A file dropped on any page of this site opens in the explorer, which reads the whole object stream: the thumbnail, the version map, the options, the materials and layers, component definitions, scenes, every entity as a tree of objects, and the textures.
Structure
All numbers are little-endian. The file is one CArchive stream from start to end, but the parts before the version map are plain values rather than objects.
0Signature the CString “SketchUp Model”32 bytes32Version the CString “{18.0.16975}”: the SketchUp that saved the filevaries…Model GUID16 bytes…Path a CString, usually empty4 bytes or more…Saved a Unix time4 bytes…Version map every class the model may use, with the version of its layoutvaries…Object stream the model as CArchive objectsto the end…Root fields the prologue words, licence family and next persistent ID20 bytes…Thumbnail a CDib object holding a PNGvaries…Behaviour and description the root component behaviour and the descriptionvaries…Options named groups of typed valuesvaries…Objects materials, layers, components, geometryto the end
Every string is an MFC CString, and every object is written with MFC’s class tags. Both are described on the Header and Object stream pages. The version map tells the reader which version of each class’s layout follows. The layouts of the objects are on the Classes page.
Telling it apart
The explorer’s parser for this format checks, in order:
- the 32 bytes of “SketchUp Model” at the start, which every SKP file has;
- a version string in braces, such as
{18.0.16975}; - no
VFFstraight after the version, which would mean the ZIP container of SketchUp 2021 and later; - after the GUID, path and save time, the class record of the version map,
FF FF 00 00 0B 00andCVersionMap; - in the version map, a version of 5 or more for
CEntity(5 in every file seen); - the root model’s fields as far as the thumbnail: the schema of
CSketchUpModelin the map decides how many there are (see The root model).
A file that fails a check is turned down, and the explorer tries the parsers for the
other SKP formats. A file with CEntity below version 5 is a SketchUp 3 to
2016 model. A version of 21 or more with this layout is accepted but reported, since
SketchUp 2021 and later write the ZIP container.
Not described
The gaps are those on the SKP overview. For this format, no real files of SketchUp 2019 or 2020 were available, so their layouts rest on skppy’s schemas and its SDK-made test files.
Variants
- SketchUp 3 to 2016 – the classic MFC CArchive file: a version map, a PNG thumbnail and the object stream
- SketchUp 2017 to 2020 – the classic file with persistent IDs on every entity and two more model fields
- SketchUp 2021 and later – the “versionless” format: a short header, then a ZIP archive
Links
Software
- SketchUp – Trimble’s 3D modelling program, which wrote these files and opens them (Windows, macOS)
Developers
- SketchUp SDK – Trimble’s library for reading and writing SKP files, which can save as SketchUp 2017 to 2020 (C)
- OpenSKP – reverse-engineered reader and writer, which reads the persistent-ID bytes from version 17 on (Python, C#, TypeScript, Dart)
- skppy – reader and writer for both containers, with a Blender add-on; in beta (Python)
Reference
- skppy format reference – the published layout of every class, with the schema gates this page follows
- TN002: Persistent Object Data Format – Microsoft’s description of the MFC archive tags
- SUModelVersion – the SketchUp C API’s list of file versions, with SU2017 to SU2020
- Sketchup::Entity – the Ruby API reference, which dates
persistent_idto SketchUp 2017