handasa 发表于 2022-7-5 16:21:59

如何:从

大家好
 
我有一个叫做“pList”的点列表
我需要一个lisp,可以从这些点绘制多段线
然后检查该多段线是否与图形中的任何绿色多段线相交
 
如果它相交,则某些变量(如“Check”)在另一种情况下将为1或0
 
 
我们将感谢您的任何帮助。。。提前感谢

Tharwat 发表于 2022-7-5 16:33:20



(defun Polyline_ (lst)
(entmakex (append (list '(0 . "LWPOLYLINE") '(100 . "AcDbEntity") '(100 . "AcDbPolyline") (cons 90 (length lst)))
                   (mapcar (function (lambda (p) (cons 10 p))) lst)))
)


(if (setq pl (Polyline_ pList))
(if (and (setq ss (ssget "_F" pList '((0 . "LWPOLYLINE"))))
          (< 0 (setq no (1- (sslength ss))))
          )
   (alert (strcat "The newly created polyline is intersecting with <" (itoa no) "> Polyline(s) "))
   (alert "Couldn't find any polyline intersecting the newly created polyline !")
   )
)

handasa 发表于 2022-7-5 16:46:50

谢谢Tharwat先生。。。你又救了我一天。。。。非常感谢

Tharwat 发表于 2022-7-5 16:49:01

 
随时欢迎你。

handasa 发表于 2022-7-5 17:03:23

如何检查多段线(由点列表“plist”绘制)是否仅与绿色多段线(颜色3)相交
 
我试过了
(setq ss (ssget "_F" plist '((0 . "LWPOLYLINE") (62 . 3) )))
 
但它检测到一些绿色多段线,而忽略了其他多段线

Tharwat 发表于 2022-7-5 17:05:31

 
它们可能逐层为绿色,并且不会从颜色弹出列表中手动更改。
因此,如果是这种情况,则需要深入研究每个多段线的对象层。

handasa 发表于 2022-7-5 17:19:57

所有多段线均为绿色(3)
当我将未选择的绿线移动到另一个位置时,代码会选择它们。。。
我认为这是关于代码中的部分:
(setq ss (ssget "_F" plist '((0 . "LWPOLYLINE") (62 . 3) )))

BIGAL 发表于 2022-7-5 17:24:59

当你通过不使用(62.3)的ss时,你会发现“按层”的“Assoc 62”为零,没有返回(62.x),因此你需要像Tharwat所说的那样检查层颜色,并将其设置为颜色3。
页: [1]
查看完整版本: 如何:从