Translates a point (or a displacement) from one coordinate system to another
(trans pt from to [disp])
Arguments
A list of three reals that can be interpreted as either a 3D point or a 3D displacement (vector).
An integer code, entity name, or 3D extrusion vector identifying the coordinate system in which pt is expressed. The integer code can be one of the following:
0â€ƒWorld (WCS)
1â€ƒUser (current UCS)
2â€ƒIf used with code 0 or 1, this indicates the Display Coordinate System (DCS) of the current viewport. When used with code 3, it indicates the DCS of the current model space viewport.
3â€ƒPaper space DCS (used only with code 2)
An integer code, entity name, or 3D extrusion vector identifying the coordinate system of the returned point. See the from argument for a list of valid integer codes.
nil, this argument specifies that pt is to be treated as a 3D displacement rather than as a point.
If present and is notentnext, entlast, entsel, nentsel, and ssname functions. This format lets you translate a point to and from the Object Coordinate System (OCS) of a particular object. (For some objects, the OCS is equivalent to the WCS; for these objects, conversion between OCS and WCS is a null operation.) A 3D extrusion vector (a list of three reals) is another method of converting to and from an object's OCS. However, this does not work for those objects whose OCS is equivalent to the WCS.
If you use an entity name for the from or to argument, it must be passed in the format returned by theReturn Values
A 3D point (or displacement) in the requested to coordinate system.
Examples
In the following examples, the UCS is rotated 90 degrees counterclockwise around the WCS Z axis:
Command: (trans '(1.0 2.0 3.0) 0 1)
(2.0 1.0 3.0)
Command: (trans '(1.0 2.0 3.0) 1 0)
(2.0 1.0 3.0)
Coordinate System Transformations in the AutoLISP Developer's Guide.
The coordinate systems are discussed in greater detail inFor example, to draw a line from the insertion point of a piece of text (without using Osnap), you convert the text object's insertion point from the text object's OCS to the UCS.
(trans textinsertpointtextename 1)
You can then pass the result to the From Point prompt.
entmod. For example, if you want to move a circle (without using the MOVE command) by the UCSrelative offset (1,2,3), you need to convert the displacement from the UCS to the circle's OCS:
Conversely, you must convert point (or displacement) values to their destination OCS before feeding them to(trans '(1 2 3) 1 circleename)
Then you add the resulting displacement to the circle's center point.
For example, if you have a point entered by the user and want to find out which end of a line it looks closer to, you convert the user's point from the UCS to the DCS.
(trans userpoint 1 2)
Then you convert each of the line's endpoints from the OCS to the DCS.
(trans endpoint lineename 2)
From there you can compute the distance between the user's point and each endpoint of the line (ignoring the Z coordinates) to determine which end looks closer.
trans function can also transform 2D points. It does this by setting the Z coordinate to an appropriate value. The Z component used depends on the from coordinate system that was specified and on whether the value is to be converted as a point or as a displacement. If the value is to be converted as a displacement, the Z value is always 0.0; if the value is to be converted as a point, the filledin Z value is determined as shown in the following table:
TheConverted 2D point Z values 


From 
Filledin Z value 
WCS 
0.0 
UCS 
Current elevation 
OCS 
0.0 
DCS 
Projected to the current construction plane (UCS XY plane + current elevation) 
PSDCS 
Projected to the current construction plane (UCS XY plane + current elevation) 