hanhphuc 发表于 2022-7-5 23:03:51

我也是,学习是无尽的快乐编码

MSasu 发表于 2022-7-5 23:06:10

为了说明我的建议,请找一个带有注释的示例:
(if (setq ssetPLine (ssget "_:S:E" '((0 . "LWPOLYLINE"))))          ;ask user to select a polyline
(progn
(setq listPLine   (entget (ssname ssetPLine 0))                   ;retrive entity's list
       listCorners '())
(while (setq listPLine (member (assoc 10 listPLine) listPLine))   ;cycle until all vertexes (corners) were found
(setq listCorners (cons (cdar listPLine)                         ;and retain them in a list
                        listCorners)
      listPLine   (cdr listPLine))                               ;skip first entry to allow locating next vertex
)

(print (inters (nth 0 listCorners) (nth 2 listCorners)            ;get intersection of diagonals
                (nth 1 listCorners) (nth 3 listCorners)))
)
)
请注意,以上仅适用于矩形;稍后您需要添加SSGET筛选器(请检查Tharwat的代码)或选择后验证。

Rain0923 发表于 2022-7-5 23:12:28

这对我来说太棒了,谢谢你的解释:D
 

MSasu 发表于 2022-7-5 23:18:33

不客气,Rain0923!祝你学习顺利。
页: 1 [2]
查看完整版本: 如何获得矩形中心——Re