trans - 좌표계 변환

Auto CAD/SetVar |2020. 2. 25. 13:16


trans (AutoLISP)

Translates a point (or a displacement) from one coordinate system to another

Supported Platforms: Windows and Mac OS

Signature

(trans pt from to [disp])
pt

Type: List

A list of three reals that can be interpreted as either a 3D point or a 3D displacement (vector).

3D 점 또는 3D 변위 (벡터)로 해석 될 수있는 3 개의 실수 목록입니다.
from

Type: Integer, List, or Ename (entity name)

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:

pt가 표현되는 좌표계를 식별하는 정수 코드, 엔티티 이름 또는 3D 돌출 벡터입니다. 정수 코드는 다음 중 하나 일 수 있습니다.

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.

코드 0 또는 1과 함께 사용하면 현재 뷰포트의 디스플레이 좌표계 (DCS)를 나타냅니다. 코드 3과 함께 사용하면 현재 모형 공간 뷰포트의 DCS를 나타냅니다.

3 -- Paper space DCS (used only with code 2)

 

to

Type: Integer, List, or Ename (entity name)

반환 된 점의 좌표계를 식별하는 정수 코드, 엔티티 이름 또는 3D 돌출 벡터입니다. 유효한 정수 코드 목록은 from 인수를 참조하십시오.
disp

Type:List

If present and is not 

nil

, this argument specifies that pt is to be treated as a 3D displacement rather than as a point.

존재하고 nil이 아닌 경우,이 인수는 pt가 점이 아닌 3D 변위로 취급되도록 지정합니다.

Return Values

Type: List

A 3D point (or displacement) in the requested to coordinate system.

시스템 조정 요청 된 3D 점 (또는 변위)

Remarks

If you use an entity name for the from or to argument, it must be passed in the format returned by the 

entnext

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.

from 또는 to 인수에 엔티티 이름을 사용하는 경우 entnext, entlast, entsel, nentsel 및 ssname 함수가 리턴 한 형식으로 전달해야합니다. 이 형식을 사용하면 특정 객체의 객체 좌표계 (OCS)와 포인트를 변환 할 수 있습니다. (일부 개체의 경우 OCS는 WCS와 동일합니다. 이러한 개체의 경우 OCS와 WCS 간의 변환은 null 연산입니다.) 3D 돌출 벡터 (실제 3 개의 목록)는 개체의 OCS로 (부터) 변환하는 또 다른 방법입니다. . 그러나 OCS가 WCS와 동일한 오브젝트에는 작동하지 않습니다.

The 

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 filled-in Z value is determined as shown in the following table:

트랜스 함수는 2D 포인트를 변형 할 수도 있습니다. Z 좌표를 적절한 값으로 설정하면됩니다. 사용되는 Z 구성 요소는 지정된 시작 좌표계 및 값을 점으로 변환할지 또는 변위로 변환할지에 따라 다릅니다. 값이 변위로 변환되는 경우 Z 값은 항상 0.0입니다. 값이 점으로 변환되는 경우 채워진 Z 값은 다음 표에 표시된대로 결정됩니다.

Converted 2D point Z values

From

Filled-in 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)

Examples

In the following examples, the UCS is rotated 90 degrees counterclockwise around the WCS Z axis:

(trans '(1.0 2.0 3.0) 0 1) (2.0 -1.0 3.0)  (trans '(1.0 2.0 3.0) 1 0) (-2.0 1.0 3.0)

For 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.

예를 들어, Osnap을 사용하지 않고 텍스트의 삽입 점에서 선을 그리려면 텍스트 오브젝트의 삽입 점을 텍스트 오브젝트의 OCS에서 UCS로 변환합니다.
(trans text-insert-point text-ename 1)

You can then pass the result to the From Point prompt.

Conversely, you must convert point (or displacement) values to their destination OCS before feeding them to 

entmod

. For example, if you want to move a circle (without using the AutoCAD MOVE command) by the UCS-relative offset (1,2,3), you need to convert the displacement from the UCS to the circle's OCS:

그런 다음 결과를 시작점 프롬프트로 전달할 수 있습니다.

반대로 entmod에 공급하기 전에 점 (또는 변위) 값을 대상 OCS로 변환해야합니다. 예를 들어, UCS 기준 오프셋 (1,2,3)으로 원을 이동하려면 (AutoCAD MOVE 명령을 사용하지 않고) UCS에서 원의 OCS로 변위를 변환해야합니다.

(trans '(1 2 3) 1 circle-ename)

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.

그런 다음 결과 변위를 원의 중심점에 추가합니다.

예를 들어, 사용자가 입력 한 점이 있고 더 가까운 선의 끝을 찾으려면 사용자의 점을 UCS에서 DCS로 변환합니다.

(trans user-point 1 2)

Then you convert each of the line's endpoints from the OCS to the DCS.

(trans endpoint line-ename 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.

 

댓글()