XDSoft 发表于 2021-1-16 00:56:49

关于LISP TRANS函数不接受坐标大于1.0E+99的问题

问题:

Problem with LISP (trans) function not accepting coordinates larger/greater than 1.0E+99

解答:

In Visual LISP, you will get an error if you use the TRANS function with a large input value - For example, type the following LISP expression at the command prompt:

(trans (0.0 0.0 3.0e+099) 0 1)

To solve this issue, best thing is to use the ActiveX TranslateCoordinates() method of the Utility class.

The following code shows how the TranslateCoordinates() method is successful for an input point of (0.0 0.0 3e+99), where…

(trans (0.0 0.0 3e+099) 0 1)

…would fail.

(defun c:Test()
(vl-load-com)
(setq poActDoc (vla-get-ActiveDocument (vlax-get-acad-object)))
(setq poUtility(vla-get-Utility poActDoc))
(setq poTestPoint (vlax-3d-point '(0.0 0.0 3e+99)))
(setq poRetPoint(vla-TranslateCoordinates poUtility poTestPoint acUCS acWORLD 0))
(princ (vlax-safearray->list (vlax-variant-value poRetPoint)))
(princ)
)


MUYIY 发表于 2022-6-20 23:46:50

学习学习{:1_1:}
页: [1]
查看完整版本: 关于LISP TRANS函数不接受坐标大于1.0E+99的问题