gisanalyst 发表于 2022-7-5 17:25:58

列出多多边形顶点的步骤

你好
 
有没有命令列出多边形的顶点?
因为,当我有一个多边形时,我可以使用(entget(car(entsel))并恢复其顶点。但我怎么能在一个多角度中做到这一点呢?
 
谢谢
 
#Autocad Civil 3D 2015。

Hippe013 发表于 2022-7-5 17:44:48

mpolygon(dxf代码10)的顶点似乎是与原点(dxf代码11)相关的三角形。
您可以使用entget来获取实体数据。然后使用assoc检索顶点增量(dxf代码10)和原点(dxf代码11)。
 
我希望这会有所帮助。

gisanalyst 发表于 2022-7-5 17:57:17

 
是的,我明白了。。。
 
Tks 4帮助。

BIGAL 发表于 2022-7-5 18:14:56

快速搜索表明,多多边形实际上是pline,因此使用支持属性坐标的VL可以非常容易地获取顶点,因此您可以一步检索所有顶点。这方面有一些变化。李有一个很好的。
 

; 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)) ; this is a list of the vertices
(setq I (+ I 2))
)
)
; program starts here
(setq co-ords (getcoords (car (entsel "\nplease pick pline"))))
(co-ords2xy) ; list of 2d points making pline

gisanalyst 发表于 2022-7-5 18:27:31

哇,我会分析的。。。
 
我的剧本有将近100行;(
页: [1]
查看完整版本: 列出多多边形顶点的步骤