samifox 发表于 2022-7-5 15:34:18

从中检索顶点列表

你好
 
如何从多段线中检索顶点列表
使用任何vl load com函数?
 
我们非常欢迎您想到的所有方法!
 
谢谢
谢伊

vimcruz 发表于 2022-7-5 15:40:30


 
(defun VC:GetVertexList(edfx / vertex vertexList)
(foreach vertex edfx
        (if (or (= (car vertex) 10) (= (car vertex) 11))
                (setq vertexList (cons (cdr vertex) vertexList))
        )
)
(reverse vertexList)
)
 
这样使用:
 

(setq vertexList (VC:GetVertexList (entget (car (entsel)))))

Lee Mac 发表于 2022-7-5 15:41:51

另一个,对于LWDOLYLINE和POLYLINE:
;; Retrieve Polyline Vertices-Lee Mac
;; ent - Entity name of LWPolyline or Polyline

(defun polyverts ( ent / _lwpolyverts _polyverts )
   
   (defun _lwpolyverts ( enx / itm )
       (if (setq itm (assoc 10 enx))
         (cons (cdr itm) (_lwpolyverts (cdr (member itm enx))))
       )
   )
   (defun _polyverts ( ent / enx )
       (if (= "VERTEX" (cdr (assoc 0 (setq enx (entget ent)))))
         (cons (cdr (assoc 10 enx)) (_polyverts (entnext ent)))
       )
   )
   (if (= "LWPOLYLINE" (cdr (assoc 0 (entget ent))))
       (_lwpolyverts (entget ent))
       (_polyverts(entnext ent))
   )
)
使用多段线名称调用,例如:
(if (setq s (ssget "_+.:E:S" '((0 . "*POLYLINE"))))
   (polyverts (ssname s 0))
)

BIGAL 发表于 2022-7-5 15:45:46

为什么不使用vlisp方法,或者将其用于Mac?可以区分二维和三维pline。

samifox 发表于 2022-7-5 15:49:11

 
我认为,如果不使用vlisp,我会强迫自己更好地学习autolisp,一旦我对autolisp感到满意,我就会用vlisp奖励自己:)

Tharwat 发表于 2022-7-5 15:53:19

你在正确的轨道上。

samifox 发表于 2022-7-5 15:53:50

谢谢Tharwat

samifox 发表于 2022-7-5 15:59:09

 
为什么测试dxf 10或dxf 11?

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

他可能认为您也可以选择直线或LW多段线

samifox 发表于 2022-7-5 16:04:44

谢谢tharwat
页: [1] 2
查看完整版本: 从中检索顶点列表