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.
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.
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.
It goes a little off topic, but once it has been mentioned…
If you compare: Definition#save_as(file_path) Model#save(filename, version) (or similar #save_copy )
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.
BTW: file_path <> filename meaning same, can be more consistent in docu…