Latest 2022 SDK don't have SUModelVersion_SU2022

I have downloaded your latest API from this page, but when I open the model_version.h, I don’t view SUModelVersion_SU2022, I just view the latest version of SUModel is SUModelVersion_SU2021. But the name of the SDK is SDK_WIN_x64_2022-0-316.
And sometimes, I call API

int major = 0;
		int minor = 0;
		int build = 0;
		SUModelGetVersion(model, &major, &minor, &build)

to get the major of a model, the major will be returned with 2022. This is one thing make me amazed. Then I want to write the model to one path use the major version, I use flowing API:

SUModelSaveToFileWithVersion(model, filepath, save_model_version);

This function third argument is a version parameter, If I use the 2022, but I can’t find the enum SUModelVersion to match the 2022! I put the SDK version info define in model_version.h and I make sure the file is latest.

enum SUModelVersion {
  SUModelVersion_SU3,     ///< SketchUp 3
  SUModelVersion_SU4,     ///< SketchUp 4
  SUModelVersion_SU5,     ///< SketchUp 5
  SUModelVersion_SU6,     ///< SketchUp 6
  SUModelVersion_SU7,     ///< SketchUp 7
  SUModelVersion_SU8,     ///< SketchUp 8
  SUModelVersion_SU2013,  ///< SketchUp 2013
  SUModelVersion_SU2014,  ///< SketchUp 2014
  SUModelVersion_SU2015,  ///< SketchUp 2015
  SUModelVersion_SU2016,  ///< SketchUp 2016
  SUModelVersion_SU2017,  ///< SketchUp 2017
  SUModelVersion_SU2018,  ///< SketchUp 2018
  SUModelVersion_SU2019,  ///< SketchUp 2019
  SUModelVersion_SU2020,  ///< SketchUp 2020
  SUModelVersion_SU2021,  ///< SketchUp 2021

  SUModelVersion_Current = SUModelVersion_SU2021  ///< The most current version supported. Added in
                                                  ///< SketchUp 2022, API 10.0.
};
1 Like

Ran into this in Ruby too. Workaround was to define your own constant for version in that case.

But files are compatible between 2021 and later versions.

Our docs need to better describe the changes to the SketchUp file format as of SU2021:

We introduced a new SKP file format with SU2021 which meant that from that point onward SU2021+ versions would be able to read SKP files created by newer SketchUp versions.

Because of that the UI and the API don’t have a “down-save” for anything SU2021+, only the older SU2020 format.

Users of SketchUp 2021 or SDK users of the SU2021 SDK will be able to open files generated by the SU2022+ versions.

As you see in the header The SUModelVersion_SU2021 is the same as SUModelVersion_Current. So the SKP file format version will match whatever SDK version you are using.

What do you mean by that? SketchUp wouldn’t understand custom defined constants… Can you show an example?

Actually I kind of see the other way 'round. Current is being set to v2021.

I don’t follow this.

If file versions stop at 21, but API versions continue on, the latest being API v10, … how can they match going forward ?

Ran into this in Ruby too ... (off-topic - click to expand) ...

It wasn’t SketchUp that had the problem. It was a VERY old script (SaveAsMenu) of Jim Foltz’ that assumed that the version numbers would go on incrementing in perpetuity.

In order to build the menu items it went through a loop using a Range whose upper limit was set to the current version. It created the menu items building up constant identifiers from the iterator variable and all worked well until run under SU2022. The last iteration choked because it tried to build a Sketchup::Model::VERSION_2022 constant identifier and use it, …
which resulted in a NameError: uninitialized constant ... exception occurring.

I updated Jim’s old script … and I thought I gave JMC a copy ?

You did, it works, and I’m very grateful.

Doubly so for answering ThomThom, as I’m not at home at the moment and don’t have access to the code.

1 Like

What would be matching?

As of SU2021+ there is no point of setting the file format version to anything other than SUModelVersion_Current unless you are saving back to SU2022 or older.

Excuse me! But you are who said that FILE versions and API versions would match. Let us review …