AutoLISP Code : 3Dpoint->2D point

;;; Function: 3dPoint->2dPoint ;
;;;--------------------------------------------------------------------;
;;; Description: This function takes one parameter representing a ;
;;; 3D point (a list of three integers or reals), and ;
;;; converts it into a 2D point (a list of two reals). ;
;;; There is no error checking done on the 3dpt ;
;;; parameter -- it is always expected to be a valid ;
;;; point. ;
;;;--------------------------------------------------------------------;
;;; Work to do: Add some kind of parameter checking so that this ;
;;; function won't crash a program if it is passed a ;
;;; null value, or some other kind of data type than a ;
;;; 3D point. ;
;;;--------------------------------------------------------------------;
(defun 3dPoint->2dPoint (3dpt)
(list (float (car 3dpt)) (float (cadr 3dpt)))
) ;_ end of defun

No comments:

Post a Comment