How to insert a component instance from a definition.
-
If the model has a component definition (no instance), is there a way to insert an instance of that definition via the api?
-
Entities.add_instance
http://code.google.com/intl/no/apis/sketchup/docs/ourdoc/entities.html#add_instance -
There is no instance of the component in the model, only the definition.
-
Its like when you open the Windows > Component's window and you see instances that have been previously deleted, but can still be inserted into the model.
-
Yes?
Entities.add_instance
is what you use then.model = Sketchup.active_model definition = model.definition[0] # getting a reference to a ComponentDefinition tr = Geom::Transformation.new model.entities.add_instance( definition, tr )
-
OK, thanks. I must have done it wrong, when I tried to use
entities.add_instance
previously. I will work on it tomorrow.
Advertisement