sketchucation logo sketchucation
    • Login
    Oops, your profile's looking a bit empty! To help us tailor your experience, please fill in key details like your SketchUp version, skill level, operating system, and more. Update and save your info on your profile page today!
    ⚠️ Important | Libfredo 15.6b introduces important bugfixes for Fredo's Extensions Update

    Add_group with argument

    Scheduled Pinned Locked Moved Developers' Forum
    5 Posts 3 Posters 442 Views 3 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.
    • fredo6F Offline
      fredo6
      last edited by

      Doing some tests, I realized that entities.add_group <list_of_entities> will not really add a new group containing the list of entities.

      Instead it will make put the entities into a new group, that is, create a new group and move the entities inside.

      This is the behavior in SU8, SU13 and SU14.

      So, it is in reality equivalent to a "Make Group" function.

      Did I miss something?

      Fredo

      1 Reply Last reply Reply Quote 0
      • S Offline
        slbaumgartner
        last edited by

        @fredo6 said:

        Doing some tests, I realized that entities.add_group <list_of_entities> will not really add a new group containing the list of entities.

        Instead it will make put the entities into a new group, that is, create a new group and move the entities inside.

        This is the behavior in SU8, SU13 and SU14.

        So, it is in reality equivalent to a "Make Group" function.

        Did I miss something?

        Fredo

        Your confusion confuses me ❓

        My read of the API is that if e is an Entities collection, g= e.add_group creates a new group g within e. When you provide entities as an argument to the method, it puts them into g.entities. What did you think would happen?

        Steve

        1 Reply Last reply Reply Quote 0
        • fredo6F Offline
          fredo6
          last edited by

          I would have thought that SU would rather 'copy' the entities, not 'move' them.

          Fredo

          1 Reply Last reply Reply Quote 0
          • TIGT Offline
            TIG Moderator
            last edited by

            Remember too that it splats if the passed entities in add_group() are not in the active_entities context !

            Assuming manual selection.

            grp = selection[0].parent.entities.add_group(selection.to_a)

            Does exactly what would happen if you selected some things and invoked the native 'Make Group'.

            If you want to COPY the selected items into a group then use this process:

            grp = selection[0].parent.entities.add_group(selection.to_a) grp2 = selection[0].parent.entities.add_instance(grp.entities.parent, grp.transformation) grp.explode grp = grp2 grp2 = nil

            Now grp refers to the group of selected objects but the 'originals' are still in place...

            TIG

            1 Reply Last reply Reply Quote 0
            • fredo6F Offline
              fredo6
              last edited by

              TIG,

              Thanks. Indeed, once it is clear that this is an equivalent to make_group, I can manage to design a 'copy-as-group'.

              Thanks to all

              Fredo

              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