C SDK save in 2022 or 2023 formats
-
Does anybody know how to save a .skp file to SU 2023 or SU 2022 format with the v2024 C SDK?
Thank you for the answer in advance.
-
I think it is expected that you use
SUModelSaveToFileWithVersion()
with aSUModelVersion_SU2021
constant.What is different in the v22 and v23 file formats that need to be maintained?
The only other thing I can think of is to compile 2 external utilities with old versions of the SketchUp SDK and have these utilities backsave the SKP files using the
SUModelVersion_Current
constant. -
@Dan-Rathbun said in C SDK save in 2022 or 2023 formats:
What is different in the v22 and v23 file formats that need to be maintained?
I took a quick look at the release notes and I see only 2 new features that would be saved into the SKP file data:
v23 : Added Ruby Overlays and the model now has a flag collection with a Boolean state for overlays.
v24 : Added the Ambient Occlusion style properties (a state flag and numeric setting.)
Opening a SKP file on any older version back to 21 would just ignore any unknown data. This is known as SketchUp's versionless format since v21.
So WHY would you need to backsave to what v22 or v23 saved as ?
Ie, v22 did not add any new features that made the SKP any different from what v21 saved.
And, v23 only adds the listing for the overlays collection and would just ignore the new AO style attributes (added in v24) it does not know about. It might leave the attributes as is within the model data but do nothing with them, OR ignore them so as to not write them out when it saves a v23 SKP.
-
@Dan-Rathbun Thank you very much for your comprehensive reply. It is a great help. The reason I'd like to save in the correct (2022, 2023) format is that if the "versionless" 2021 format .skp is loaded into sketchup, you get a warning. I'd like to avoid it.
-
When I try to save the file in the "versionless" SU 2021 format (
SUModelSaveToFileWithVersion(model, "SU2021.skp", SUModelVersion_SU2021);
) with the v2024 C SDK, it saves it with version 2024 in the header of the .skp. Is this an error in the C SDK? -
@Gábor
The issue is more widespread than this.
If you have a v2023 file and attempt to load a SKP component that's v2024 it will fail 'silently'.
Also trying to open a v2024 SKP from within v2023 also fails the same way.
If you manually open a v2024 using v2023 an message pops up about it being from a newer version, but you can skip and continue...So any code which takes an exported v2023 component, manipulates it via the C SDK and returns it as a v2024 file is doomed to fail as explained above...
Perhaps the only way is to spot the version of the 'parent' SKP and its exported component, and use a suitable C SDK file to process it back into the compatible v2024 format ?
For backwards compatibility it'll need to cover v2023, v2022, v2021 and v2020 files because the 'versionless' v2024 format breaks those [perhaps using v2020 format for all exports would work in all newer versions ?] - more testing with any upcoming v2025 might reveal further issues...
-
@TIG Thank you for your input. My understanding of the C SDK is:
SUModelSaveToFileWithVersion(model, "SU2021.skp", SUModelVersion_SU2021);
- Should save into the "versionless" 2021 format and it should load without any error or warning into SU 2022 and SU 2023SUModelSaveToFileWithVersion(model, "SUcurrent.skp", SUModelVersion_Current);
- should save in the version of the SDK (in this case 2024)But instead both function calls save in SU 2024 format which IMO is an error in the SDK.
I'll try to contact them to sort this.
Advertisement