-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to save active section plane to a scene using the SketchUp C API #1015
Comments
Logged as: SKEXT-4414 |
@Whaat - just making sure I understand the issue correctly. If the C API had something similar to to Ruby's Something like: SUSceneUpdate(scene_ref, SU_SCENE_UPDATE_SECTION_PLANES | SU_SCENE_UPDATE_CAMERA); ? |
Yes, that would be ideal. However, as I said, it is possible to set the Camera to the scene using the currently available C API calls. But doing the equivalent steps for section planes is not working. So I don't think a new function needs to be created. Just need to fix the current ones. |
Setting active section planes per scene is a little bit more tricky than camera. There is only one camera per scene. But in a model there can be multiple active section cuts in various entities collections. Setting section planes as active throughout the model and then doing an "update" seems to be a simple way to allow this ability. |
@Whaat - I just realized that But I also now understand why your code isn't working. We realized last week what You can observe this if you open a model create from your script and inspect the Scene properties in the UI. It's a poor API design. Something we could risk breaking existing users if we correct now. But we've already updated the documentation internally to clarify how to create a scene that will remember all properties, similar to what the UI and the Ruby API does by default: SUSceneRef scene = SU_INVALID;
SUSceneCreate(&scene);
SUSceneSetFlags(scene, FLAG_USE_ALL); // <- Set which properties the scene should remember
SUSceneSetName(scene, "Hello World");
SUModelAddScenes(model, 1, &scene); |
@thomthom Thanks so much for this. I've moved on to other tasks but will get back to this at some point and let you know if it works for me. |
Using current version of SketchUp C API as of today (Nov 25, 2024). SDK_WIN_x64_2024-0-594 - Windows 11
It does not seem possible to save the active section plane to a scene using the C API. I have tried doing it multiple ways (order of operations) and it never works so I suspect a bug.
I HAVE been able to save camera properties to a scene using the C API but using a similar approach does not work when saving an active section to a scene.
The test program is a simple modification of one of the sample projects 'WritingToAskpFile'.
In my test program, I create two section cuts and two scenes. The expected result is that one scene will have an active cut and the other scene will have the other active cut.
But the actual result is that both scenes have NO active section cut. The sections are created but are not made active when the scene is activated.
See attached main.cpp which is a simple modification to the sample project 'WritingToAskpFile'. You should be able to recreate by opening the sample project and replacing main.cpp with the attached version.
The output skp created is called 'new_model.skp'. Inspect this file after running the program to see the results which will show that when clicking on scene, there is no active section cut.
This bug is a problem for me because I am working on a feature to export components as individual SKP files and then automatically add section cuts / scenes to the SKP using the C API so I can then reference these SKP files / models in a Layout Document that is generated using the Layout Ruby API. This bug is preventing me from being able to implement this feature.
main.zip
The text was updated successfully, but these errors were encountered: