trans function translates a point or a displacement from one coordinate system into another. It takes a point argument, pt, that can be interpreted as either a 3D point or a 3D displacement vector, distinguished by a displacement argument called disp. The disp argument must be nonzero if pt is to be treated as a displacement vector; otherwise, pt is treated as a point. A from argument specifies the coordinate system in which pt is expressed, and a to argument specifies the desired coordinate system. The following is the syntax for the trans function:
The(trans pt from to [disp])
from and to arguments:
The following AutoCAD coordinate systems can be specified by theWorld coordinate systemâ€”the reference coordinate system. All other coordinate systems are defined relative to the WCS, which never changes. Values measured relative to the WCS are stable across changes to other coordinate systems.
* at the Command prompt). If you want your application to send coordinates in the WCS, OCS, or DCS to AutoCAD commands, you must first convert them to the UCS by calling the trans function.
User coordinate systemâ€”the working coordinate system. The user specifies a UCS to make drawing tasks easier. All points passed to AutoCAD commands, including those returned from AutoLISP routines and external functions, are points in the current UCS (unless the user precedes them with aentget are expressed in this coordinate system, relative to the object itself. These points are usually converted into the WCS, current UCS, or current DCS, according to the intended use of the object. Conversely, points must be translated into an OCS before they are written to the database by means of the entmod or entmake functions. This is also known as the entity coordinate system.
Object coordinate systemâ€”point values returned byTARGET, and its Z axis is the viewing direction. In other words, a viewport is always a plan view of its DCS. These coordinates can be used to determine where something will be displayed to the AutoCAD user.
Display coordinate systemâ€”the coordinate system into which objects are transformed before they are displayed. The origin of the DCS is the point stored in the AutoCAD system variablefrom and to integer codes are 2 and 3, in either order, 2 indicates the DCS for the current model space viewport and 3 indicates the DCS for paper space (PSDCS). When the 2 code is used with an integer code other than 3 (or another means of specifying the coordinate system), it is assumed to indicate the DCS of the current space, whether paper space or model space. The other argument is also assumed to indicate a coordinate system in the current space.
When thedisp argument is 0. The Z coordinate is scaled but is never translated. Therefore, it can be used to find the scale factor between the two coordinate systems. The PSDCS (integer code 2) can be transformed only into the current model space viewport. If the from argument equals 3, the to argument must equal 2, and vice versa.
Paper space DCSâ€”this coordinate system can be transformed only to or from the DCS of the currently active model space viewport. This is essentially a 2D transformation, where the X and Y coordinates are always scaled and are offset if theBoth the from and to arguments can specify a coordinate system in any of the following ways:
to and from arguments:
The following table lists the valid integer codes that can be used as theCoordinate system codes 


Code 
Coordinate system 
0 
World (WCS) 
1 
User (current UCS) 
2 
Display; DCS of current viewport when used with code 0 or 1, DCS of current model space viewport when used with code 3 
3 
Paper space DCS, PSDCS (used only with code 2) 
The following example translates a point from the WCS into the current UCS.
(setq pt '(1.0 2.0 3.0))
(setq cs_from 0) ; WCS
(setq cs_to 1) ; UCS
(trans pt cs_from cs_to 0) ; disp = 0 indicates that pt is a point
trans returns a point (2.0,1.0,3.0). However, if you swap the to and from values, the result differs as shown in the following code:
If the current UCS is rotated 90 degrees counterclockwise around the World Z axis, the call to(trans pt cs_to cs_from 0) ; the result isâ€ƒ(2.0,1.0,3.0)