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

    Resizing a Component

    Scheduled Pinned Locked Moved Woodworking
    8 Posts 3 Posters 2.3k 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.
    • E Offline
      ebelg2000
      last edited by

      Is there an easy way to resize a compenent, adding a uniform amount to each side? For instance, if I have a component that is 10" x 10", is there a way to add 1/4" to each side, changing it to a 10.5" x 10.5" other than by using push pull on each of the edges? Thanks

      1 Reply Last reply Reply Quote 0
      • sdmitchS Offline
        sdmitch
        last edited by

        @ebelg2000 said:

        Is there an easy way to resize a compenent, adding a uniform amount to each side? For instance, if I have a component that is 10" x 10", is there a way to add 1/4" to each side, changing it to a 10.5" x 10.5" other than by using push pull on each of the edges? Thanks

        Scaling the component instance about it's center using Ruby is probably the easiest way to do it.

        @mod = Sketchup.active_model
        @ent = @mod.active_entities
        @sel = @mod.selection
        @vue = @mod.active_view
        ci = @sel.grep(Sketchup;;ComponentInstance)[0]
        if ci
         dims = UI.inputbox(["New Wid;","New Hgt;","New Dep;"],[ci.bounds.width,ci.bounds.height,ci.bounds.depth],"Resize Component")
         if dims
          wid,hgt,dep=dims
          xscl = wid/ci.bounds.width
          yscl = hgt/ci.bounds.height
          zscl = dep/ci.bounds.depth
          org = ci.bounds.center
          tr = Geom;;Transformation.scaling(org,xscl,yscl,zscl)
          ci.make_unique; ci.transform! tr
         end
        end
        

        resize ci.gif

        Nothing is worthless, it can always be used as a bad example.

        http://sdmitch.blogspot.com/

        1 Reply Last reply Reply Quote 0
        • E Offline
          ebelg2000
          last edited by

          Thanks, that's great, exactly what I had in mind and more. My problem now is I have absolutely zero knowledge of Ruby and therefore how to implement your solution. Any suggestions on how I might proceed would be greatly appreciated. Thanks again for your help

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

            Question for ebelg2000: How complex is the component? Is it more than just a cube?

            Etaoin Shrdlu

            %

            (THERE'S NO PLACE LIKE)

            G28 X0.0 Y0.0 Z0.0

            M30

            %

            1 Reply Last reply Reply Quote 0
            • sdmitchS Offline
              sdmitch
              last edited by

              @ebelg2000 said:

              Thanks, that's great, exactly what I had in mind and more. My problem now is I have absolutely zero knowledge of Ruby and therefore how to implement your solution. Any suggestions on how I might proceed would be greatly appreciated. Thanks again for your help

              Select the Component Instance. Open the Ruby Console, Window>Ruby Console. Copy and Paste the code into the Ruby Console input and press Enter. You can repeat the process by selecting another Component Instance. Clicking the the Ruby Console input and pressing the Up arrow and then the Enter key.

              This is a simplistic solution and will only work with Component Instances that are not rotated by some angle other than 90 degrees due to the bounding box expanding and contracting base on the rotation.

              Nothing is worthless, it can always be used as a bad example.

              http://sdmitch.blogspot.com/

              1 Reply Last reply Reply Quote 0
              • E Offline
                ebelg2000
                last edited by

                @dave r said:

                Question for ebelg2000: How complex is the component? Is it more than just a cube?

                Dave, no nothing anymore complex. I had drawn a rectangular component as the start of a raised panel and then decided to change dimensions. As I was using push pull to add 1/4" to each edge of the panel I wondered if there was an easy way to accomplish the same thing.

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

                  Ah. Understood.

                  Not to take anything away from the script by sdmitch (it works a treat doing what it does) but be open to the idea of redrawing components when it makes sense. For a panel in a frame and panel door, it might actually be faster to delete the original geometry in the component and replace it with new geometry that is the right size. Also consider that the Move tool is often more appropriate than the Scaling for resizing.

                  Etaoin Shrdlu

                  %

                  (THERE'S NO PLACE LIKE)

                  G28 X0.0 Y0.0 Z0.0

                  M30

                  %

                  1 Reply Last reply Reply Quote 0
                  • E Offline
                    ebelg2000
                    last edited by

                    Thanks guys for your input, I really appreciate it. Dave thanks for the comments an SDmitch thanks for the help. I did come across a post that led me to Fredos Scale tool that lets you scale a component to a specific dimension which seems to be just what I had in mind. Thanks again!

                    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