Problem on insert many component



Hello every-one

I try to insert many components (i try with 1000 and more) but it’s take to many time to insert all components. How can I make it more faster pleaz :slight_smile:

Actually i use this :

foreach (components)
_ #I Inititalise component before but i test it and there is no time problem with this._
transf = insertion_point
new_instance = entities.add_instance component.componentDefinition , transf


The problem is just on this line
new_instance = entities.add_instance component.componentDefinition , transf

that work quicly with 10 component but with 1000 and more that to long (approximatly 15 minutes)
Thanks for help


Have you wrapped your code in an operator? The operator makes all changes performed by the code use the same slot in the undo stack (which means undoing once undos them all) and can also be used to prevent SketchUp from redrawing the view between each change.

Sketchup.active_model.start_operation("Name", true)
# code goes here...


Thank you so much, it’s work

I put this and now i can insert many component in some seconds.

Really, thank you


No problems.

You can read more about the uno stack and operators here:


This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.