Convert 3d pline to lwpoly

Discussion in 'AutoCAD' started by TCEBob, Aug 21, 2003.

  1. TCEBob

    TCEBob Guest

    (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
     
    TCEBob, Aug 21, 2003
    #1
  2. TCEBob

    Mark Propst Guest

    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 Propst, Aug 22, 2003
    #2
  3. TCEBob

    TCEBob Guest

    Good answer. Thanks. Those of us who have LDD can convert with the
    Terrain menu. There must be utilities out there, too.

    rs
     
    TCEBob, Aug 22, 2003
    #3
  4. TCEBob

    John Uhden Guest

    Of course...
    Cadlantic's M3D adds vertices around curves.
    M2D provides a few options for setting the elevation; works on plain ol' lines
    too.
     
    John Uhden, Aug 22, 2003
    #4
  5. TCEBob

    Joe Burke Guest

    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
     
    Joe Burke, Aug 22, 2003
    #5
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.