试试这个,安迪,让我知道
- (defun c:Test (/ dtr ac ab p sl a b c d e p)
- ;; Author : Tharwat Al Shoufi ;;
- ;; Draw Trapezoid with angle 55 on the two sides ;;
- ;; -------------------------------------------------- ;;
- (defun dtr (a) (* pi (/ a 180.0)))
- (if (not *traplen*)
- (setq *traplen* 10.0)
- )
- (if (not *traphgt*)
- (setq *traphgt* 4.0)
- )
- (if (and (setq *traplen* (cond ((getdist (strcat "\n Specify Length of Trapezoid < " (rtos *traplen* 2 2) " > :")))
- (*traplen*)
- )
- )
- (setq *traphgt* (cond ((getdist (strcat "\n Specify Height of Trapezoid < " (rtos *traphgt* 2 2) " > :")))
- (*traphgt*)
- )
- )
- (setq ac (/ *traphgt* (sin (dtr 55.)))
- ab (* ac (cos (dtr 55.)))
- )
- (if (>= (setq sl (- *traplen* (+ ab ab))) 0.)
- (setq p (getpoint "\n Specify top center point of Trapezoid :"))
- (progn (alert "Length of Trapezoid is too small !!") nil)
- )
- )
- (progn (setq a (polar p pi (/ sl 2.))
- b (polar a (dtr 235.) ac)
- c (polar b 0. *traplen*)
- d (polar c (dtr 125.) ac)
- e (entmakex
- (append (list '(0 . "LWPOLYLINE") '(100 . "AcDbEntity") '(100 . "AcDbPolyline") '(90 . 4) '(70 . 1))
- (mapcar '(lambda (pt) (cons 10 (list (car pt) (cadr pt)))) (list a b c d))
- )
- )
- )
- )
- )
- (if e
- (command "_.rotate" e "" "_non" p "\")
- )
- (princ)
- )
|