BIGAL Posted May 23, 2015 Share Posted May 23, 2015 (edited) So many times I see multiple questions in a lisp and thought that a nice dcl would be better but writing DCL and interface LSP is time consuming, so I am trying to combine the two basicly by just loading a seperate lisp and a couple lines of code you can have from 1 line input to as many as DCL supports. Anyway its so close so I have posted here the code it auto makes the dcl and the required lsp to run it. I just have a bit of a writers block and its so close. So to anyone out there appreciate a look. ;; writes a multiline input dcl file from generic input ;; By BIG AL May 2015 (defun AH:write-items (keynum title / ) (write-line ": edit_box {" f1) (write-line (strcat " key = " (chr 34) Keynum (chr 34) ";") f1) (write-line (strcat " label = " (chr 34) title (chr 34) ";" ) f1) ; these can be replaced with shorter value etc (write-line " edit_width = 18;" f1) (write-line " edit_limit = 15;" f1) (write-line " is_enabled = true;" f1) (write-line " }" f1) (if (= AHnum nil)(setq AHnum 0)) (write-line (strcat "(action_tile " (chr 34) keynum (chr 34) " " (chr 34) "(setq item" (rtos (setq AHnum (+ AHnum 1)) 2 0) " $value)" (chr 34) ")" ) f2) ) ; this defun writes the first few lines of the lsp and dcl files (defun AH:openfiles () (setq f1 (open "C://acadtemp//getval.dcl" "w")) (setq f2 (open "C://acadtemp//getvals2.lsp" "w")) ; dcl (write-line "ddgetval : dialog {" f1) (write-line (strcat "label = " (chr 34) "Enter values" (chr 34) ";") f1) (write-line ": column {" f1) ;lsp (write-line (strcat "(setq dcl_id (load_dialog " (chr 34) "c:\\acadtemp\\getval" (chr 34) "))" ) f2) (write-line (strcat "(if (not (new_dialog " (chr 34) "ddgetval" (chr 34) " dcl_id))" ) f2) (write-line "(exit))" f2) ) ; defun ; closes files ;dcl (defun AH:closefiles () (write-line "spacer_1 ;" f1) (write-line "ok_cancel;}" f1) (write-line "}" f1) (close f1) ;lsp (write-line "(START_DIALOG)" f2) (write-line "(done_dialog)" f2) (close f2) (setq num nil) ) ; this is test code which would be added to a seperate routine asking 4 questions (AH:openfiles) (AH:write-items "key1" "Title1") ; (setq ans1 key1) (AH:write-items "key2" "Title2") ; (setq var1 key2) (AH:write-items "key3" "Title3") ; (setq var2 key3) (AH:write-items "key4" "Title4") ; (setq xx key4) (AH:closefiles) ;(load "C:\\acadtemp\\getvals2") ; it should return 4 values item1 item2 item3 item4 ;(alert (strcat item1 "\n" item2 \n item3 \n item4)) ; just a test line Edited May 25, 2015 by BIGAL Quote Link to comment Share on other sites More sharing options...
BIGAL Posted May 25, 2015 Author Share Posted May 25, 2015 Code updated above The end result a DCl with as few or as many lines as required rather than writing or editing multiple dcl's Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.