View Full Version : combine 2 lisp into one
CISCO
2008-02-18, 11:40 PM
I created 2 different lisp routines to plot a full size sheet (see attached file). One is for a 24x36 (S) title block size and the other for a 30x42 (L). How can I merge both into one lisp, asking for only (S) or (L) and the window points? I would like for the (L) to be the default one by just hitting enter, if possible. Thanks in advance.
Adesu
2008-02-19, 01:40 AM
Hi CISCO,
Test this code, but I'm not sure thsi is would work,I not test.
(defun prints1 (opt pt1 pt2)
(command "-PLOT" "Y" "MODEL" "TDS600.PC3"
opt "INCHES" "LANDSCAPE" "NO" "WINDOW" PT1 PT2 "FIT" "CENTER"
"YES" "WDS.CTB" "YES" "AS DISPLAYED" "N" "N" "Y")
)
(defun prints2 (opt pt1 pt2)
(command "-PLOT" "Y" "MODEL" "TDS600-24X36.PC3"
opt "INCHES" "LANDSCAPE" "NO" "WINDOW" PT1 PT2
"FIT" "CENTER" "YES" "WDS.CTB" "YES"
"AS DISPLAYED" "N" "N" "Y")
)
(defun c:fw (/ pt1 pt2 opt)
(if
(and (setq pt1 (getpoint "\nEnter first point: "))
(setq pt2 (getcorner pt1 "\nEnter second point: ")))
(progn
(prompt "\nSelect 24x36(S) or 30x42 (L)")
(initget "S L")
(setq opt (getkword "\nSelect S or L: "))
(cond
((= opt "S")(setq opt "ARCH EXPAND E1 (30.00 X 42.00 INCHES)")
(prints1 opt pt1 pt2))
((= opt "L")(setq opt "ARCH EXPAND D (36.00 X 24.00 INCHES)")
(prints2 opt pt1 pt2))
) ; cond
) ; progn
(alert "\nInvalid select point, please try again")
) ; if
(princ)
) ; defun
I created 2 different lisp routines to plot a full size sheet (see attached file). One is for a 24x36 (S) title block size and the other for a 30x42 (L). How can I merge both into one lisp, asking for only (S) or (L) and the window points? I would like for the (L) to be the default one by just hitting enter, if possible. Thanks in advance.
irneb
2008-02-19, 06:35 AM
For the just hitting Enter part add this just in front of the (cond line:
(if (not opt) (setq opt "L"))
This way if the user presses enter, a nil is returned which is converted to "L" as a default value. If the user presses Escape the entire function would be cancelled, so you don't have to worry about the returned value in that case.
CISCO
2008-02-19, 04:03 PM
thanks...that worked. I just had to do some minor adjustments. The only problem was the info i gave was switched on your fw command lisp (the print1 should be the L info and the print2 should be the S) (see the final lisp attached). But once i fixed that it worked perfect. Thanks for your help.
Adesu
2008-02-20, 01:20 AM
You are welcome.
thanks...that worked. I just had to do some minor adjustments. The only problem was the info i gave was switched on your fw command lisp (the print1 should be the L info and the print2 should be the S) (see the final lisp attached). But once i fixed that it worked perfect. Thanks for your help.
vBulletin® v3.6.7, Copyright ©2000-2009, Jelsoft Enterprises Ltd.