;; | --------------------------------------------------------------------------- ;; | LI_RepListDXF ;; | --------------------------------------------------------------------------- ;; | Function : Replaces a member of a DXF entity list, at a specific counted ;; | position of the occurence of a code in the list ;; | Argument : 'Lst' - The DXF list (usually the result of an entget) ;; | 'Pos' - Postion in list at which the replacement is to be done ;; | (starts from 1) ;; | 'Code' - The DXF Code to search ;; | 'Val' - The new value of the list member ;; | Returns : The updated list, if successful else nil ;; | Update : December 26, 1998 ;; | e-mail : rakesh.rao@4d-technologies.com ;; | Web : www.4d-technologies.com ;; | --------------------------------------------------------------------------- (defun LI_RepListDXF ( Lst Pos Code Val / Lst1 More Idx cnt len Found Itm ) (setq cnt 0 Idx 1 len (length Lst) Lst1 '() Found nil ) (while (< cnt len) (setq itm (nth cnt Lst)) (if (= (car itm) Code) (progn (if (= Idx Pos) (setq Lst1 (cons Val Lst1) Found T ) (setq Lst1 (cons itm Lst1)) ) (setq Idx (1+ Idx)) ) (setq Lst1 (cons itm Lst1)) ) (setq cnt (1+ cnt)) ) (setq Lst1 (reverse Lst1)) (if Found Lst1 nil) )