marko_ribar 发表于 2022-7-5 17:37:32

在这里,试试我未经测试的版本。。。
 

(defun c:line-pt ( / ss i li p1 p2 k m li1 li2 ip pl )
(while (not ss)
   (setq ss (ssget '((0 . "LINE"))))
)
(repeat (setq i (sslength ss))
   (setq li (ssname ss (setq i (1- i))))
   (setq p1 (cdr (assoc 10 (entget li))))
   (setq p2 (cdr (assoc 11 (entget li))))
   (if (not (vl-member-if '(lambda ( x ) (equal x p1 1e-10)) pl))
   (setq pl (cons p1 pl))
   )
   (if (not (vl-member-if '(lambda ( x ) (equal x p2 1e-10)) pl))
   (setq pl (cons p2 pl))
   )
)
(setq i (sslength ss) k -1)
(while (< (setq k (1+ k)) i)
   (setq m k)
   (setq li1 (ssname ss k))
   (while (< (setq m (1+ m)) i)
   (setq li2 (ssname ss m))
   (if (setq ip (inters (cdr (assoc 10 (entget li1))) (cdr (assoc 11 (entget li1))) (cdr (assoc 10 (entget li2))) (cdr (assoc 11 (entget li2)))))
       (if (not (vl-member-if '(lambda ( x ) (equal x ip 1e-10)) pl))
         (setq pl (cons ip pl))
       )
   )
   )
)
(foreach p pl
   (entmake (list '(0 . "POINT") (cons 10 p)))
)
(princ)
)

structo 发表于 2022-7-5 17:40:16

Grr看看这个,确保放大月球着陆器脚垫。
太阳能。图纸

Grrr 发表于 2022-7-5 17:43:33

 
比加尔,
以下是我在对该dwg上的所有内容进行最大化后得到的值:

这是我能做的最大可能的放大:

当然,luprec变量会影响这些数字(luprec的有效整数是从0到8),所以这就是为什么在逗号后显示8位数字的原因”
 
 
大卫,
你提供的信息真的很有用,谢谢!
我用你的例子做了一些测试:
<p>Command: (equal 0.666666 (/ 2. 3.))</p><p>nil</p><p> </p><p>Command: (equal 0.666666 (/ 2. 3.) 1e-4)</p><p>T</p><p></p><p> </p><p>So by using a tolerance factor, we can force comparisons to workable values.</p><p> </p><p>HTH-David</p>
我不确定除法(/2-3)后是否有变量来增加/减少精度活动然而,我在我使用的ACAD2015上发现了最小的比较限制:
_$ (/ 2 3.)
0.666667
_$ (equal 0.666667 (/ 2 3.))
nil
_$ (equal 0.666667 (/ 2 3.) 1e-5)
T
_$ (equal 0.666667 (/ 2 3.) 1e-6)
T
_$ (equal 0.666667 (/ 2 3.) 1e-7)
nil
我做的进一步测试可能显示了局限性:
_$ (equal 0.6666666666666667 (/ 2 3.) 1e-16)
nil
_$ (equal 0.666666666666667 (/ 2 3.) 1e-15)
T
_$

structo 发表于 2022-7-5 17:46:34

marko_ribar 发表于 2022-7-5 17:49:23

 
Put little larger number in every appearance of number 1e-10... So try with 1e-8, or 1e-6...

structo 发表于 2022-7-5 17:54:02

 
MARKO,
 
Yes, it is working.
 
Thanks.

David Bethel 发表于 2022-7-5 17:55:56

 
 
The same as with Marko's - Adjust the tolerance value

David Bethel 发表于 2022-7-5 18:00:51

 
The smallest on the release I use is 1e-14
 
The is a largest limit, but I down't remember it
 
Google significant numbersfor a better under standing
 
computers store real numbers with whole numbers having having president.
 
With a 15 digit significant limit
10.   stores a max of 14 decimals
1000.stores a max of 12 decimals
 
This really comes into play when comparing values
 
(/ 2. 3.) always store the last decimal as 7
 
Command: (equal 0.666666 (/ 2. 3.))
nil
 
Command: (equal 0.666666 (/ 2. 3.) 1e-4)
T

 
So by using a tolerance factor, we can force comparisons to workable values.
 
HTH-David

BIGAL 发表于 2022-7-5 18:02:44

Grr have a look at this make sure you zoom in on lunar lander foot pad.
SOLAR.DWG

Grrr 发表于 2022-7-5 18:06:10

 
BIGAL,
These are the values I got after zoom extents on everything on that dwg:

And this is the maximum possible zoom-in I could do:

Ofcourse the luprec variable affects these numbers (valid integers for luprec are from 0 to 8 ), so thats why are shown 8 digits after the comma "."
 
 
David,
The info you provided is really helpful, thanks!
I did some tests with your example:

_$ (/ 2 3.)0.666667_$ (equal 0.666667 (/ 2 3.))nil_$ (equal 0.666667 (/ 2 3.) 1e-5)T_$ (equal 0.666667 (/ 2 3.) 1e-6)T_$ (equal 0.666667 (/ 2 3.) 1e-7)nil
I am not sure if there is a variable to increase/decrease the precision, after the division (/ 2 3.) operation. However I've found the smallest comparsion limit on ACAD2015 which I use:

_$ (equal 0.6666666666666667 (/ 2 3.) 1e-16)nil_$ (equal 0.666666666666667 (/ 2 3.) 1e-15)T_$
And the further tests I did, perhaps show the limits:

; comparsion limit:_$(= (* 1 1e+100) (* 1 1e+101))nil_$(= (* 1 1e+1000) (* 1 1e+1001))T; maximum/minimum number limit:_$ (* 1 1e+100)1.0e+100_$ (* 1 1e+1000)1.#INF_$ (* 1 1e-100)1.0e-100_$ (* 1 1e-1000)0.0
页: 1 [2]
查看完整版本: 在交点处插入点