I have been going at this code for over a week trying to get this to work...
I have a pretty big LISP file with individual routines defined within it to assist my coworkers in their drafting process. I realized as this routine is expected to grow and it would take a bit for my coworkers to memorize all of the commands, I made a quick DCL with a handful of image slides to make it easier for them. This is where I'm stuck though..
I want the original DCL to close before opening the next programs DCL, anything I've tried has given me all types of error codes, or has been able to run but the original DCL was stuck on the screen. Below is my code and a snip of the first DCL.
(defun c:BNS()
; code here works as normal
)
(defun c:ULT (/ Dcl_Id% what_next cnt)
(vl-load-com)
(setq Slides@ (list nil "BNS" "BTOOLS" "LYRFRZ" "VPLU" "WIP" "WIP" "CMD7" "CMD8" "CMD9") ;; NAME OF THE .SLD FILE
Slide1$ (nth 1 Slides@)
Slide2$ (nth 2 Slides@)
Slide3$ (nth 3 Slides@)
Slide4$ (nth 4 Slides@)
Slide5$ (nth 5 Slides@)
Slide6$ (nth 6 Slides@)
Folder$ (strcat "Z:/" "5. Documents/Programs/Autodesk/Auto & Visual LISP/Programs/AutoLISP Ultimate/AutoULT Slides/")
Return$ "")
(setq *commands_to_execute* '((c:ULT) (c:BTOOLS) (c:LYRFRZ)))
(setq Dcl_Id% (load_dialog "AutoLISP Ultimate.dcl"))
(setq what_next 2)
(while (>= what_next 2)
(if (null (new_dialog "autoULT" Dcl_Id%))
(exit)
)
(set_tile "Title" "AutoLISP Ultimate")
(start_image "Slide1")(setq X# (- (dimx_tile "Slide1") 2))
(setq Y# (- (dimy_tile "Slide1") 2))(end_image)
(start_image "Slide1")(slide_image -12 -3 175 Y# (strcat Folder$ Slide1$))(end_image) ; -X= << || -Y= ^^
(start_image "Slide2")(slide_image 0 -6 X# Y# (strcat Folder$ Slide2$))(end_image)
(start_image "Slide3")(slide_image 0 -7 X# Y# (strcat Folder$ Slide3$))(end_image)
(start_image "Slide4")(slide_image -2 -6 X# Y# (strcat Folder$ Slide4$))(end_image)
(start_image "Slide5")(slide_image -2 -6 X# Y# (strcat Folder$ Slide5$))(end_image)
(start_image "Slide6")(slide_image -2 -6 X# Y# (strcat Folder$ Slide6$))(end_image)
(action_tile "Slide1" "(setq Return$ Slide1$) (c:BNS) (done_dialog 4)")
(action_tile "Slide2" "(setq *command_index* 1)(setq *commands_requested* t)")
(action_tile "Slide3" "(progn (done_dialog 4)(setq Return$ (strcat \"c:\" Slide3$)))")
(action_tile "Slide4" "(progn (done_dialog 4)(setq Return$ (strcat \"c:\" Slide4$)))")
(action_tile "accept"
"(setq *commands_requested* nil)
(done_dialog 1)
(if (setq idx *command_index*)
(progn
(mapcar '(lambda (cmd) (if (= idx (car cmd)) (eval (cadr cmd)))) *commands_to_execute*)
(setq *command_index* nil)
)
)"
)
; (action_tile "accept" "(done_dialog 1) (princ \"OK button clicked\")")
(setq what_next (start_dialog))
(cond
((= what_next 4)
(done_dialog 4)
)
((= what_next 0)
(prompt "\nuser cancelled dialog")
)
)
)
(unload_dialog Dcl_Id%)
(if (= what_next 4)
(progn
(setq Return$ Slide1$)
(c:BNS))
)
(princ)
)
Solved! Go to Solution.
Solved by Sea-Haven. Go to Solution.
Solved by paullimapa. Go to Solution.
Assuming the following is what you want:
1. click on the slide image
2. the dialog to close
3. then run (c:BNS)
And you don't need to return to the original dialog after (c:BNS) finishes, then there's no need for this while loop:
(while (>= what_next 2)
Your action call back code needs to just have done_dialog and the # in this case 4:
(action_tile "Slide1" "(setq Return$ Slide1$)(done_dialog 4)")
This instructs the dialog to close. Then you can have your cond statement check what was the return # and run the code there:
(cond
((= what_next 4)
(c:BNS)
)
Which means you don't need this last section of the code:
(if (= what_next 4)
(progn
(setq Return$ Slide1$)
(c:BNS))
)
FYI, you don't need progn in your action call back code unless you have an if statement first. Since you don't in your case then you can just leave the progn out like this:
(action_tile "Slide3" "(done_dialog 4)(setq Return$ (strcat \"c:\" Slide3$))")
(action_tile "Slide4" "(done_dialog 4)(setq Return$ (strcat \"c:\" Slide4$))")
You can make library dcl's say a 3x2 DCl that are loaded, you only need a list of slide names, the slides are populated using a loop reading the list, the tile selected is again read out of a function then action taken.
You can also do Child dcl's so select master bolts then sub child dcl is opened for more options.
Pop menus may be even easier to use
Will have a look at your code may be simplified. In a single big piece of code I have there are 14 calls to individual DCl's, sounds like your heading that way. See child image above.
Your welcome to use these. May save you a lot of dcl making time.
Paul, thank you so much! I cannot thank you enough for the help you've been!
How would I get this program to run a conditional for every slide? There are 6 total. Would I just be able to make done_dialog 4-10?
Scot-65
A gift of extraordinary Common Sense does not require an Acronym Suffix to be added to my given name.
This is what I would do:
1. Just drop the $ character & make a list of those slides like this:
(setq Slides@ (list nil "BNS" "BTOOLS" "LYRFRZ" "VPLU" "WIP" "WIP" "CMD7" "CMD8" "CMD9") ;; NAME OF THE .SLD FILE
Slide1 (nth 1 Slides@)
Slide2 (nth 2 Slides@)
Slide3 (nth 3 Slides@)
Slide4 (nth 4 Slides@)
Slide5 (nth 5 Slides@)
Slide6 (nth 6 Slides@)
Folder (strcat "Z:/" "5. Documents/Programs/Autodesk/Auto & Visual LISP/Programs/AutoLISP Ultimate/AutoULT Slides/")
Return ""
Slidelst (list "Slide1" "Slide2" "Slide3" "Slide4" "Slide5" "Slide6")
)
Then all you need is a single action call back statement using the tile key to equate to Return$ like this:
(foreach tile Slidelst
(action_tile tile "(setq Return$ $key)(done_dialog 4)")
)
Then your cond statement for 4 looks like this and works for all 6 slides:
(cond
((= what_next 4)
(c:BNS)
)
((= what_next 0)
(prompt "\nuser cancelled dialog")
)
)
This is because you already have the Return$ value set previously in the call back statement:
(setq Return$ $key)
Now this assumes your c:BNS lisp function checks to see what the Return$ is (Slide1 through Slide6) and then runs something different for each.
How do I look into these Pop Menus? I am really interested but cannot find any resources on them.. are they .Mnu files?
Yes they are mnu files. You use menuload to load them, you make them with say Notepad NOT Word.
Here is an example.
***MENUGROUP=TRAFFIC
***POP19
**2016TRAFFIC
[TRAFFIC]
[Num carparks]^C^C(load "how many carparks") carpark
[Carpark 0]^C^C(load "simple carpark") npark90
[Carpark 30]^C^C(load "simple carpark") npark30
[Carpark 45]^C^C^p(load "simple carpark") npark45
[Carpark 60]^C^C(load "simple carpark") npark60
[Carpark 90]^C^C(load "simple carpark") npark90
There is 100+ functions here
You can do custom toolbars as well
If you get stuck PM me.
i am a noob on lisp, will you plz explan how can i add quick selection criteria in each radio button for multi quick select help needed
It may be best to start a new topic not sure what you mean. In new topic explain more image etc what it is you want. Show dcl.
Can't find what you're looking for? Ask the community or share your knowledge.