Author Topic: Using Dialogue in lisp  (Read 1784 times)

0 Members and 1 Guest are viewing this topic.

lispman21

  • Guest
Using Dialogue in lisp
« on: December 04, 2006, 04:03:13 PM »
I have some code with user input that shows up at the command line. I would like to take the questions that are being asked and put them in a dialogue box that will pop up. After the information has been put into the dialogue box the info gets stored back to the variables i have designated and the program completes its run.

Code: [Select]
(defun dtr (a)
  (* pi (/ a 180.00))
)
(defun rtd (a)
  (/ (* a 180.00) pi)
)

(defun C:CV()
  (setq old_osnap (getvar "osmode"))
  (setvar "osmode" 0)
  (setq height (getreal "\nEnter Height of Unit Less base: "))
  (setq Leng (getreal "\nEnter Length of Unit: "))
  (setq width (getreal "\nEnter Width of Unit: "))
  (setq base (getreal "\nEnter Base Rail Height: "))

  ;; call out main program
  (blayout)
  (setvar "osmode" old_osnap)
)

(defun blayout ()
  (setq pnt1 (getpoint "\nSelect placement of lower left hand corner of AHU: "))
  (setq pnt2 (polar pnt1 (dtr 0)leng))
  (setq pnt3 (polar pnt2 (dtr 90)height))
  (setq pnt4 (polar pnt3 (dtr 180) leng))
  (setq pnt5 (polar pnt4 (dtr -90)height))
(command "line" pnt1 pnt2 pnt3 pnt4 pnt5 "")
 
;; Drawing base rail
 
  (setq pnt6 (polar pnt1 (dtr -90) Base))
  (setq pnt7 (polar pnt6 (dtr 0) leng))
  (setq pnt8 (polar pnt7 (dtr 90) base))

  (command "line" pnt1 pnt6 pnt7 pnt8"")
  (tlayout)
);; end of blayout

(defun tlayout ()
  ;; Drawing Top view

  (setq tpnt1 (polar pnt4 (dtr 90) 60))
  (setq tpnt2 (polar tpnt1 (dtr 0) leng))
  (setq tpnt3 (polar tpnt2 (dtr 90) width))
  (setq tpnt4 (polar tpnt3 (dtr 180) leng))
  (setq tpnt5 (polar tpnt4 (dtr -90) width))

  (command "line" tpnt1 tpnt2 tpnt3 tpnt4 tpnt5"")
  (toffset)
);; end of tlayout

(defun toffset ()

  ;; Drawing offset top

  (setq toffset1(list (+(car tpnt4)2) (- (cadr tpnt4) 2)))
  (setq toffset2(list (-(car tpnt3)2) (- (cadr tpnt3) 2)))
  (setq toffset3(list (-(car tpnt2)2) (+ (cadr tpnt2) 2)))
  (setq toffset4(list (+(car tpnt1)2) (+ (cadr tpnt1) 2)))

  (setq toffset5(list (+(car tpnt4)2) (cadr tpnt4)))
  (setq toffset6(list (-(car tpnt3)2) (cadr tpnt3)))
  (setq toffset7(list (-(car tpnt2)2) (cadr tpnt2)))
  (setq toffset8(list (+(car tpnt1)2) (cadr tpnt1)))

  (command "line" toffset8 toffset5"")(command "line" toffset7 toffset6"")
  (command "line" toffset1 toffset2"")(command "line" toffset3 toffset4"")
  (boffset)
);; end of toffset

(defun boffset ()
  ;; Drawing offset bottom

  (setq offset1(list (car pnt4) (- (cadr pnt4) 2.25)))
  (setq offset2(list (car pnt3) (- (cadr pnt3) 2.25)))
 
  (setq offset3(list (+(car pnt4) 2) (- (cadr pnt4) 2.25)))
  (setq offset4(list (- (car pnt3) 2) (-(cadr pnt3) 2.25)))
  (setq offset5(list (- (car pnt2) 2) (cadr pnt2)))
  (setq offset6(list (+(car pnt1) 2)  (cadr pnt1)))


  (command "line" offset1 offset2"")(command "line" offset6 offset3"")(command "line" offset5 offset4"")
(modules)
)
(defun modules ()
      (if (tblsearch "layer" "Construction")
       (command "-layer" "s" "Construction")
       (command "-layer" "m" "Construction" "c" "red" "Construction" "")
      );;end of if
  (while (< (car offset6) (car pnt2))
     (setq mod(getreal "\nEnter Module length"))
       (setq pnt2 (polar pnt2 (dtr 180)mod))
       (setq pnt3 (polar pnt3 (dtr 180)mod))
       (command "Xline" pnt2 pnt3 "")
      (setq ent1 (ssget "X" '((0 . "XLINE"))))
      (command "_.chprop" ent1 "" "la" "Construction" "")
  );; end of while
  (la)
)
(defun la()
  (command "clayer" "0" "")
)

Patrick_35

  • Guest
Re: Using Dialogue in lisp
« Reply #1 on: December 04, 2006, 04:23:17 PM »