Transformation - how to resize component?

Seems like there is no resize function in Sketchup. How do you do it if you want to resize to specified size? Eg, when you have a cube with dimensions 100;100;100 and want to change it to 80;70;60 ? Do you must to calculate the scaling and then use scaling method? No other way? I wonder why there is no resize function, which would make the calculation instead me.

You don’t have to calculate scale, rather active the scale on the object, then or after an initial scale move enter the x,y,z with units, so assuming mm, then enter 80mm,70mm,60mm
you can mix the units and ratios, or change again whilst still in scale mode

just realized you but this under developers, ruby…do you want to create code?

Yes, create code, please.

have a look at sketchup-shapes on github…

john

The scale tool modifies a component’s transformation, which is much more powerful (that’s why there is no direct scale function). The component already has a transformation. To modify the transformation you multiply it with a new transformation (which can be a translation, rotation, scaling, or mix).

scale_transformation = Geom::Transformation.scaling(0.8, 0.7, 0.6) # relative scaling factors
component_instance.transformation *= scale_transformation

If you want an absolute size (not relative), you can take into account the previous size:

absolute_scale = [80, 70, 60]
bounds = component_instance.bounds
scale_factors = [bounds.width, bounds.height, bounds.depth].zip(absolute_scale).map{ |old, new| new / old }
scale_transformation = Geom::Transformation.scaling(*scale_factors)
4 Likes

Thank you

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.