• Login
sketchucation logo sketchucation
  • Login
🤑 SketchPlus 1.3 | 44 Tools for $15 until June 20th Buy Now

How to insert a component instance from a definition.

Scheduled Pinned Locked Moved Developers' Forum
6 Posts 2 Posters 283 Views 2 Watching
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Offline
    honoluludesktop
    last edited by 10 Apr 2011, 13:07

    If the model has a component definition (no instance), is there a way to insert an instance of that definition via the api?

    1 Reply Last reply Reply Quote 0
    • T Offline
      thomthom
      last edited by 10 Apr 2011, 13:13

      Entities.add_instance
      http://code.google.com/intl/no/apis/sketchup/docs/ourdoc/entities.html#add_instance

      Thomas Thomassen — SketchUp Monkey & Coding addict
      List of my plugins and link to the CookieWare fund

      1 Reply Last reply Reply Quote 0
      • H Offline
        honoluludesktop
        last edited by 10 Apr 2011, 13:14

        There is no instance of the component in the model, only the definition.

        1 Reply Last reply Reply Quote 0
        • H Offline
          honoluludesktop
          last edited by 10 Apr 2011, 13:17

          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.

          1 Reply Last reply Reply Quote 0
          • T Offline
            thomthom
            last edited by 10 Apr 2011, 13:20

            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 )

            Thomas Thomassen — SketchUp Monkey & Coding addict
            List of my plugins and link to the CookieWare fund

            1 Reply Last reply Reply Quote 0
            • H Offline
              honoluludesktop
              last edited by 10 Apr 2011, 13:38

              OK, thanks. I must have done it wrong, when I tried to use entities.add_instance previously. I will work on it tomorrow.

              1 Reply Last reply Reply Quote 0
              • 1 / 1
              1 / 1
              • First post
                5/6
                Last post
              Buy SketchPlus
              Buy SUbD
              Buy WrapR
              Buy eBook
              Buy Modelur
              Buy Vertex Tools
              Buy SketchCuisine
              Buy FormFonts

              Advertisement