[Autolisp] keuzemenu

Pagina: 1
Acties:

  • Timrek
  • Registratie: Oktober 2001
  • Laatst online: 20-08 21:16

Timrek

Lid van de "Patatgeneratie"

Topicstarter
Ik ben bezig met een opdracht voor autocad. Ik moet een applicatie bouwen die toe te passen is in autocad. Ik programeer met notepad. Nu stuit ik op het prbleem dat ik in een *.lsp functie het niet voor elkaar krijg een soort volgmenu te schrijven.

Het probleem:

Ik heb in een *.lsp file 3 mogelijkheden, mogelijkheid "a", "b" en "c"
Nu moet ik dus door de invoer van 1,2 of 3 programmalijst "a", "b" of "c" kunnen aanspreken. Nu ben ik al zover gekomen dat ik onfeveer weet welke commando's ik moet gebruiken, namelijk COND. Commando IF is ook een optie hetzij dat deze alleen maar te gebruiken is bij 2 keuze mogelijkheden.

--------------------- --> Als "1" --> laad programmadeel "a"
| "1, 2, 3"----------| --> Als "2" --> laad programmadeel "b"
--------------------- --> Als "3" --> laad programmadeel "c"

Wie helpt mij?

[ Voor 13% gewijzigd door Timrek op 06-01-2003 15:11 ]


  • Timrek
  • Registratie: Oktober 2001
  • Laatst online: 20-08 21:16

Timrek

Lid van de "Patatgeneratie"

Topicstarter
Goed, gezien de reacties is mijn probleem niet helemaal duidelijk.
Dit is wat ik tot nu toe heb geschreven, maar om 1 of andere manier werkt het niet en ik heb geenb idee waar de fout zit.

Het bestand waarin get is opgeslagen is s1.lsp. Een opdracht in een*.mnu file verwijst naar dit bestand en de hierop volgende bestanden (s2, s3 en s4) om zo een proces door te lopen.
Common Lisp:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
------------------------------------------------------------------------------------
(defun S1 ()        
    (command "layer" "s" "0" "")                                
    (setq a
        (strcase (getint "\n Aantal pompen (1, 2 of 3):")
        );strcase
    );setq
    (cond
        ((= a "1") 
            (prompt "\nU heeft gekozen voor 1 pomp")    
            (command "osnap" "off")                     
            (command "insert" "a:/symbolen/05100000.dwg" "10,30" "1" "1" "0")   
            (command "line" "30,10" "50,10" "")                 
            (command "insert" "a:/symbolen/02100000.dwg" "50,10" "1" "1" "0")   
            (command "line" "70,10" "110,10" "")                    
            (command "line  "110,10" "110,-100" "")             
            (command "insert" "a:/symbolen/04130000.dwg" "90,-100" "1" "1" "0") 
            (command "insert" "a:/symbolen/03200000.dwg" "70,-100" "1" "1" "0") 
            (command "insert" "a:/symbolen/04130000.dwg" "50,-100" "1" "1" "0") 
            (command "osnap" "endp,int,midp")                   
            (command "zoom" "all")  
            )       
        ((= a "2") (prompt "\nU heeft gekozen voor twee pompen")
            (command "osnap" "off")                     
            (command "insert" "a:/symbolen/05100000.dwg" "10,30" "1" "1" "0")
            (command "line" "30,10" "50,10" "")
            (command "insert" "a:/symbolen/02100000.dwg" "50,10" "1" "1" "0")
            (command "line" "50,10" "110,10" "")
            (command "line  "110,10" "110,-100" "")
            (command "insert" "a:/symbolen/04130000.dwg" "90,-100" "1" "1" "0")
            (command "insert" "a:/symbolen/03200000.dwg" "70,-100" "1" "1" "0")
            (command "insert" "a:/symbolen/04130000.dwg" "50,-100" "1" "1" "0")
            (command "line" "30,10" "30,-10" "")
            (command "insert" "a:/symbolen/01125000.dwg" "30,-10" "1" "1" "0")
            (command "insert" "a:/symbolen/02100000.dwg" "50.-10" "1" "1" "0")
            (command "line" "70,-10" "110,-10" "")
            (command "osnap" "endp,int,midp")
            (command "zoom" "all")  
            )
        ((= a "3") (prompt "\nU heeft gekozen voor 3 pompen")
            (command "osnap" "off")                 
            (command "insert" "a:/symbolen/05100000.dwg" "10,30" "1" "1" "0")
            (command "line" "30,10" "50,10" "")
            (command "insert" "a:/symbolen/02100000.dwg" "50,10" "1" "1" "0")
            (command "line" "50,10" "110,10" "")
            (command "line  "110,10" "110,-100" "")
            (command "insert" "a:/symbolen/04130000.dwg" "90,-100" "1" "1" "0")
            (command "insert" "a:/symbolen/03200000.dwg" "70,-100" "1" "1" "0")
            (command "insert" "a:/symbolen/04130000.dwg" "50,-100" "1" "1" "0")
            (command "line" "30,10" "30,-10" "")
            (command "insert" "a:/symbolen/01125000.dwg" "30,-10" "1" "1" "0")
            (command "insert" "a:/symbolen/02100000.dwg" "50.-10" "1" "1" "0")
            (command "line" "70,-10" "110,-10" "")  
            (command "line" "30,-10" "30,-30" "")
            (command "insert" "a:/symbolen/01125000.dwg" "30,-30" "1" "1" "0")
            (command "insert" "a:/symbolen/02100000.dwg" "50,-30" "1" "1" "0")
            (command "insert" "a:/symbolen/01110000.dwg" "70,-30")
            (command "insert" "a:/symbolen/01125000.dwg" "90,-30")
            (command "osnap" "endp,int,midp")
            (command "zoom" "all")  
            )
        (T (prompt "\nKies ander getal"))
    );cond
   (princ)
);defun
(princ)

--------------------------------------------------------------------------------------

Is er toevallig iemand die mij kan vertellen hoe ik dit probleem kan oplossen? Het werkt namelijk niet en ik heb geen idee waar de fout zit :(

[ Voor 102% gewijzigd door Glimi op 06-01-2003 19:28 ]


  • Glimi
  • Registratie: Augustus 2000
  • Niet online

Glimi

Designer Drugs

(overleden)
Even wat opmerkingen over bepaalde regels hier, verder niet inhoudelijk over je probleem:

1 ) Kicken van topics alleen na 24 uur, binnen 3 uur is wat vroeg, we hebben wel meer te doen :P (sommige iig)
2 ) Wij verwachten dat je jezelf inzet! We gaan dus niet jouw problemen oplossen terwijl jij lekker op de bank zit voor je uit te kijken en een zak nibb-it naar binnen zit te werken oid. Doe moeite, laat zien wat je zelf geprobeerd hebt, wat er mis ging, wat je geraadpleegd hebt ed :) zie oa Welkom in P&W -> Quickstart (update 2/10/2002)

  • Timrek
  • Registratie: Oktober 2001
  • Laatst online: 20-08 21:16

Timrek

Lid van de "Patatgeneratie"

Topicstarter
Goed, na lang zoeken en een handige opmerking van iemand ben ik tot de oplossing gekomen. Hieronder staat het werkende programmeerwerk.

------------------------------------------------------------------------------------
(defun S1 ()
(initget 1 "1 2 3")
(setq vrg (getkword "Hoeveel pompen? 1, 2 of 3?")
)
(cond
((= vrg "1")
(progn
(prompt "\nU heeft gekozen voor 1 pomp")
(command "osnap" "off")
(command "insert" "a:/symbolen/05100000.dwg" "10,30" "1" "1" "0")
(command "line" "30,10" "50,10" "")
(command "insert" "a:/symbolen/02100000.dwg" "50,10" "1" "1" "0")
(command "line" "70,10" "110,10" "")
(command "line" "110,10" "110,-100" "")
(command "insert" "a:/symbolen/04130000.dwg" "90,-100" "1" "1" "0")
(command "insert" "a:/symbolen/03200000.dwg" "70,-100" "1" "1" "0")
(command "insert" "a:/symbolen/04130000.dwg" "50,-100" "1" "1" "0")
(command "osnap" "endp,int,midp")
(command "zoom" "all")
) ;progn
)
((= vrg "2")
(progn
(prompt "\nU heeft gekozen voor twee pompen")
(command "osnap" "off")
(command "insert" "a:/symbolen/05100000.dwg" "10,30" "1" "1" "0")
(command "line" "30,10" "50,10" "")
(command "insert" "a:/symbolen/02100000.dwg" "50,10" "1" "1" "0")
(command "line" "50,10" "110,10" "")
(command "line" "110,10" "110,-100" "")
(command "insert" "a:/symbolen/04130000.dwg" "90,-100" "1" "1" "0")
(command "insert" "a:/symbolen/03200000.dwg" "70,-100" "1" "1" "0")
(command "insert" "a:/symbolen/04130000.dwg" "50,-100" "1" "1" "0")
(command "line" "30,10" "30,-10" "")
(command "insert" "a:/symbolen/01125000.dwg" "30,-10" "1" "1" "0")
(command "insert" "a:/symbolen/02100000.dwg" "50,-10" "1" "1" "0")
(command "line" "70,-10" "110,-10" "")
(command "osnap" "endp,int,midp")
(command "zoom" "all")
) ;progn
)
((= vrg "3")
(progn
(prompt "\nU heeft gekozen voor twee pompen")
(command "osnap" "off")
(command "insert" "a:/symbolen/05100000.dwg" "10,30" "1" "1" "0")
(command "line" "30,10" "50,10" "")
(command "insert" "a:/symbolen/02100000.dwg" "50,10" "1" "1" "0")
(command "line" "50,10" "110,10" "")
(command "line" "110,10" "110,-100" "")
(command "insert" "a:/symbolen/04130000.dwg" "90,-100" "1" "1" "0")
(command "insert" "a:/symbolen/03200000.dwg" "70,-100" "1" "1" "0")
(command "insert" "a:/symbolen/04130000.dwg" "50,-100" "1" "1" "0")
(command "line" "30,10" "30,-10" "")
(command "insert" "a:/symbolen/01125000.dwg" "30,-10" "1" "1" "0")
(command "insert" "a:/symbolen/02100000.dwg" "50,-10" "1" "1" "0")
(command "line" "70,-10" "110,-10" "")
(command "osnap" "endp,int,midp")
(command "zoom" "all")
) ;progn
)
(T (prompt "\nKies ander getal,1 2 of 3"))
) ;cond
) ;defun
------------------------------------------------------------------------------------
Probleem is opgelost :D, dus gooi maar dicht.

[ Voor 36% gewijzigd door Timrek op 07-01-2003 15:38 ]