getstring function

Rank: 1

OldForumPost

Newbie

posts: 0

Registered: 2012-1-14

Message 1 of 1

15-12-2008 12:45 . pm | View his/her posts only
I'm trying to write a error handler for my lisp-routines, but I come across a problem with the getstring function. I've written a error handler and it works fine if I enter no string al the getstring function. In the error handler I've created a undo startpoint and a undo endpoint. When I enter a string the error hander doesn't seem to work right. When I end the lisp routine at the normal way, and then give the undo command it doesn't undo the whole lisp.

Can anybody help mee out?

because I get an error while uploading the file I'll post it here:

(Prompt "'nlisp voor specificeren van daken, versie ZWcad_1.0
copyright: L.J. Schutten, gemaakt d.d. 15-12-08'n")

(defun dak1 ()
(princ "'nType dakplaat?")(terpri)
(princ "1 - 35R/1035 8 - 101R/800")(terpri)
(princ "2 - 40R/915 9 - 106R/750")(terpri)
(princ "3 - 50R/1000 10 - 110R/1000")(terpri)
(princ "4 - 70R/800 11 - 135R/930")(terpri)
(princ "5 - 85R/1120 12 - 153R/840")(terpri)
(princ "6 - 89R/915 13 - 158R/750")(terpri)
(princ "7 - 100R/825 14 - 200R/750")(terpri)
(princ "15 - een ander type")(terpri)
)

(defun dak2 ()
(setq antw (getstring "'nMaak uw keuze <9 - 106R/750 = standaard>:"))
(if (= antw "")
(setq antw "9")
)
(cond ((= antw "1") (setq dp "35R/1035"))
((= antw "2") (setq dp "40R/915"))
((= antw "3") (setq dp "50R/1000"))
((= antw "4") (setq dp "70R/800"))
((= antw "5") (setq dp "85R/1120"))
((= antw "6") (setq dp "89R/915"))
((= antw "7") (setq dp "100R/825"))
((= antw "8") (setq dp "101R/800"))
((= antw "9") (setq dp "106R/750"))
((= antw "10") (setq dp "110R/1000"))
((= antw "11") (setq dp "135R/930"))
((= antw "12") (setq dp "153R/840"))
((= antw "13") (setq dp "158R/750"))
((= antw "14") (setq dp "200R/750"))
((= antw "15")
(setq dp (getstring "Welke ander type? "))
)
)
)

(defun dikte1 ()
(princ "'ndikte materiaal")(terpri)
(princ "1 - 0,50 mm")(terpri)
(princ "2 - 0,63 mm")(terpri)
(princ "3 - 0,70 mm")(terpri)
(princ "4 - 0,75 mm")(terpri)
(princ "5 - 0,88 mm")(terpri)
(princ "6 - 1,0 mm")(terpri)
(princ "7 - 1,5 mm")(terpri)
(princ "8 - 2,0 mm")(terpri)
(princ "9 - een andere dikte")
(terpri)
)

(defun dikte2 ()
(setq antw (getstring "'nMaak uw keuze <4 - 0,75 mm = standaard>:"))
(if (= antw "")
(setq antw "4")
)
(cond ((= antw "1") (setq d "0,50"))
((= antw "2") (setq d "0,63"))
((= antw "3") (setq d "0,70"))
((= antw "4") (setq d "0,75"))
((= antw "5") (setq d "0,88"))
((= antw "6") (setq d "1,0"))
((= antw "7") (setq d "1,5"))
((= antw "8") (setq d "2,0"))
((= antw "9")
(setq d (getstring "Welke andere dikte? "))
)
)
)

(defun coating1 ()
(princ "'nWelke coating?")(terpri)
(princ "1 - pvf-2")(terpri)
(princ "2 - plastisol HP")(terpri)
(princ "3 - plastisol HPS")(terpri)
(princ "4 - sil. pol.")(terpri)
(princ "5 - int. coat.")(terpri)
(princ "6 - sv")(terpri)
(princ "7 - sv (B)")(terpri)
(princ "8 - een andere coating")(terpri)
)

(defun coating2 ()
(setq antw (getstring "'nMaak uw keuze <1 - pvf-2 = standaard>:"))
(if (= antw "")
(setq antw "1")
)
(cond ((= antw "1") (setq c "pvf-2"))
((= antw "2") (setq c "plastisol HP"))
((= antw "3") (setq c "plastisol HPS"))
((= antw "4") (setq c "sil. pol."))
((= antw "5") (setq c "int. coat."))
((= antw "6") (setq c "sv"))
((= antw "7") (setq c "sv(B)"))
((= antw "8")
(setq c (getstring "Welke andere coating? "))
)
)
)

(defun dakiso1 ()
(princ "'nWelke soort dakisolatie?")(terpri)
(princ "1 - EPS100")(terpri)
(princ "2 - Steenwol")(terpri)
(princ "3 - Een andere soort ")(terpri)
)

(defun dakiso2 ()
(setq antw (getstring "'nMaak uw keuze <1 - EPS-100 = standaard>:"))
(if (= antw "")
(setq antw "1")
)
(cond ((= antw "1") (setq di "EPS-100"))
((= antw "2") (setq di "Steenwol"))
((= antw "3")
(setq di (getstring "Welke andere soort? "))
)
)
)

(defun isodikte1 ()
(princ "'ndikte dakisolatie?")(terpri)
(princ "1 - 80 mm")(terpri)
(princ "2 - 90 mm")(terpri)
(princ "3 - 100 mm")(terpri)
(princ "4 - 110 mm")(terpri)
(princ "5 - 120 mm")(terpri)
(princ "6 - een andere dikte")(terpri)
)

(defun isodikte2 ()
(setq antw (getstring "'nMaak uw keuze <3 - 100 mm = standaard>:"))
(if (= antw "")
(setq antw "3")
)
(cond ((= antw "1") (setq id "80"))
((= antw "2") (setq id "90"))
((= antw "3") (setq id "100"))
((= antw "4") (setq id "110"))
((= antw "5") (setq id "120"))
((= antw "6")
(setq id (getstring "Welke andere dikte? "))
)
)
)

(defun dakbed1 ()
(princ "/nsoort Dakbedekking?")(terpri)
(princ "1 - 1 laags PVC (alkorplan)")(terpri)
(princ "2 - 2 laags bitumineus")(terpri)
(princ "3 - een andere soort (1 laags)")(terpri)
)

(defun dakbed2 ()
(setq
antw (getstring "'nMaak uw keuze <1 - 1 laags PVC = standaard>:"
)
)
(if (= antw "")
(setq antw "1")
)
(cond ((= antw "1")
(setq db1 "1-laags PVC (alkorplan)")
(setq db2 "dikte: 1,2 mm")
(setq db3 "kleur: standaard grijs")
(setq dbt "")
(setq dbo "")
)
((= antw "2")
(setq db1 "2-laags bitumineus")
(setq db2 "toplaag")
(setq dbt (getstring "'nWelke toplaag? "))
(setq db3 "onderlaag")
(setq dbo (getstring "'nWelke onderlaag? "))
)
((= antw "3")
(setq db1 (getstring "'nWelk type? "))
(setq db2 "dikte:")
(setq dbt (getstring "'nWelke dikte? "))
(setq db3 "kleur:")
(setq dbo (getstring "'nWelke kleur? ")))
)
)

(defun EGerr (msg / )
(graphscr)
(princ (strcat "'nUser [Esc], " (strcase msg T ) " ! " ) )
(setvar "OSMODE" os )
(setvar "clayer" lay )
(setvar "cmdecho" ce1)
(setvar "attdia" att1)
(command "dim" "restore" dims "exit")
(command "._UNDO" "End" )
(setq *error* olderr )
(princ)
)

(defun c:leaderdakspec (/ antw dp d c di id db1 db2 db3 dbt dbo olderr dims os lay ce1 att1 kz kleur1 kleur2 p1 p2 p3 p4 p5 p6 p7 p8 p9 p10 p11 p12)
(setq dims (getvar "dimstyle"))
(setq olderr *error* )
(setq *error* EGerr )
(setq os (getvar "osmode"))
(setq lay (getvar "clayer"))
(setq ce1 (getvar "cmdecho"))
(setq att1 (getvar "attdia"))
(command "_.UNDO" "BEgin")
(setvar "cmdecho" 0)
(command "dim" "restore" "EG groot" "exit")
(command "layer" "s" "TEKST" "")
(textpage)
(princ "'nAlleen de dakplaat (1) of het Complete dakpakket (2)")(terpri)
(setq kz (getstring "'nMaak uw keuze:"))
(progn
(if (= kz "1")
(progn
(dak1)
(dak2)
(dikte1)
(dikte2)
(coating1)
(coating2)
(setq kleur1 (getstring t"'nWelke kleur?"))
(setvar "osmode" 512)
(setvar "orthomode" 1)
(graphscr)
(setq p1 (getpoint "'nGeef startpunt op:"))
(setq p2 (getpoint p1 "'nGeef tussenpunt op:"))
(setq p3 (getpoint p2 "'nGeef eindpunt op:"))
(command "qleader"
""
p1
p2
p3
(strcat "Dakplaten:")
(strcat "type: " dp)
(strcat "dikte: " d " mm")
(strcat "coating: " c " " kleur1)
""
""
)
(setvar "osmode" os)
(setvar "clayer" lay)
(command "dim" "restore" dims "exit")
(setvar "cmdecho" ce1)
(setvar "attdia" att1)
(command "_.UNDO" "End")
(setq *error* olderr )
(progn
(princ)
)
)
(if (= kz "2")
(progn
(dak1)
(dak2)
(dikte1)
(dikte2)
(coating1)
(coating2)
(setq kleur2 (getstring t"'nWelke kleur?"))
(setvar "osmode" 512)
(setvar "orthomode" 1)
(graphscr)
(setq p4 (getpoint "'nGeef startpunt op:"))
(setq p5 (getpoint p4 "'nGeef tussenpunt op:"))
(setq p6 (getpoint p5 "'nGeef eindpunt op:"))
(command "qleader"
""
p4
p5
p6
(strcat "Dakplaten:")
(strcat "type: " dp)
(strcat "dikte: " d " mm")
(strcat "coating: " c " " kleur2)
""
""
)
(setvar "osmode" 33)
(textpage)
(dakiso1)
(dakiso2)
(isodikte1)
(isodikte2)
(graphscr)
(setq p7 (getpoint "'nGeef startpunt op:"))
(setq p8 (getpoint p7 "'nGeef tussenpunt op:"))
(setq p9 (getpoint p8 "'nGeef eindpunt op:"))
(command "qleader"
p7
p8
p9
(strcat "Dakisolatie:")
(strcat "type: " di)
(strcat "dikte: " id " mm")
""
""
)
(textpage)
(dakbed1)
(dakbed2)
(graphscr)
(setq p10 (getpoint "'nGeef startpunt op:"))
(setq p11 (getpoint p10 "'nGeef tussenpunt op:"))
(setq p12 (getpoint p11 "'nGeef eindpunt op:"))
(command "qleader"
p10
p11
p12
(strcat "Dakbedekking:")
(strcat "type: " db1)
(strcat db2 " " dbt)
(strcat db3 " " dbo)
""
""
)
(setvar "osmode" os)
(setvar "clayer" lay)
(command "dim" "restore" dims "exit")
(setvar "cmdecho" ce1)
(setvar "attdia" att1)
(command "_.UNDO" "End")
(setq *error* olderr )
(progn
(princ)
)
)
)
)
)
)


See also