Click or drag to resize

TransformTranslation Method (Double, Double, Double)

Constructs a new translation (move) tranformation. Right column is (dx, dy, dz, 1.0).

Namespace:  Rhino.Geometry
Assembly:  RhinoCommon (in RhinoCommon.dll)
Syntax
public static Transform Translation(
	double dx,
	double dy,
	double dz
)

Parameters

dx
Type: SystemDouble
Distance to translate (move) geometry along the world X axis.
dy
Type: SystemDouble
Distance to translate (move) geometry along the world Y axis.
dz
Type: SystemDouble
Distance to translate (move) geometry along the world Z axis.

Return Value

Type: Transform
A transform matrix which moves geometry with the specified distances.
Examples
using Rhino.Input;

partial class Examples
{
  public static Rhino.Commands.Result TransformBrep(Rhino.RhinoDoc doc)
  {
    Rhino.DocObjects.ObjRef rhobj;
    var rc = RhinoGet.GetOneObject("Select brep", true, Rhino.DocObjects.ObjectType.Brep, out rhobj);
    if(rc!= Rhino.Commands.Result.Success)
      return rc;

    // Simple translation transformation
    var xform = Rhino.Geometry.Transform.Translation(18,-18,25);
    doc.Objects.Transform(rhobj, xform, true);
    doc.Views.Redraw();
    return Rhino.Commands.Result.Success;
  }
}
import Rhino
import scriptcontext

def TransformBrep():
    rc, objref = Rhino.Input.RhinoGet.GetOneObject("Select brep", True, Rhino.DocObjects.ObjectType.Brep)
    if rc!=Rhino.Commands.Result.Success: return

    # Simple translation transformation
    xform = Rhino.Geometry.Transform.Translation(18,-18,25)
    scriptcontext.doc.Objects.Transform(objref, xform, True)
    scriptcontext.doc.Views.Redraw()

if __name__=="__main__":
    TransformBrep()
Version Information

Rhino for Mac

Supported in: 5.4

Rhino for Windows

Supported in: 6.5
See Also