;; | -------------------------------------------------------------------------------------- ;; | PL_mk_pl ;; | -------------------------------------------------------------------------------------- ;; | Function : Given a list, draw a POLYLINE or LWPOLYLINE using the entmake function ;; | Arguments: ;; | 'vlist' - List of points from which to create polyline. ;; | 'flag' - POLYLINE or LWPOLYLINE flag (DXF Code 70) ;; | 'Width' - Width of the polyline. ;; | Action : Creates a POLYLINE or LWPOLYLINE from the list supplied with the specified ;; | flag and Width. ;; | If the flag has an '8' bit in it, a POLYLINE object is created else ;; | if the '8' bit is absent, a POLYLINE or LWPOLYLINE object is created ;; | depending on whether the PLINETYPE variable is 0 or 1 respectively. ;; | Updated : March 24, 1998 ;; | e-mail : rakesh.rao@4d-technologies.com ;; | Web : www.4d-technologies.com ;; | -------------------------------------------------------------------------------------- (defun PL_mk_pl(vlist flag Width / Elev VFlag pt entl LWPoly Lst len) (if (not (zerop (logand flag 8))) (setq Elev 0.0 Width 0.0 LWPoly nil ) (progn (if (member (getvar "PLINETYPE") (list 1 2)) (setq LWPoly T) (setq LWPoly nil) ) (setq Elev (caddr (nth 0 vlist))) )) (if LWPoly (progn (setq Lst '()) (foreach pt vlist (setq Lst (cons (list 10 (car pt) (cadr pt)) Lst) Lst (cons (cons 40 Width) Lst) Lst (cons (cons 41 Width) Lst) ) ) (setq len (length vlist) Lst (reverse Lst) Lst (cons (cons 38 Elev) Lst) Lst (cons (cons 70 flag) Lst) Lst (cons (cons 90 len) Lst) Lst (cons (cons 100 "AcDbPolyline") Lst) Lst (cons (cons 100 "AcDbEntity") Lst) Lst (cons (cons 0 "LWPOLYLINE") Lst) ) (entmake Lst) ) (progn (setq entl (list (cons 0 "POLYLINE") (cons 66 1) (list 10 0.0 0.0 Elev) (cons 40 Width) (cons 41 Width) (cons 70 flag) ) ) (entmake entl) (setq VFlag 0) (if (not (zerop (logand flag 8))) (setq VFlag (+ VFlag 32)) ) (if (not (zerop (logand flag 32))) (setq VFlag (+ VFlag 64)) ) (if (not (zerop (logand flag 64))) (setq VFlag (+ VFlag 128)) ) (foreach pt vlist (if (not (zerop (logand flag 8))) (setq Elev (caddr pt)) ) (setq entl (list (cons 0 "VERTEX") (list 10 (car pt) (cadr pt) (caddr pt)) (cons 70 VFlag) ) ) (entmake entl) ) (entmake (list (cons 0 "SEQEND"))) )) (entlast) )