看你这个比较简单,练手顺手写了个糙的,可以实现你需要的功能,有币的话就给我吧,缺币中...
- (defun c:tt (/ d xnum ynum pt0 x0 y0 m n x1 y1 x2 y2 pt3 x3 y3 x4 y4)
- (setq d (getreal "请输入网格间距")
- xnum (getint "请输入列数\n")
- ynum (getint "请输入行数\n")
- pt0 (getpoint "请选取左下角点\n")
- x0 (car pt0)
- y0 (cadr pt0)
- m (* xnum 5)
- n (* ynum 5)
- x1 (+ x0 (* d m))
- y1 (+ y0 (* d n))
- x2 (+ x0 d)
- y2 (+ y0 d)
- )
- (entmake (list '(0 . "LINE") '(62 . 2) (append '(10) pt0) (list 11 x0 y1 0)))
- (entmake (list '(0 . "LINE") '(62 . 2) (append '(10) pt0) (list 11 x1 y0 0)))
- (repeat m
- (if (/= 0 (rem (- x2 x0) (* 5 d)))
- (entmake
- (list '(0 . "LINE")
- '(62 . 8)
- '(6 . "DASH")
- (list 10 x2 y0 0)
- (list 11 x2 y1 0)
- )
- )
- (entmake (list '(0 . "LINE") '(62 . 2) (list 10 x2 y0 0) (list 11 x2 y1 0)))
- )
- (setq x2 (+ d x2))
- )
- (repeat n
- (if (/= 0 (rem (- y2 y0) (* 5 d)))
- (entmake
- (list '(0 . "LINE")
- '(62 . 8)
- '(6 . "DASH")
- (list 10 x0 y2 0)
- (list 11 x1 y2 0)
- )
- )
- (entmake (list '(0 . "LINE") '(62 . 2) (list 10 x0 y2 0) (list 11 x1 y2 0)))
- )
- (setq y2 (+ d y2))
- )
- (setq pt3 (getpoint "请选择原点\n")
- x3 (car pt3)
- y3 (cadr pt3)
- x4 x0
- y4 y0
- )
- (repeat (1+ xnum)
- (entmake
- (list '(0 . "TEXT")
- '(10 0.0 0.0 0.0)
- (cons 40 d)
- (cons 1 (rtos (* 5 (/ (- x4 x3) d))))
- '(71 . 0)
- '(72 . 4)
- (list 11 x4 (- y0 d) 0.0)
- )
- )
- (setq x4 (+ x4 (* 5 d)))
- )
- (repeat (1+ ynum)
- (entmake
- (list '(0 . "TEXT")
- '(10 0.0 0.0 0.0)
- (cons 40 d)
- (cons 1 (rtos (* 5 (/ (- y4 y3) d))))
- '(71 . 0)
- '(72 . 4)
- (list 11 (- x0 d) y4 0.0)
- )
- )
- (setq y4 (+ y4 (* 5 d)))
- )
- (entmake (list '(0 . "LINE") '(62 . 3) (list 10 x3 y0 0) (list 11 x3 y1 0)))
- (entmake (list '(0 . "LINE") '(62 . 3) (list 10 x0 y3 0) (list 11 x1 y3 0)))
- (princ)
- )
|