Transformation scale
-
Here is what i want to do:
Scale an object in ZSeems simple but the whole points-geometry-transformation thing is not always very clear to me
I know if i want to scale the first selected object 50% in z then this is the code:new_transformation=Geom;;Transformation.scaling thepoint,1,1,0.5 select[0].transformation=new_transformationNow, thepoint, should be the base point of scaling (I think). Which should be the center point of the bottom face of the bounding box.
I found this script to determine the center point of the top face of the bounding box:bb = Geom;;BoundingBox.new bb.add(select[0].bounds) if select[0].respond_to?("bounds") xmin=bb.min.x;ymin=bb.min.y;xmax=bb.max.x ymax=bb.max.y;zmin=bb.min.z;zmax=bb.max.z apex=Geom.linear_combination(0.5,[xmin,ymin,zmax+2],0.5,[xmax,ymax,zmax+2])Credits to who-ever wrote this!
When I use that I suspect the entity should be scaled 50% upwards (since i use the top center point) and that the entity stays on the same spot.
But somehow it moves to the origin. (with the 50% upwards scaling)
What don't I understand?


-
ok i've found it here: http://forums.sketchucation.com/viewtopic.php?f=180&t=24947&p=213942
use .transform! instead of .transformation
.transform adds the specified transformation to the already existing one
.transformation replaces the current transformation (like in: will put the object back to 0,0,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 LoginAdvertisement