I know this function is a bit shitty, but nevertheless i need to use it and it’s obviously not doing what it is supposed to do.
I have a SUComponentInstanceRef instance which is valid and represents a piece of wood. I use SUComponentInstanceSaveAs(instance,filename) to save it in a file, in order to get a model which contains only this instance.
When i try to create the corresponding model with SUModelCreateFromFile(filename), it gives me an empty model, no instances, no definitions, no groups, nothing.
I really don’t get it. This method hereabove works fine with groups, and I have used it to isolate the walls of a house into different .skp files.
Any idea? @tt_su?
What is needed is a proper
SUComponentDefinitionSaveToFile method like the Ruby API has.
Every workaround we’ve tried to think up runs into a wall of a missing method (like lack of
Well, nevertheless, I would at least expect this function to create a file which actually contains an instance…
Well the only course is to open another issue in the Issue tracker, and perhaps give impetus to getting the situation(s) fixed in the next cycle (hopefully).
IMO, this should be labeled as the topmost priority issue for the C API.
For reference, I’m following up on this question in the github issue tracker: https://github.com/SketchUp/api-issue-tracker/issues/520
(I made a request for example code reproducing it.)
I have found a workaround, i’m saving the group that contains the instance i want, then create and hide a layer containing all the instances of the group, and create and show a layer which contains the only instance I want to visualize. I am pretty busy right now, i’ll try to complete the issue description (with reproducing code) next weekend.
Anyway thanks for your concern.
It goes a little off topic, but once it has been mentioned…
If you compare:
Model#save(filename, version) (or similar
You will notice that the
version is missing from the first one. The UI also allows you to select a version for the “Save as” component, but the Ruby API does not.
It would be great to be in it, then it will be even more proper.
file_path <> filename meaning same, can be more consistent in docu…