Uniform Scale


Geometric definition


A uniform scaling is a transformation that changes the size of a geometry by a certain factor in all directions. The factor can be defined by a number.

How to add


As often is possible in Rhino to use either RhinoCommons or RhinoScriptSynthax to add a point to the Rhino workspace. Here are the two methods:

RhinoCommons


import Rhino.Geometry as rg
import scriptcontext as sc

# define a scale transformation

# create a rectangle
rectangle = rg.Rectangle3d(rg.Plane.WorldXY, 10, 10)

# create a scale transformation
scale = rg.Transform.Scale(rg.Point3d.Origin,  # scale center
                           1.5)                # scale factor

# transform the rectangle
rectangle.Transform(scale)

# add the rectangle to the document
sc.doc.Objects.AddRectangle(rectangle)


RhinoScriptSynthax


import rhinoscriptsyntax as rs

# create a rectangle
rectangle_id = rs.AddRectangle(rs.WorldXYPlane(), 10, 10)

# create a scale transformation
scale = rs.Scale(rs.WorldXYPlane(),  # the plane on which to scale
                1.5,                 # the scale factor in x
                1.5,                 # the scale factor in y
                1.5)                 # the scale factor in z

# apply the transformation to the rectangle
rs.TransformObject(rectangle_id, scale)

Main methods and properties


Operators


Scaling as all the other transformations have a set of operators that can be used to perform to combine transformations (also different kinds, e.g.: translation with rotation). Here are the main ones:


xform_1 = rg.Transform.Scale(rg.Point3d.Origin, 1.5)
xform_2 = rg.Transform.Scale(rg.Point3d.Origin, 0.2)

xform_3 = xform_1 * xform_2 # Will combine the two transformations

⚠️ Note that the order of the transformations is important. In the example above the first transformation will be applied first and the second transformation will be applied second. ⚠️

Properties


Scaling as all the other transformations have a set of properties that can be used to retrieve information about the transformation. Here are the main ones:

scale = rg.Transform.Scale(rg.Point3d.Origin, 1.5)

scale.IsIdentity # Will return True if the transformation is an identity transformation
scale.IsZero # Will return True if the transformation is a zero transformation
scale.IsValid # Will return True if the transformation is valid