干得好:
- (defun C:test ( / p1 p2 off n a d f p )
- (and
- (cond
- ( (and *MtpLines* (setq p1 (getpoint "\nSpecify base point <new line>: ")))
- (mapcar '(lambda (x) (set x (cdr (assoc x *MtpLines*)))) '(d a))
- (setq p2 (polar p1 (- a (* 0.5 PI)) d))
- )
- (
- (and
- (setq p1 (getpoint "\nSpecify line's length: "))
- (setq p2 (getpoint "\nSpecify line's length: " p1))
- )
- )
- ); cond
- (not (grdraw p1 p2 1 1))
-
- (setq off (cond ( (progn (initget 6) (getdist (strcat "\nSpecify offset " (if (setq off (cdr (assoc 'off *MtpLines*))) (strcat "<" (rtos off 2 15) ">") "") ": "))) ) ( off )))
- (setq n (cond ( (progn (initget 6) (getint (strcat "\nSpecify number of lines " (if (setq n (cdr (assoc 'n *MtpLines*))) (strcat "<" (itoa n) ">") "") ": "))) ) ( n )))
-
- (or a (setq a (+ (angle p1 p2) (* 0.5 PI))))
- (or d (setq d (distance p1 p2)))
- (setq f '((p a d) (entmakex (list '(0 . "LINE") (cons 10 p) (cons 11 (polar p a d))))))
- (setq p p1)
- (progn
- (redraw)
- (repeat n
- (f p (angle p1 p2) d)
- (setq p (polar p a off))
- )
- (
- '(( / ed pt1 pt2 dst )
- (setq ed 6.)
- (setq pt1 (polar p1 a (- ed)))
- (setq pt2 (polar p2 a (- ed)))
- (setq dst (+ (- (distance p1 p) off) (* 2. ed)))
- (f (polar pt1 (angle p1 p2) ed) a dst )
- (f (polar pt2 (angle p1 p2) (- ed)) a dst )
- )
- )
- (setq *MtpLines* (mapcar '(lambda (x) (cons x (eval x))) '(d a off n)))
- ); progn
- ); and
- (princ)
- ); defun
|