乐筑天下

搜索
欢迎各位开发者和用户入驻本平台 尊重版权,从我做起,拒绝盗版,拒绝倒卖 签到、发布资源、邀请好友注册,可以获得银币 请注意保管好自己的密码,避免账户资金被盗
查看: 60|回复: 5

[编程交流] entmake (trans pt 0 1)

[复制链接]

63

主题

6297

帖子

6283

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
358
发表于 2022-7-6 10:57:58 | 显示全部楼层 |阅读模式
Hello.
An entmake function;
  1. (entmake (list '(0 . "TEXT")                  (cons 40 (getvar 'textsize))                  (cons 10 (trans pt [color="Red"]1 0[/color]))                  (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
回复

使用道具 举报

114

主题

1万

帖子

1万

银币

中流砥柱

Rank: 25

铜币
543
发表于 2022-7-6 11:18:54 | 显示全部楼层
Have you read the help file on TRANS?
回复

使用道具 举报

63

主题

6297

帖子

6283

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
358
发表于 2022-7-6 11:22:05 | 显示全部楼层
here what it says;
  1. 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
回复

使用道具 举报

114

主题

1万

帖子

1万

银币

中流砥柱

Rank: 25

铜币
543
发表于 2022-7-6 11:35:18 | 显示全部楼层
I'll ask it again:
 
回复

使用道具 举报

51

主题

481

帖子

457

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
262
发表于 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
 
  1. ExamplesIn the following examples, the [color=red]UCS is rotated[/color][color=red]90 degrees counterclockwise around the WCS Z axis[/color]:Command: ([color=#ffffff]trans[/color] '(1.0 2.0 3.0) 0 1) (2.0 -1.0 3.0)Command: ([color=#ffffff]trans[/color] '(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
回复

使用道具 举报

32

主题

1166

帖子

1146

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
159
发表于 2022-7-6 12:02:22 | 显示全部楼层
 
trans Function
 
Translates a point (or a displacement) from one coordinate system to another
 
(trans pt from to [disp])
 
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:
 
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)
 
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
回复

使用道具 举报

发表回复

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

QQ|关于我们|小黑屋|乐筑天下 繁体中文

GMT+8, 2025-3-6 12:12 , Processed in 0.356774 second(s), 64 queries .

© 2020-2025 乐筑天下

联系客服 关注微信 帮助中心 下载APP 返回顶部 返回列表