当然 提及哪些圆(层名称)不再位于端点上将“节省时间”。 是的,这是可能的,但我不知道它如何适合塔尔瓦的代码,
因为他的代码搜索满足特定需求的圆。并没有将所有圆都设置为一个变量。。
如果我回到我的代码,它可能看起来像这样:
(defun C:CadTutor ( / polyline polylinex polyliney allcircles n ensel enlist circlex circley)
(setq polyline (entget (car (entsel))))
(setq polylinex (car (cdr (assoc 10 (reverse polyline)))))
(setq polyliney (car (cddr (assoc 10 (reverse polyline)))))
(setq allcircles (ssget "_X" (list (cons 0 "CIRCLE"))))
(setq n (sslength allcircles))
(repeat n
(setq ensel (ssname allcircles (setq n (1- n))))
(setq enlist (entget ensel))
(setq circlex (car (cdr (assoc 10 enlist))))
(setq circley (car (cdr (cdr (assoc 10 enlist)))))
(if (and (= polylinex circlex)(= polyliney circley))
(progn
(princ "\nMatch found!")
(setq enlist (subst (cons 8 "MATCHLAYER") (assoc 8 enlist) enlist))
(entmod enlist)
(ssdel enlist allcircles)
)
(progn
(princ "\nNo match...")
)
)
)
(princ)
运行代码后,变量!allcircles将只包含所有“不匹配”的圆,您可以在代码的最后一部分使用它们。 我喜欢这样的想法,即如果圆对象的中心坐标等于LW多段线的端点,则该项将从列表中删除。这样,您将得到一个列表,其中仅包含不在任何LWD多段线端点上的圆。然而,您的示例是基于1条多段线,我有多条多段线和多个圆。
这是我的(部分)代码,它基于Tharwats最后一个示例代码。
这段代码有效:只要任何圆位于任何多段线的任何端点,并且当圆不在端点时终止(带有警报),就将图层名称写入列表。
我的想法是使用FOREACH部分(在半collons之后)在相等时从temp_列表(nfd)中删除圆。这样你就得到了一个不在端点上的圆列表。然后:如果temp\u list=0-->写入层名称,如果temp\u list>0-->通知不在端点上的圆层名称
但是最终的temp_列表将仅在while循环之后完成。我的技能不足以解决这个问题。。。
6
页:
1
[2]