;; | ---------------------------------------------------------------------------- ;; | PL_GetWidths ;; | ---------------------------------------------------------------------------- ;; | Function : Returns a list of all starting and ending widths of segments in ;; | polyline ;; | Arguments: ;; | 'ename' - Entity name of the polyline ;; | Action : Returns a nested list containing the start and end widths of each ;; | segment in the polyline. ;; | Updated : May 21, 2003 ;; | Comments : Handles both POLYLINE as well as LWPOLYLINE objects. ;; | e-mail : rakesh.rao@4d-technologies.com ;; | Web : www.4d-technologies.com ;; | ---------------------------------------------------------------------------- (defun PL_GetWidths ( ename / cnt entl en VxLst L40 L41 Lst Lst1 Lst2 _Lst Closed itm1 itm2 ) (setq Closed (not (PL_Open? ename)) entl (entget ename) en (LI_item 0 entl) Lst nil ) (cond ((= en "POLYLINE") (setq VxLst (cdr (PL_GetVxEntl ename)) L40 (mapcar '(lambda (x) (cdr (assoc 40 x))) VxLst) L41 (mapcar '(lambda (x) (cdr (assoc 41 x))) VxLst) Lst (list L40 L41) ) ) ((= en "LWPOLYLINE") (setq L40 (LI_mitem 40 entl) L41 (LI_mitem 41 entl) Lst (list L40 L41) ) ) ) (setq Lst1 (reverse (cdr (reverse (nth 0 Lst)))) Lst2 (reverse (cdr (reverse (nth 1 Lst)))) _Lst '() cnt 0 ) (foreach itm1 Lst1 (setq itm2 (nth cnt Lst2) cnt (1+ cnt) _Lst (cons (list itm1 itm2) _Lst) ) ) (if Closed (setq _Lst (cons (list (last Lst2) (last Lst2) ) _Lst ) ) ) (setq _Lst (reverse _Lst)) )