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 parts that were already in it, so a reader written for the older files loses its place in these. Three changes were found:
- Entities. The class
CEntity, which every entity is built on, went from version 3 to 5, and every entity’s record gained a byte between its class tag and its first field. Materials and layers start00 00before their names in older files and00 00 00in these. SketchUp 2017 introduced persistent IDs for entities (the Ruby API givesEntity#persistent_idthe version “SketchUp 2017”), and OpenSKP’s reader expects persistent-ID bytes from version 17 on. That the newCEntityversion is the persistent ID is an inference from these together. - Model fields. The model’s first fields after the version map grow
from three 32-bit numbers to five, as
CSketchUpModelgoes from version 25 in SketchUp 2016 to 26. - After the thumbnail. The run of unknown bytes after the thumbnail grows from 14 bytes to 15.
The files examined for this site were saved by SketchUp 2017 (17.1) and
2018 (18.0). That 2019 and 2020 keep this layout is an inference: the next
change on record is SketchUp 2021’s new container.
A file dropped on any page of this site opens in the explorer, which shows the header, the thumbnail, every class in the version map, the option groups, and the names of the materials and layers, found by searching the object stream.
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…Model fields five 32-bit numbers20 bytes…Thumbnail a CDib object holding a PNGvaries…Unknown 1 and eleven zero bytes15 bytes…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 objects after the options are not decoded here.
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); - after the map, five 32-bit model fields followed by the
CDibclass record of the thumbnail.
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.
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
- 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