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

    Add entity to a group

    Scheduled Pinned Locked Moved Developers' Forum
    10 Posts 5 Posters 630 Views 5 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.
    • Didier BurD Offline
      Didier Bur
      last edited by

      Hi all
      Is there a way to add an existing entity to a new group created by a script ?
      I haven't found anything that sounds like "new_group.add_entity(old_entity))...
      Thanks in advance,

      DB

      1 Reply Last reply Reply Quote 0
      • W Offline
        wikii
        last edited by

        entities.add_group(old_entity)

        1 Reply Last reply Reply Quote 0
        • M Offline
          Matt666
          last edited by

          Hi Didier !
          Perhaps create a group with existing group and entity to add, and explode the existing group inside the new...
          Tu pourrais créer un nouveau groupe avec le groupe existant et l'entité à ajouter, puis exploser l'ancien groupe ?
          Le problème est si tu veux à tout prix garder le groupe existant (genre si tu as un nom, etc...)

          sel.add groupe
          sel.add entite
          model.active_entities.add_group sel
          groupe.explode
          

          Frenglish at its best !
          My scripts

          1 Reply Last reply Reply Quote 0
          • R Offline
            RickW
            last edited by

            Be careful, though, as you cannot add existing entities to a nested group. The group will exist in model.entities, and not as a nested group.

            model = Sketchup.active_model
            entities = model.entities
            group1 = entities.add_group
            face = group1.entities.add_face(points) #points should be defined, of course
            
            #============================================================================
            #  the following group, while coded to be a nested group, will not be nested
            #============================================================================
            
            group2 = group1.entities.add_group(face)
            
            

            Google is aware of the situation, but I doubt we'll see a fix before v8.

            RickW
            [www.smustard.com](http://www.smustard.com)

            1 Reply Last reply Reply Quote 0
            • M Offline
              Matt666
              last edited by

              ❓ ❓
              What's the problem if you create a new group with existing group and the entity to add, and AFTER you exploding the existing group inside the new group ??? All entities of the exploded group are in the new group, with the entity to add ! 😄
              You don't agree ?

              Frenglish at its best !
              My scripts

              1 Reply Last reply Reply Quote 0
              • Didier BurD Offline
                Didier Bur
                last edited by

                Hi,
                Thanks all,

                Sketchup.active_model.entities.add_group(old_entity) works 👍
                Sketchup.active_model.entities.add_group(Sketchup.active_model.selection) also works !
                Sketchup.active_model.entities.add_group([entity1,entity2,...,entityN]) works too.

                Could be put in the Wiki, because this is not mentionned in the regular doc.

                DB

                1 Reply Last reply Reply Quote 0
                • M Offline
                  Matt666
                  last edited by

                  Ah ok... I have not read the question enough... 😳 😳 😳
                  I understood : "Is there a way to add an existing entity to a existing group created by a script ?"

                  Hum hum 😕

                  Frenglish at its best !
                  My scripts

                  1 Reply Last reply Reply Quote 0
                  • J Offline
                    Jim
                    last edited by

                    @didier bur said:

                    Hi,
                    Thanks all,

                    Sketchup.active_model.entities.add_group(old_entity) works 👍
                    Sketchup.active_model.entities.add_group(Sketchup.active_model.selection) also works !
                    Sketchup.active_model.entities.add_group([entity1,entity2,...,entityN]) works too.

                    Could be put in the Wiki, because this is not mentionned in the regular doc.

                    The most recent documentation has been updated. See below for a link.

                    301 Moved Permanently

                    favicon

                    (www.sketchucation.com)

                    Hi

                    1 Reply Last reply Reply Quote 0
                    • Didier BurD Offline
                      Didier Bur
                      last edited by

                      @unknownuser said:

                      The most recent documentation has been updated

                      😳
                      Oops, apparently the problem for me isn't to know if an information exists, but to know where it is...

                      DB

                      1 Reply Last reply Reply Quote 0
                      • J Offline
                        Jim
                        last edited by

                        This is the documentation page I use - it's the most up-to-date:

                        Error 404 (Not Found)!!1

                        favicon

                        (groups.google.com)

                        Todd and Rick get all the credit for updating the docs - it's a thankless chore, no doubt.

                        I wish there was a way to see what changes have been made to the documentation. I've asked that document updates be logged for us, but maybe I'm asking too much.

                        Hi

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

                        Advertisement