- ;坛子里找个简单代码,类似达到效果
- (defun c:tt ( / _line )
- (defun _line (lst)
- (mapcar '(lambda (a b)(entmakex (list '(0 . "LINE") (cons 10 a) (cons 11 b)))) lst (cdr lst))
- )
- (while (and (setq n (Cond ((getint(strcat "\n等分数["(itoa(setq n(Cond ( n )( 5 ))))"] ")))( n )))
- (setq p1 (getpoint "\n第一角点 :"))
- (setq p2 (getcorner p1 "\n另一角点 :"))
- )
- (setq dx (abs (- (car p2) (car p1)))
- dy (abs (- (cadr p2) (cadr p1)))
- )
- (setq ptm (list (min (car p1) (car p2)) (min (cadr p1) (cadr p2)))
- p2 (list (max (car p1) (car p2)) (max (cadr p1) (cadr p2)))
- p1 ptm
- )
- (if (> dx dy)
- (progn
- (setq dd (/ dx n))
- (repeat n
- (setq p3 (polar p1 0 dd)
- p4 (polar p1 (/ pi 2) dy)
- p5 (polar p4 0 dd)
- )
- (_LINE (list p1 p3 p4 p5 p1 p4))
- (setq p1 p3)
- )
- )
- (progn
- (setq dd (/ dy n))
- (repeat n
- (setq p3 (polar p1 (/ pi 2) dd)
- p4 (polar p1 0 dx)
- p5 (polar p3 0 dx)
- )
- (_LINE (list p1 p3 p4 p5 p1 p4))
- (setq p1 p3)
- )
- )
- )
- (_LINE (list p3 p5))
- )
- (princ)
- )
|