Hi team,
I’m observing unexpected behavior in my C extension (Rayscaper) regarding SDK version compatibility.
I built the extension against the SketchUp 2026 SDK (2026-0-429) but ran it in SketchUp 2024. It appears that the SURefType enum changed in a non-backward-compatible way between these versions.
For example, in the 2026 SDK:
enum SURefType {
SURefType_Unknown = 0,
SURefType_AttributeDictionary,
SURefType_Camera,
SURefType_ComponentDefinition,
SURefType_ComponentInstance,
SURefType_Curve,
SURefType_Edge,
SURefType_EdgeUse,
SURefType_Environment, <<< NEW VALUE
SURefType_Environments, <<< NEW VALUE
SURefType_Entities,
SURefType_Face,
...
};
In the 2024 SDK, however:
enum SURefType {
SURefType_Unknown = 0,
SURefType_AttributeDictionary,
SURefType_Camera,
SURefType_ComponentDefinition,
SURefType_ComponentInstance,
SURefType_Curve,
SURefType_Edge,
SURefType_EdgeUse,
SURefType_Entities,
SURefType_Face,
...
};
As you can see, the SURefType_Environment and SURefType_Environments values were inserted before SURefType_Face, which shifted the enum values and broke backward compatibility.
When running on older SketchUp versions, this results in incorrect type interpretation. For example, during an EntitiesOnElementAdded callback, a SURefType_Face in 2026 is reported as SURefType_Environments when running under 2024. Here’s what happens when adding a basic plane (4 edges + 1 face):
[debug] EntitiesOnElementAdded() type=SURefType_Edge id=4456
[debug] EntitiesOnElementAdded() type=SURefType_Edge id=4457
[debug] EntitiesOnElementAdded() type=SURefType_Edge id=4458
[debug] EntitiesOnElementAdded() type=SURefType_Edge id=4459
[debug] EntitiesOnElementAdded() type=SURefType_Environments id=4465 << In SketchUp 2026 this is a Face, in 2024 this is an environment, leading to bogus results.
Question:
What is the recommended approach for building C extensions with the latest SDK while maintaining compatibility with older SketchUp versions?
Thanks,
Thomas Loockx