乐筑天下

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

急救:获取坐标、对象的精度问题

[复制链接]

8

主题

22

帖子

3

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
54
发表于 2004-9-14 00:36:00 | 显示全部楼层 |阅读模式
我在用getpoint         inters命令获取点的坐标时,
发现精度往往只有到小数点后面第二位,不是四舍五入,而是直接取两位,或者三位。
因为本人工作需要严格精确到小数点后面3位,一般精确到第四位。
这个问题我该怎么解决?
                                         我发现id,list命令的回应中,关于坐标的精度是随cad里的设置而取舍的。
如果我不能通过getpoint等方法获得坐标。我如何可以通过id命令(如果可以)获得坐标。
本人面对2000多个桩点,已经束手无策了。请老大们帮我。
回复

使用道具 举报

16

主题

909

帖子

8

银币

中流砥柱

Rank: 25

铜币
973
发表于 2004-9-14 07:15:00 | 显示全部楼层
How are you going to use the return values? Actually, it doesn't lose precision when you use the return value of getpoint.
Command: (rtos (car (getpoint)) 2 10)
"712.3574499142"
回复

使用道具 举报

8

主题

22

帖子

3

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
54
发表于 2004-9-15 01:29:00 | 显示全部楼层
帅哥你真cool!
我用论坛里前辈的方法已经能够实现。也是用的rots函数,将其转化成为字符串就好了。
您知道怎么将文字改变颜色吗?entget 显示的信息没有文字颜色的项目。
请帅哥教教我吧。
回复

使用道具 举报

26

主题

3072

帖子

10

银币

社区元老

Rank: 75Rank: 75Rank: 75

铜币
3177
发表于 2004-9-15 08:23:00 | 显示全部楼层
因为颜色是可选的,没有就表示随层,你可以自己加进去,然后用entmod修改
我的修改颜色函数:
(defun setcolor(sname color / sinf)
         (setq sinf (entget sname))
         (if (assoc 62 sinf)
                         (setq sinf (subst (cons 62 color) (assoc 62 sinf) sinf))
                         (setq sinf (append sinf (list (cons 62 color))))
         )
         (entmod sinf)
)
回复

使用道具 举报

8

主题

22

帖子

3

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
54
发表于 2004-9-18 00:13:00 | 显示全部楼层
原来如此阿。多谢您了!!
回复

使用道具 举报

20

主题

872

帖子

10

银币

中流砥柱

Rank: 25

铜币
952
发表于 2004-9-18 01:38:00 | 显示全部楼层
  1. (defun putcol (e col)
  2.    (vla-put-color (vlax-ename->vla-object e) col)
  3. )
;; 测试: (putcol (car(entsel)) 4)
回复

使用道具 举报

7

主题

16

帖子

3

银币

初来乍到

Rank: 1

铜币
44
发表于 2004-10-3 19:37:00 | 显示全部楼层
我怎么想改变小数点后面的位数不行啦,那个2是什么意思 请各位大侠帮忙啦
回复

使用道具 举报

16

主题

909

帖子

8

银币

中流砥柱

Rank: 25

铜币
973
发表于 2004-10-3 23:22:00 | 显示全部楼层

rtos Function
Converts a number into a string
(rtos number [mode [precision]])
The rtos function returns a string that is the representation of number according to the settings of mode, precision, and the system variables UNITMODE, DIMZIN, LUNITS, and
LUPREC.
Arguments
number
A number.
mode
An integer specifying the linear units mode. The mode corresponds to the values allowed for the LUNITS AutoCAD system variable. The mode can be one of the following numbers:
1                Scientific
2                Decimal
3                Engineering (feet and decimal inches)
4                Architectural (feet and fractional inches)
5                Fractional
precision
An integer specifying the precision.
The mode and precision arguments correspond to the system variables LUNITS and LUPREC. If you omit the arguments, rtos uses the current settings of LUNITS and LUPREC.
Return Values
A string. The UNITMODE system variable affects the returned string when engineering, architectural, or fractional units are selected (mode values 3, 4, or 5).
回复

使用道具 举报

发表回复

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

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

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

GMT+8, 2025-8-20 10:02 , Processed in 0.322859 second(s), 69 queries .

© 2020-2025 乐筑天下

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