(defun c:ce ( / lst height) ;select points in COUNTERCLOCKWISE direction
(command "layer" "make" "ceiling" "")
(command "layer" "color" "white" "ceiling" "")
(command "layer" "set" "ceiling" "")
(setq height (getreal "enter height of ceiling: "))
(if (< height 0)
(setq height (get_dist)))
(setq lst (get_points))
(while (not (or (eq height nil) (eq lst nil)))
(cond ((eq (length lst) 2) (make_rect_face_cw (first lst) (second lst) height))
((eq (length lst) 3) (make_tri_face (first lst) (second lst) (third lst) height))
((eq (length lst) 4) (make_face (first lst) (second lst) (third lst) (fourth lst) height)))
(setq lst (get_points))))
;this part is solely for testing
(defun rect_face_cw_pts (p1 p2 height /)
(if (or (and (< (x p1) (x p2)) (< (y p1) (y p2)))
(and (> (x p1) (x p2)) (> (y p1) (y p2))))
(print (list
(list (x p1) (y p1) height)
(list (x p1) (y p2) height)
(list (x p2) (y p2) height)
(list (x p2) (y p1) height)))
(print (list
(list (x p1) (y p1) height)
(list (x p2) (y p1) height)
(list (x p2) (y p2) height)
(list (x p1) (y p2) height)))))