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!
    ⚠️ Update | Sketchucation Tools 5.0.8 released with licensing improvements and bugfixes Download

    Deleting group.copy?

    Scheduled Pinned Locked Moved Developers' Forum
    8 Posts 3 Posters 559 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.
    • L
      lothcat
      last edited by

      I am having a hard time figuring out how to delete a group. I'm making a copy of a group to explode it and look at the faces, because I want to keep the original group intact, and then when I'm done with the copy, I want to get rid of it.

      Here's my code:

           if entity.typename == "Group"
      	 #UI.messagebox "Group!"
               copy_group = entity.copy
      		 status = copy_group.explode
      		 facecounter(status)
      

      I tried using entities.erase_entities copy_group where entities = Sketchup.active_model.active_entities, but that didn't work, so now I'm wondering if there's a better way.

      1 Reply Last reply
      Reply Quote 0
      • thomthomT
        thomthom
        last edited by

        group.erase!

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

        1 Reply Last reply
        Reply Quote 0
        • thomthomT
          thomthom
          last edited by

          @lothcat said:

          I'm making a copy of a group to explode it and look at the faces

          What do you mean by this? "Look at the faces"? I'm wondering why you are making seemingly temp groups to inspect something.

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

          1 Reply Last reply
          Reply Quote 0
          • L
            lothcat
            last edited by

            @thomthom said:

            What do you mean by this? "Look at the faces"? I'm wondering why you are making seemingly temp groups to inspect something.

            I have attributes attached to the faces that I need to read, but I also have attributes attached to the group. If I don't explode the group, I can't get to the attributes in the face, but if I do explode the group, I lose the group attributes.

            Probably not the best way to do it, but it works.

            And thank you for the help!

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

              You can access any face's attributes whether or not it's inside a group ??
              I fail to understand you fully. πŸ˜•

              TIG

              1 Reply Last reply
              Reply Quote 0
              • thomthomT
                thomthom
                last edited by

                @lothcat said:

                If I don't explode the group, I can't get to the attributes in the face

                You can access any entity within any context (group/component) at any time.

                I think it's best here to go back a step and look at what you try to do.

                <span class="syntaxdefault"><br /></span><span class="syntaxcomment">#&nbsp;Read&nbsp;group&nbsp;attributes<br /></span><span class="syntaxdefault">x&nbsp;</span><span class="syntaxkeyword">=&nbsp;</span><span class="syntaxdefault">group</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">get_attribute</span><span class="syntaxkeyword">(&nbsp;</span><span class="syntaxstring">'Foo'</span><span class="syntaxkeyword">,&nbsp;</span><span class="syntaxstring">'Bar'&nbsp;</span><span class="syntaxkeyword">)<br /></span><span class="syntaxcomment">#&nbsp;Read&nbsp;attributes&nbsp;from&nbsp;faces&nbsp;inside<br /></span><span class="syntaxkeyword">for&nbsp;</span><span class="syntaxdefault">entity&nbsp;in&nbsp;group</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">entities<br />&nbsp;&nbsp;next&nbsp;unless&nbsp;entity</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">is_a</span><span class="syntaxkeyword">?(&nbsp;</span><span class="syntaxdefault">Sketchup</span><span class="syntaxkeyword">;;</span><span class="syntaxdefault">Face&nbsp;</span><span class="syntaxkeyword">)<br />&nbsp;&nbsp;</span><span class="syntaxdefault">x&nbsp;</span><span class="syntaxkeyword">=&nbsp;</span><span class="syntaxdefault">entity</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">get_attribute</span><span class="syntaxkeyword">(&nbsp;</span><span class="syntaxstring">'Foo'</span><span class="syntaxkeyword">,&nbsp;</span><span class="syntaxstring">'Bar'&nbsp;</span><span class="syntaxkeyword">)<br /></span><span class="syntaxdefault">end<br /></span>
                

                Maybe we should step back even further and ask why you are using attributes? (Just in case there is another way for what you want to do.)

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

                1 Reply Last reply
                Reply Quote 0
                • L
                  lothcat
                  last edited by

                  That may just work. And I figured out why I can't erase the group.copy - because I exploded it. Sometimes I feel dumb.

                  1 Reply Last reply
                  Reply Quote 0
                  • L
                    lothcat
                    last edited by

                    Yeah, that worked, and not having to explode my group fixed a lot of problems. Thank you!

                    1 Reply Last reply
                    Reply Quote 0

                    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 Login
                    • 1 / 1
                    • First post
                      Last post
                    Buy SketchPlus
                    Buy SUbD
                    Buy WrapR
                    Buy eBook
                    Buy Modelur
                    Buy Vertex Tools
                    Buy SketchCuisine
                    Buy FormFonts

                    Advertisement