明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 2523|回复: 7

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

[复制链接]
发表于 2004-9-14 00:36:00 | 显示全部楼层 |阅读模式
我在用getpoint         inters命令获取点的坐标时,


发现精度往往只有到小数点后面第二位,不是四舍五入,而是直接取两位,或者三位。


因为本人工作需要严格精确到小数点后面3位,一般精确到第四位。


这个问题我该怎么解决?


                                         我发现id,list命令的回应中,关于坐标的精度是随cad里的设置而取舍的。


如果我不能通过getpoint等方法获得坐标。我如何可以通过id命令(如果可以)获得坐标。


本人面对2000多个桩点,已经束手无策了。请老大们帮我。
发表于 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"
 楼主| 发表于 2004-9-15 01:29:00 | 显示全部楼层
帅哥你真cool!


我用论坛里前辈的方法已经能够实现。也是用的rots函数,将其转化成为字符串就好了。


您知道怎么将文字改变颜色吗?entget 显示的信息没有文字颜色的项目。


请帅哥教教我吧。
发表于 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)
)
 楼主| 发表于 2004-9-18 00:13:00 | 显示全部楼层
原来如此阿。多谢您了!!
发表于 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)
发表于 2004-10-3 19:37:00 | 显示全部楼层
我怎么想改变小数点后面的位数不行啦,那个2是什么意思 请各位大侠帮忙啦
发表于 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).

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

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2025-2-23 03:28 , Processed in 0.172852 second(s), 26 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表