Resizing a Component
-
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
-
@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
-
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
-
Question for ebelg2000: How complex is the component? Is it more than just a cube?
-
@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.
-
@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.
-
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.
-
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!
Advertisement