;; | ---------------------------------------------------------------------------- ;; | PL_mk_pl_feed ;; | ---------------------------------------------------------------------------- ;; | Function : Given a list, draw a POLYLINE or LWPOLYLINE using co-ordinates ;; | feeding to command line ;; | Arguments: ;; | 'vlist' - List of points from which to create polyline. This ;; | must be values in the current UCS ;; | '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_feed ( vlist flag Width / pt pt1 3dPoly OS hnd1 hnd2 ename Elev ) (setq OS (getvar "OSMODE")) (setvar "OSMODE" 0) (setq hnd1 (entlast)) (if hnd1 (setq hnd1 (LI_item 5 (entget hnd1))) ) (if (not (zerop (logand flag 8))) (setq Elev 0.0 Width 0.0 3dPoly T ) (setq Elev (caddr (nth 0 vlist)) 3dPoly nil )) (if (not 3dPoly) (progn (setq pt1 (car vlist) vlist (cdr vlist) ) (command "._Pline" pt1 "_Width" Width Width) (foreach pt vlist (command pt) ) (if (not (zerop (logand flag 1))) (command "_Close") (command "") ) ) (progn (command "._3dPoly") (foreach pt vlist (command pt) ) (if (not (zerop (logand flag 1))) (command "_Close") (command "") ) )) (setq hnd2 (entlast)) (if hnd2 (setq hnd2 (LI_item 5 (entget hnd2))) ) (setvar "OSMODE" OS) (if (and (not (equal hnd1 hnd2)) hnd2 ) (handent hnd2) nil ) ) ;; Enable picking a polyline entity from specified layers ;; The flag variable control various bit-coded features ;; 1 - Use nentsel instead of entsel ;; 2 - Do not exit loop until a valid entity is found (defun PL_plpick(msg la flag / ename entl en ent _ent More _la p1 p2 pp Vx vlist) (setq _ent nil More T ) (while More (if (not (zerop (logand flag 1))) (setq ent (nentsel msg)) (setq ent (entsel msg)) ) (if ent (progn (setq ename (car ent) pp (cadr ent) pp (osnap pp "_nea") entl (entget ename) en (LI_item 0 entl) ) (if (member en (list "POLYLINE" "LWPOLYLINE" "VERTEX")) (progn (setq _la (LI_item 8 entl)) (if (wcmatch _la la) (progn (if (= en "VERTEX") (setq p1 (LI_item 10 entl) p2 (LI_item 10 (entget (entnext ename))) ename (PL_SeekMain ename) vlist (PL_plist ename) Vx (GE_LocateVx pp vlist) _ent (list ename p1 p2 pp Vx vlist) ) (progn (setq vlist (PL_plist ename) Vx (GE_LocateVx pp vlist) ) (if Vx (setq _ent (list ename (nth (1- Vx) vlist) (nth Vx vlist) pp Vx vlist)) ) )) (setq More nil) ) (princ (strcat "\nPicked polyline is not on layer : " la)) ) ) (princ "\nPicked object is not a polyline.") ) ) (if (= flag 0) (setq More nil)) ) ) _ent )