(defun c:hvlines ( / *error* g1 g2 gr h l ms p p1 p2 v )
;; Lee Mac 2011
(defun *error* ( m ) (redraw) (princ))
(or *n (setq *n 3))

(if (setq p1 (getpoint “\nSpecify First Corner: “))
(progn
(setq ms (princ “\nSpecify Opposite Corner [TAB/+/-]: “))
(while
(progn (setq gr (grread t 15 0) g1 (car gr) g2 (cadr gr))
(cond
( (= 5 g1)(redraw)
(if *v
(progn
(setq h (/ (- (car g2) (car p1)) (1+ *n))
v (- (cadr g2) (cadr p1))
p p1
)
(repeat *n
(setq p (list (+ h (car p)) (cadr p) (caddr p)))
(grdraw p (list (car p) (+ v (cadr p)) (caddr p)) -1)
)
(setq l
(list
p1 (list (car p1) (+ v (cadr p1)) (caddr p1))
g2 (list (+ h (car p)) (cadr p) (caddr p))
)
)
)
(progn
(setq h (- (car g2) (car p1))
v (/ (- (cadr g2) (cadr p1)) (1+ *n))
p p1
)
(repeat *n
(setq p (list (car p) (+ v (cadr p)) (caddr p)))
(grdraw p (list (+ (car p) h) (cadr p) (caddr p)) -1)
)
(setq l
(list
p1 (list (+ (car p1) h) (cadr p1) (caddr p1))
g2 (list (car p) (+ v (cadr p)) (caddr p))
)
)
)
)
(mapcar ‘(lambda ( a b ) (grdraw a b 1 -1)) l (append (cdr l) (list (car l))))
)
( (= 2 g1)
(cond
( (member g2 ‘(45 95))
(if (= 1 *n)
(princ (strcat “\n–> Minimum Number of Lines Reached.” ms))
(setq *n (1- *n))
)
)
( (member g2 ‘(43 61))
(setq *n (1+ *n))
)
( (= 9 g2)
(setq *v (not *v)) t
)
)
)
( (= 3 g1)
(if *v
(progn
(setq h (/ (- (car g2) (car p1)) (1+ *n))
v (- (cadr g2) (cadr p1))
)
(repeat *n (setq p1 (list (+ h (car p1)) (cadr p1) (caddr p1)))
(entmakex
(list
(cons 0 “LINE”)
(cons 10 (trans p1 1 0))
(cons 11 (trans (list (car p1) (+ v (cadr p1)) (caddr p1)) 1 0))
)
)
)
)
(progn
(setq h (- (car g2) (car p1))
v (/ (- (cadr g2) (cadr p1)) (1+ *n))
)
(repeat *n (setq p1 (list (car p1) (+ v (cadr p1)) (caddr p1)))
(entmakex
(list
(cons 0 “LINE”)
(cons 10 (trans p1 1 0))
(cons 11 (trans (list (+ (car p1) h) (cadr p1) (caddr p1)) 1 0))
)
)
)
)
)
nil
)
)
)
)
)
)
(redraw) (princ)
)

(defun c:TAB ()
(SetVar “cmdecho” 0)
(setq *ERROR* STOP)
(setq p1 (getpoint “\nFIRST CORNER: “))
(setq p3 (getcorner p1 “\nSECOND CORNER: “))
(setq p2 (list (car p1) (cadr p3)))
(setq p4 (list (car p3) (cadr p1)))
(command “PLINE” p1 “W” 0 0 p2 p3 p4 “C”)
(while (> (getvar “CmdActive”) 0)
(command pause)
)
(setvar “autosnap” 39)
(setvar “osmode” 1)
(c:hvlines)
(command “-hatch” “w” “n” p1 p2 p3 p4 “c” “” “p” “s” “co” “t” “255,255,255” “” )
(command “draworder” “l” “” “b” )

(SetVar “cmdecho” 1)
)
(c:tab)
;

Advertisements