;; | ---------------------------------------------------------------------------- ;; | GE_SetNonZeroZ ;; | ---------------------------------------------------------------------------- ;; | Function : Sets all values in a list of points to a nearest non-zero value ;; | that occurs prior to the point in question. ;; | The only exception to this is if the first point itself happens ;; | to be at 0.0 elevation. Then the nearest forward non-zero ;; | elevation is sought. ;; | Author : Rakesh Rao, Bangalore - India ;; | Arguments: 'vlist' - List of points ;; | 'Floor' - Value below which is considered invalid. If nil, all ;; | values other than 0.0 are considered valid ;; | Updated : 9 December, 2002 ;; | e-mail : rakesh.rao@4d-technologies.com ;; | Web : www.4d-technologies.com ;; | ---------------------------------------------------------------------------- (defun GE_SetNonZeroZ ( vlist / len pt Z ZCur nlist ) (setq len (length vlist) ZCur nil nlist '() ) (foreach pt vlist (setq Z (caddr pt)) (if (not (zerop Z)) (setq ZCur Z) (progn (if ZCur (setq Z ZCur) (progn (setq ZCur (GE_GetNonZeroZ vlist)) (if (not ZCur) (progn (alert "Error in GE_SetNonZeroZ : No vertex has a non-zero elevation.") (exit) ) (setq Z ZCur) ) )) )) (setq pt (list (car pt) (cadr pt) Z) nlist (cons pt nlist) ) ) (reverse nlist) )