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!
    Mac User? | Join the Rayscaper Beta for Mac Learn More

    Solid Trim Tool

    Scheduled Pinned Locked Moved Plugins
    19 Posts 7 Posters 2.0k Views 7 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.
    • E
      ebelg2000
      last edited by

      Thanks for the quick response. This certainly works more efficiently.

      1 Reply Last reply
      Reply Quote 0
      • Dave RD
        Dave R
        last edited by

        Jim's "Solids Trim and Keep" definitely makes it a lot easier although for creating mortises. I would really prefer it if the native Solid Tools didn't convert components to groups. It leads to much more work than cutting the mortises manually with the Rectangle tool and Push/Pull.

        Etaoin Shrdlu

        %

        (THERE'S NO PLACE LIKE)

        G28 X0.0 Y0.0 Z0.0

        M30

        %

        1 Reply Last reply
        Reply Quote 0
        • A
          ArCAD-UK
          last edited by

          Plus it migrates the group to layer 0 ๐Ÿ‘Ž

          1 Reply Last reply
          Reply Quote 0
          • Dave RD
            Dave R
            last edited by

            Trim and Keep does that, too.

            Etaoin Shrdlu

            %

            (THERE'S NO PLACE LIKE)

            G28 X0.0 Y0.0 Z0.0

            M30

            %

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

              To keep the layers unchanged edit Jim's script with Notepad or a similar plain-text editor, around line#81 you need to change this

              def_to_keep.name = @model.definitions.unique_name(name)
              grp = @first_picked.trim(@last_picked)
              
              

              to this

              layer=@last_picked.layer
              def_to_keep.name = @model.definitions.unique_name(name)
              grp = @first_picked.trim(@last_picked)
              grp.layer=layer
              

              The two extra lines saving/using the original's layer... so that it will retain the original layering of the now-trimmed-object.

              Also, if you find yourself always purging the original unused untrimmed version, then you can further adjust the code, just before it says ' @model.commit_operation' insert these lines of code reading

              if UI.messagebox("Delete Unused Definition?",MB_YESNO,"")==6
                  def_to_keep.entities.erase_entities(def_to_keep.entities.to_a)
              end
              @model.commit_operation
              

              On 'Yes' it will remove the earlier definition from the Component Browser's list after all instances of it have now been set to be ' new_def'... This will save you having to purge it later manually...

              TIG

              1 Reply Last reply
              Reply Quote 0
              • Dave RD
                Dave R
                last edited by

                Thank you TIG! Both of those work like a charm.

                Etaoin Shrdlu

                %

                (THERE'S NO PLACE LIKE)

                G28 X0.0 Y0.0 Z0.0

                M30

                %

                1 Reply Last reply
                Reply Quote 0
                • R
                  Robert Lang
                  last edited by

                  Without the plug in you can simply select the new group and explode it. After the explode, all the geometry is selected so you can right click and select "Make Component". Give it the exact same name it had to begin with and all is well.

                  Bob Lang

                  1 Reply Last reply
                  Reply Quote 0
                  • Dave RD
                    Dave R
                    last edited by

                    That does work but it's extra steps.

                    Etaoin Shrdlu

                    %

                    (THERE'S NO PLACE LIKE)

                    G28 X0.0 Y0.0 Z0.0

                    M30

                    %

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

                      Also you'd need to reassign the original layer manually [if you remembered it].

                      So Jim's tool - with my tweaks - means the trimmed component >> group is automatically made back into a component of the same name [including all instances updated], it's kept on its original layer, and you have the option of removing the now unused component from the browser or keeping it if you might like to reuse it somehow... โ˜€

                      TIG

                      1 Reply Last reply
                      Reply Quote 0
                      • Dave RD
                        Dave R
                        last edited by

                        And after exploding, you'd have to move the geometry back to Layer 0 where it should be.

                        I have a keyboard shortcut for Jim's plugin and now, with the modification it is absolutely painless for even the most simple trim operations.

                        Etaoin Shrdlu

                        %

                        (THERE'S NO PLACE LIKE)

                        G28 X0.0 Y0.0 Z0.0

                        M30

                        %

                        1 Reply Last reply
                        Reply Quote 0
                        • Dave RD
                          Dave R
                          last edited by

                          TIG, out of curiosity, assume that there would never be a need to keep the original version of the component. what would the code be to make the script automatically purge the unused version?

                          Etaoin Shrdlu

                          %

                          (THERE'S NO PLACE LIKE)

                          G28 X0.0 Y0.0 Z0.0

                          M30

                          %

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

                            Remove the two lines ' if...' and ' end' at the start/end of the added code, so that the only thing you add is def_to_keep.entities.erase_entities(def_to_keep.entities.to_a) before the @model.commit_operation

                            Then there's no choice - the original object's shape is lost... ๐Ÿ˜ฎ

                            TIG

                            1 Reply Last reply
                            Reply Quote 0
                            • Dave RD
                              Dave R
                              last edited by

                              Thanks, TIG.

                              If I were using other tools to do the same thing I would do with Trim and Keep I wouldn't have the original shape either. So far that's never been a problem.

                              Etaoin Shrdlu

                              %

                              (THERE'S NO PLACE LIKE)

                              G28 X0.0 Y0.0 Z0.0

                              M30

                              %

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

                                OK...
                                If you ever need to delete a group/component in code you can use
                                * defn.entities.erase_entities(def_to_keep.entities.to_a)
                                or to be even shorter
                                * defn.entities.clear!
                                !!!

                                Calling it * def_to_keep is somewhat whimsical as it's the one to go !
                                Which is actually the same thing - but perhaps easier to grasp ?!
                                Always provided that it's inside a model.start_operation()...model.commit_operation block

                                TIG

                                1 Reply Last reply
                                Reply Quote 0
                                • bmikeB
                                  bmike
                                  last edited by

                                  thanks TIG, marked to come back and tinker with code later....

                                  mike beganyi design + consulting llc

                                  1 Reply Last reply
                                  Reply Quote 0
                                  • D
                                    david.
                                    last edited by

                                    LIL

                                    Seems like this thread is a more general topic than Woodworking. I was wondering if it should/could be moved to the SU Discussions subforum? Just a thought...

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

                                      I've moved this thread into Plugins, which is probably a more logical home for it...

                                      TIG

                                      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