OpenSKP 1.8.0 is out on PyPI, npm, NuGet and pub.dev, and as a C++ release on GitHub. The Rust port carries the same version in the repository. This post walks through what is new; the release notes have the full list and the upgrade notes.
Write the format SketchUp saves today
SketchUp has two file formats. Files from SketchUp 2020 and earlier use the classic one; SketchUp 2021 changed to a new container, and every version since saves that. OpenSKP has read both for a long time, but its writers only produced the classic format, as a SketchUp 2017 file. That works, because every SketchUp since 2017 opens it, but it was always the older format.
From 1.8.0, Python and TypeScript can write the current one:
from openskp import create_vff
b = create_vff()
oak = b.add_material("Oak", (198, 161, 116))
furniture = b.add_layer("Furniture")
with b.add_component_definition("Leg") as leg:
leg.add_face([(0, 0, 0), (2, 0, 0), (2, 2, 0), (0, 2, 0)], material=oak)
b.add_instance(leg, translation=(10, 0, 0), layer=furniture)
b.add_scene("Front", (50, -300, 60), (50, 0, 40))
b.save("table.skp")
create_vff() in Python and createVff() in TypeScript cover faces with holes, materials and textures, tags, components and groups, curves, attributes, texts, dimensions, guides, section planes and scenes. The Python writer was contributed by @zbyte64; the TypeScript one follows it so closely that the two give the same bytes for the same model, and the tests compare them on every change. .NET, Dart, C++ and Rust still write the classic format; the new writer is on the list for them.
Nothing made by SketchUp inside
A writer has to start from something. Until now, each of ours started from a small empty document that SketchUp's own library had saved, and that file travelled inside every package. It was a few kilobytes, but it was not ours.
In 1.8.0 every writer builds its empty document in code, in all six languages. No package holds a file that SketchUp saved. One thing you will see: new files open with OpenSKP's own defaults, a plain white style, no geo-location and decimal units, in place of SketchUp's template.
A command line
You no longer need to write a script to look into a file or convert it:
pip install openskp
openskp info house.skp
openskp convert house.skp house.glb
openskp convert house.skp house.ifc
The npm package has the same two commands as npx openskp. The Python side was started by @isyanpcr, the TypeScript side by @andretorresdg.
Tools for datasets and for privacy
Two additions in Python go beyond reading and writing, and each has its own post:
openskp dataset buildturns folders of models into labelled meshes for machine learning, keeping the components, tags and materials a plain mesh loses. Read SketchUp Models as AI Training Data.openskp info --provenancelists what a file records about where it has been: user folders in paths, network shares, contributor IDs, a location.openskp scrubwrites a copy without them. Read What Your SketchUp File Says About You.
Python also exports COLLADA (.dae) and Google Earth KMZ now, thanks to @richard-epsilla.
Closer to what SketchUp shows
- Recoloured textures are tinted. When a texture is recoloured in SketchUp, scenes and GLB files now carry the tinted image.
- Hidden geometry is left out of scenes and exports, as in SketchUp's own view.
- A face textured on both sides keeps each side's own placement.
- SketchUp 3 files open, and so do the scenes of files SketchUp 2018 saved and the styles of classic files.
A large part of this work in C++ is by @thomasloockx, and @sunwards-art added cameras and scenes to the C++ writer.
Before you upgrade
Code that only reads a model rarely has to change, but results differ in three ways you may notice:
- Files with hidden geometry give fewer triangles, because hidden faces and placements are skipped.
- Colorized textures arrive already tinted. If you applied a tint of your own, remove it.
- New files open with OpenSKP's start view and style, and each gets its own random GUID.
The upgrade notes list the rest, language by language.
The add-ons
The Blender and FreeCAD add-ons have had releases of their own: Blender 0.5.0 fixes importing when Blender's interface is not in English, and FreeCAD 0.4.0 imports SketchUp's component hierarchy as parts and links. Both still carry OpenSKP 1.7.0 inside; their next versions will move to 1.8.0.
Thank you
This release has code, examples and documentation from @zbyte64, @isyanpcr, @andretorresdg, @richard-epsilla, @thomasloockx, @sunwards-art, @vantruong-dang and @rayw-lab, and bug reports from many more. If something in 1.8.0 does not work for your files, open an issue; a file that fails is the most useful thing you can send.