home *** CD-ROM | disk | FTP | other *** search
- ;Grid for whatever you want to use it for.
- ;
- ; ********Patrick J. McKee, author********
- ; ****Copyright 1992, Power Key tm****
- ;
- (setq oer *error* *error* err)
- (pre)
- (if(= grdx nil)(setq *grdx 24))
- (setq grdx(getreal(strcat"Horizontal grid size <"(rtos *grdx)">: ")))
- (if(= grdx nil)(setq grdx *grdx)(setq *grdx grdx))
- (if(= grdy nil)(setq *grdy 48))
- (setq grdy(getreal(strcat"Vertical grid size <"(rtos *grdy)">: ")))
- (if(= grdy nil)(setq grdy *grdy)(setq *grdy grdy))
- (setq p1(getpoint"Pick lower left: "))
- (setq p0(getpoint"Pick upper right: "))
- (setq c(distance p1 p0))
- (setq a1(angle p1 p0))
- (setq b(* c(sin a1)))
- (setq a(* c(cos a1)))
- (setq gx(-(fix(/ a grdx))1))
- (if(= gx 0)(setq gx(+ gx 1)))
- (setq d(/(- a(* gx grdx))2))
- (setq p2(list(+(car p1)d)(cadr p1)))
- (setq p3(list(car p2)(+(cadr p2)b)))
- (setq gy(-(fix(/ b grdy))1))
- (if(= gy 0)(setq gy(+ gy 1)))
- (setq yb(/(- b(* gy grdy))2))
- (setq p4(list(car p1)(+(cadr p1)yb)))
- (setq p5(list(+(car p4)a)(cadr p4)))
- (command "line" p2 p3 "")
- (command "array" "l" "" "r" "1"(+ gx 1)grdx)
- (command "line" p4 p5 "")
- (command "array" "l" "" "r"(+ gy 1)"1" grdy)
- (post)
- (princ)