I’m trying to load a new Component Definition to my sketchup model using the following line -
Sketchup.active_model.definitions.load(file_path)
But this is taking around 30 seconds for me just to load 1 definition when the file is having 7k existing component definitions, even though the file size is around 300MB.
Is there any alternative way to load outside component definitions into a model which is faster than this?
A 300MB file with 7000 definitions already sounds heavy. I’m curious how much time takes if you try to open it from the UI? It should be similar as you load it by code… (It also depends what is the file_path ?)
You can try this: Model #import-instance_method
However I don’t think it will be so much difference regards loading time.
I think I have read that the amount of work SketchUp does to add another component increases with the number of components already in the model, even if the new one is relatively simple. 7000 existing definitions is already much more than most models contain, so that may be the source of the slowdown.
That’s true.
When i start building the model with around 200-300 definitions it loads within a couple of seconds. As the count increases the time taken to load new component increases.
I tried this.
It reduced the number of definitions from 7000 to 900.
But still the time taken to load the definition is the same.
Do we know what factors affect the loading of a new definition into a model?