Tharwat 发表于 2022-7-6 10:57:58

entmake (trans pt 0 1)

Hello.
An entmake function;

(entmake (list '(0 . "TEXT")                  (cons 40 (getvar 'textsize))                  (cons 10 (trans pt 1 0))                  (cons 1 a)))
Once I have changed the 1 and 0 in (trans pt 1 0) to so many different
numbers, But I have not noticed the changes or actually nothing has changed.
 
So whats going on ... ?
 
Tharwat

Lee Mac 发表于 2022-7-6 11:18:54

Have you read the help file on TRANS?

Tharwat 发表于 2022-7-6 11:22:05

here what it says;

TEXTThe following group codes apply to text entities. In addition to the groupcodes described here, see Common Group Codes for Entities on page 61. Forinformation about abbreviations and formatting used in this table, seeFormatting Conventions in This Reference on page 2.Text group codesGroup code Description100 Subclass marker (AcDbText)39 Thickness (optional; default = 0)10 First alignment point (in OCS)DXF: X value; APP: 3D point
 
10 First alignment point (in OCS)
DXF: X value; APP: 3D point =
it means to me that it is supposed to be the start point although I have already start point to locate my text.
 
Regards,
Tharwat

Lee Mac 发表于 2022-7-6 11:35:18

I'll ask it again:
 

asos2000 发表于 2022-7-6 11:47:12

You can notes the changes
only when u change UCS.
 
Change UCS then try to play with these numbers
 
This is from help file
 

ExamplesIn the following examples, the UCS is rotated90 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)The coordinate systems are discussed in greater detail in Coordinate System Transformations in the AutoLISP Developer's Guide.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 fromthe text object's OCS to the UCS.
 
I hope this example helps.
 
Hasan

The Buzzard 发表于 2022-7-6 12:02:22

 
trans Function
 
Translates a point (or a displacement) from one coordinate system to another
 
(trans pt from to )
 
Arguments
 
pt
 
A list of three reals that can be interpreted as either a 3D point or a 3D displacement (vector).
 
from
 
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:
 
0World (WCS)
 
1User (current UCS)
 
2If 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.
 
3Paper space DCS (used only with code 2)
 
to
 
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.
 
disp
 
If present and is not nil, this argument specifies that pt is to be treated as a 3D displacement rather than as a point.
 
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.
 
Return 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 World 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)
 
The coordinate systems are discussed in greater detail in Coordinate System Transformations in the AutoLISP Developer's Guide.
 
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.
 
(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 MOVE command) by the UCS-relative offset (1,2,3), you need to convert the displacement from the UCS to the circle's 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.
 
(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.
 
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 filledin Z value is determined as shown in the following table. Converted 2D point Z values
页: [1]
查看完整版本: entmake (trans pt 0 1)