XDSoft 发表于 2021-1-13 02:45:03

转换3DFACE到POLYLINE

Converting 3dface to a polyline

问题:

How do I convert 3dFaces to polylines ?

解答:

There's no mechanism available to do this directly. What you'll need to do is
collect the 3dFace vertex data, and create a polyline using that information.

Since a 3dFace will probably be construced with differing X,Y, and Z coordinates
you can only re-create them as a 3dPolyline. If the face's Z coordinates are on
the same elevation, you could re-create them as a 2d polyline. Here's some lisp
code to demonstrate this:


(defun C:3DFtoPL(/ ss1 sl i)
(setq ss1 (ssget "X" (list (cons '0 "3DFACE"))))
(setq sl (sslength ss1))
(setq i 0)
(while (< i sl)
   (setq ent1 (entget (setq e1 (ssname ss1 i))))
   (setq pt1 (cdr (assoc '10 ent1)))
   (setq pt2 (cdr (assoc '11 ent1)))
   (setq pt3 (cdr (assoc '12 ent1)))
   (setq pt4 (cdr (assoc '13 ent1)))
   ;Plain 2D Polylines
   ;(command "PLINE" pt1 pt2 pt3)
   ; 3dPolylines ->
   (command "3DPOLY" pt1 pt2 pt3)
   (if (/= pt3 pt4) (command pt4 "c") (command "c") )
   (entdel e1)
   (setq i (1+ i))
)
(setq ss1 nil)
(princ)
)

(princ "\nC:3DFtoPL loaded, to run type 3DFtoPL.")
(princ)


dwg001 发表于 2022-9-30 09:00:36

very    good!   thanks。

ilovem 发表于 2023-4-24 10:16:37

谢谢楼主的分享

nore 发表于 2023-6-9 14:28:29

原来只能再画一条线啊,不能直接转换,挺奇怪
页: [1]
查看完整版本: 转换3DFACE到POLYLINE