Convert 3d pline to lwpoly

TCEBob

Usenet Archive
Joined
Jul 3, 2003
Messages
327
Reaction score
0
(Original question asked in autocad.2004 by Paul deBoer) Hi all, is it possible to convert a 3DPolyLine into a LwPline. I tried the command 'CONVERTPOLY' but this only works from LwPlines into 3DPolylines.

I'd like to know, too.

rs
 
I'm no expert but I would think, not possible 'directly ' since a 3d poly vertices can have zvalues which an lwpoly's can not.

you could read the x and y of the 3d poly's verts and use those to create an lw poly with an elev of some z...which would be like projecting the 3d onto a plane
 
Mark said:
I'm no expert but I would think, not possible 'directly ' since a 3d poly vertices can have zvalues which an lwpoly's can not.

you could read the x and y of the 3d poly's verts and use those to create an lw poly with an elev of some z...which would be like projecting the 3d onto a plane
Good answer. Thanks. Those of us who have LDD can convert with the Terrain menu. There must be utilities out there, too.

rs
 
Of course...
Cadlantic's M3D adds vertices around curves.
M2D provides a few options for setting the elevation; works on plain ol' lines too.
 
Not cute, but it seems to do the job.

;; Joe Burke 8/22/2003
;; convert 2D or 3D polylines to lwpolylines
;; code snips by Mark Middlebrook and Vladimir Livshiz

(defun c:Poly2LWPoly ( / *Error* ss pltyp i ename vrt elist crz)

(defun *Error* (Msg)
(cond
((or (not Msg)
(member Msg '("console break"
"Function cancelled"
"quit / exit abort"))))
((princ (strcat "\nError: " Msg)))
) ;cond
(setvar "plinetype" pltyp)
(setvar "cmdecho" 1)
(princ)
) ;end

;; change Z coordinate to 0 - by Mark Middlebrook
(defun zeroz (key zelist / oplist nplist)
(setq oplist (assoc key zelist)
nplist (reverse (append '(0.0) (cdr (reverse oplist)))) zelist (subst nplist oplist zelist) ) (entmod zelist)
) ;end

(setq pltyp (getvar "plinetype"))
(setvar "plinetype" 2)
(setvar "cmdecho" 0)

(if (not
(setq ss (ssget "I" (list (cons 0 "POLYLINE")))))
(progn
(princ "\nSelect polylines to convert: ")
(setq ss (ssget (list (cons 0 "POLYLINE"))))
)
) ;if

(if ss
(progn
(setq i 0)
(repeat (sslength ss)
(setq ename (ssname ss i))
(setq vrt ename)
(while (not (equal (cdr (assoc 0 (entget vrt))) "SEQEND")) (setq elist (entget (entnext vrt))) (setq crz (cadddr (assoc 10 elist))) (if (/= crz 0) (zeroz 10 elist) ) (setq vrt (cdr (assoc -1 elist))) ) (command "_explode" ename) (command "_pedit" "M" (ssget "P") "" "Y" "J" "0" "") (setq i (1+ i)) ) ) (princ "\nNo polylines selected ") ) ;if (*Error* nil) (princ)
) ;end
 

Latest threads

Back
Top