hetauma 发表于 2022-7-5 23:04:09

选择符合以下条件的线或线:

嗨,我需要做一个Lisp程序,将做以下工作,需要一些指导我应该做什么。
 
我希望用户选择一条或多条直线或多段线。
然后lisp应该选择所有相交的线或样条线,直到3-4级(假设有一个包含许多分支的网格)。
然后向用户显示结果(可能还会添加更多分支并再次运行)
最后选择特定类型的所有相交块,显示块的数量,并对这些块的特定属性求和。
 
p、 例如,如果块与直线不相交,但在距离直线1m以内,是否可以为这些程序增加一些公差?

BIGAL 发表于 2022-7-6 00:06:24

选择对象时只需启动一个选项,即围栏“F”尝试移动F绘制接触对象的临时线。可以使用现有柱网的坐标将其用作围栏点。所以使用ssget,但使用“F”选项。看最后一行代码。
 

;An example with two pts
(setq ss (ssget "F" (list pt1 pt2))).

 

; pline co-ords example
; By Alan H
(defun getcoords (ent)
(vlax-safearray->list
   (vlax-variant-value
   (vlax-get-property
   (vlax-ename->vla-object ent)
   "Coordinates"
   )
   )
)
)

(defun co-ords2xy ()
; convert now to a list of xy as co-ords are x y x y x y if 3d x y z x y z
(setq len (length co-ords))
(setq numb (/ len 2)) ; even and odd check required
(setq I 0)
(repeat numb
(setq xy (list (nth i co-ords)(nth (+ I 1) co-ords) ))
; odd (setq xy (list (nth i co-ords)(nth (+ I 1) co-ords)(nth (+ I 2) co-ords) ))
(setq co-ordsxy (cons xy co-ordsxy))
(setq I (+ I 2))
)
)
; program starts here
(setq co-ords (getcoords (car (entsel "\nplease pick pline"))))
(co-ords2xy) ; list of 2d points making pline
; try this
(setq ss (ssget "F" co-ordsxy))
页: [1]
查看完整版本: 选择符合以下条件的线或线: