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_instanceis 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_instancepreviously. I will work on it tomorrow.
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better π
Register LoginAdvertisement