Jump to content

1 line 2 line 3line dcl auto generator plus more if required


BIGAL

Recommended Posts

So many times you see a lisp ask question after question enter L, enter W, enter H.

 

So why not a dcl that can be simply called from 1 line in a lisp maybe even 5 or 6 entries. Fully customise on the fly Title description and charcter box size. This is for using as a library function across any lisp. Slowly I am changing our lisps, much better to use a dcl no up and down the screen entries.

 

Anyway here is getval1 2 & 3 just load it and call it with 1 line the sample call is included in the code below. It returns Val1 val2 val3 etc as strings for your use, just save the code as "Getvals.lsp"

 

Getvals.jpg

 

; this is a 3 line example of code 
(defun c:test ()
(if (not AH:getval3)(load "getvals"))
(ah:getval3 "Enter Length" 8 7 "Enter width"  6 5 "Enter height" 6 5)
(setq pt (Getpoint "\nPick lower left corner"))
(command "rectang" PT "D" (atof Val1) (atof Val2) pt)
(command "extrude" "L" "" (atof val3))
(command "Vpoint" (list 1 1 1 ))
)

 

; Input  Dialog box with variable title
; By Ah June 2015
; credit to Alan J Thompson for original idea
;code just use these next two lines
; (if (not AH:getval1)(load "getvals"))
; (ah:getval1 "title" width limit)  ;

; 1 line dcl
; sample code (ah:getval1 "line 1" 5 4)
(defun AH:getval1 (title width limit / fo)
(setq fname (strcat (getvar "SAVEFILEPATH") "\\getval1.dcl")) ; choose 1 of these file locations
;(setq fname (strcat (getenv "TEMP") "\\getval1.dcl")) ; temp directory defined in support paths
;(setq fname "C:\\acdatemp\\getval1.dcl") ; a existing directory you use
(setq fo (open fname "w"))
(write-line "ddgetval : dialog {" fo)
(write-line " : row {" fo)
(write-line ": edit_box {" fo)
(write-line (strcat "    key = "  (chr 34) "key1" (chr 34) ";") fo)
(write-line  (strcat " label = "  (chr 34) title (chr 34) ";"  )   fo)
; these can be replaced with shorter value etc
(write-line (strcat "     edit_width = " (rtos width 2 0) ";" ) fo)
(write-line (strcat "     edit_limit = " (rtos limit 2 0) ";" ) fo)
(write-line "   is_enabled = true;" fo)
(write-line "    }" fo)
(write-line "  }" fo)
(write-line "ok_only;}" fo)
(close fo)

(setq dcl_id (load_dialog  fname))
;(setq dcl_id (load_dialog  "c:\\acadtemp\\getval1"))
(if (not (new_dialog "ddgetval" dcl_id))
(exit))
(action_tile "key1" "(setq val1 $value)")
(mode_tile "key1" 3)
(start_dialog)
(done_dialog)
(unload_dialog dcl_id)
; returns the value of val1 as a string
(alert val1)
)


; 2 line dcl
; sample code (ah:getval2 "line 1" 5 4 "line2" 8 7)

(defun AH:getval2 (title1 width1 limit1 title2 width2 limit2 / fo)
(setq fname (strcat (getvar "SAVEFILEPATH") "\\getval2.dcl"))
; choose 1 of these file locations
;(setq fname (strcat (getenv "TEMP") "\\getval2.dcl")) ; temp directory defined in support paths
;(setq fname "C:\\acdatemp\\getval2.dcl") ; a existing directory you use
(setq fo (open fname "w"))
(write-line "ddgetval2 : dialog {" fo)
(write-line " : column {" fo)
(write-line ": edit_box {" fo)
(write-line (strcat "    key = " (chr 34) "key1" (chr 34) ";") fo)
(write-line  (strcat " label = "  (chr 34) title1 (chr 34) ";" ) fo)
(write-line (strcat "     edit_width = " (rtos width1 2 0) ";" ) fo)
(write-line (strcat "     edit_limit = " (rtos limit1 2 0) ";" ) fo)
(write-line "   is_enabled = true ;" fo)
(write-line "    }" fo)
(write-line "spacer_1 ;" fo)
(write-line ": edit_box {" fo)
(write-line (strcat "    key = " (chr 34) "key2" (chr 34) ";") fo)
(write-line (strcat " label = "  (chr 34) title2 (chr 34) ";"  ) fo)
(write-line (strcat "     edit_width = " (rtos width2 2 0) ";" ) fo)
(write-line (strcat "     edit_limit = " (rtos limit2 2 0) ";" ) fo)
(write-line "   is_enabled = true ;" fo)
(write-line "    }" fo)
(write-line "    }" fo)
(write-line "spacer_1 ;" fo)
(write-line "ok_only;}" fo)
(close fo)

; code part
(setq dcl_id (load_dialog  fname))
(if (not (new_dialog "ddgetval2" dcl_id))
(exit))
(mode_tile "key1" 3)
(action_tile "key1" "(setq val1 $value)")
(mode_tile "key2" 3)
(action_tile "key2" "(setq val2 $value)")

(start_dialog)
(done_dialog)
(unload_dialog dcl_id)
; returns the value of val1 and val2 as strings
(alert (strcat val1 "\n" val2))  ; remove this line in finished code
)

; 3 line dcl
; sample code (ah:getval3 "line 1" 5 4 "line2" 8 7 "line3" 6 4)

(defun AH:getval3 (title1 width1 limit1 title2 width2 limit2 title3 width3 limit3 / fo)
(setq fname (strcat (getvar "SAVEFILEPATH") "\\getval3.dcl")) ; choose 1 of these file locations
;(setq fname (strcat (getenv "TEMP") "\\getval3.dcl")) ; temp directory defined in support paths
;(setq fname "C:\\acdatemp\\getval3.dcl") ; a existing directory you use
(setq fo (open fname "w"))
(write-line "ddgetval3 : dialog {" fo)
(write-line " : column {" fo)
(write-line ": edit_box {" fo)
(write-line (strcat "    key = " (chr 34) "key1" (chr 34) ";") fo)
(write-line  (strcat " label = "  (chr 34) title1 (chr 34) ";" ) fo)
(write-line (strcat "     edit_width = " (rtos width1 2 0) ";" ) fo)
(write-line (strcat "     edit_limit = " (rtos limit1 2 0) ";" ) fo)
(write-line "   is_enabled = true ;" fo)
(write-line "    }" fo)
(write-line "spacer_1 ;" fo)
(write-line ": edit_box {" fo)
(write-line (strcat "    key = " (chr 34) "key2" (chr 34) ";") fo)
(write-line (strcat " label = "  (chr 34) title2 (chr 34) ";"  ) fo)
(write-line (strcat "     edit_width = " (rtos width2 2 0) ";" ) fo)
(write-line (strcat "     edit_limit = " (rtos limit2 2 0) ";" ) fo)
(write-line "   is_enabled = true ;" fo)
(write-line "    }" fo)
(write-line "spacer_1 ;" fo)
(write-line ": edit_box {" fo)
(write-line (strcat "    key = " (chr 34) "key3" (chr 34) ";") fo)
(write-line (strcat " label = "  (chr 34) title3 (chr 34) ";"  ) fo)
(write-line (strcat "     edit_width = " (rtos width3 2 0) ";" ) fo)
(write-line (strcat "     edit_limit = " (rtos limit3 2 0) ";" ) fo)
(write-line "   is_enabled = true ;" fo)
(write-line "    }" fo)
(write-line "    }" fo)
(write-line "spacer_1 ;" fo)
(write-line "ok_only;}" fo)

(close fo)

; code part
(setq dcl_id (load_dialog  fname))
(if (not (new_dialog "ddgetval3" dcl_id))
(exit))
(mode_tile "key1" 3)
(action_tile "key1" "(setq val1 $value)")
(mode_tile "key2" 3)
(action_tile "key2" "(setq val2 $value)")
(mode_tile "key3" 3)
(action_tile "key3" "(setq val3 $value)")
(start_dialog)
(done_dialog)
(unload_dialog dcl_id)
; returns the value of val1 and val2 val3 as strings
(alert (strcat val1 "\n" val2 "\n" val3))  ; remove this line in finished code
)

Edited by BIGAL
screwy character removed from 1st line.
Link to comment
Share on other sites

  • Replies 20
  • Created
  • Last Reply

Top Posters In This Topic

  • BIGAL

    9

  • tombu

    6

  • David Bethel

    3

  • AIberto

    1

Top Posters In This Topic

Posted Images

Nice! I've only added dcl to a few routines and none lisp generated. I don't have a "c:\\acadtemp" folder gonna try (getvar "SAVEFILEPATH")

Link to comment
Share on other sites

It's basically 3 examples in one file - AH:getval1, AH:getval2, & AH:getval3 for 1, 2, or 3 inputs allowing you to set the size of the dialog box with the call. After using one of the example calls like

(ah:getval3 "Enter Length" 8 7 "Enter width"  6 5 "Enter height" 6 5)

open the dcl file from the temp folder to check it out.

Link to comment
Share on other sites

Changed it to use default AutoCAD temp folder since I don't have a "C://acadtemp" folder:

 ;| Input  Dialog box with variable title
By Ah June 2015
http://www.cadtutor.net/forum/showthread.php?93002-1-line-2-line-3line-dcl-auto-generator-plus-more-if-required&p=636641&viewfull=1#post636641
Modified to use (getenv "temp") by Tom Beauford
code just use these next two lines
(if (not AH:getval1)(load "getvals"))
(ah:getval1 "title" width limit)  |;

; 1 line dcl
; sample code(ah:getval1 "line 1" 5 4)
(defun AH:getval1 (title width limit / fname fo dcl_id val1)
(setq fname (strcat (getenv "temp") "\\getval1.dcl"))
(setq fo (open fname "w"))
(write-line "ddgetval : dialog {" fo)
(write-line " : row {" fo)
(write-line ": edit_box {" fo)
(write-line (strcat "    key = "  (chr 34) "key1" (chr 34) ";") fo)
(write-line  (strcat " label = "  (chr 34) title (chr 34) ";"  )   fo)
; these can be replaced with shorter value etc
(write-line (strcat "     edit_width = " (rtos width 2 0) ";" ) fo)
(write-line (strcat "     edit_limit = " (rtos limit 2 0) ";" ) fo)
(write-line "   is_enabled = true;" fo)
(write-line "    }" fo)
(write-line "  }" fo)
(write-line "ok_only;}" fo)
(close fo)

(setq dcl_id (load_dialog  fname))
;(setq dcl_id (load_dialog  "c:\\acadtemp\\getval1"))
(if (not (new_dialog "ddgetval" dcl_id))
(exit))
(action_tile "key1" "(setq val1 $value)")
(mode_tile "key1" 3)
(start_dialog)
(done_dialog)
(unload_dialog dcl_id)
; returns the value of val1 as a string
(alert val1)
)


; 2 line dcl
; sample code (ah:getval2 "line 1" 5 4 "line2" 8 7)

(defun AH:getval2 (title1 width1 limit1 title2 width2 limit2 / fname fo dcl_id val1 val2)
(setq fname (strcat (getenv "temp") "\\getval2.dcl"))
(setq fo (open fname "w"))
(write-line "ddgetval2 : dialog {" fo)
(write-line " : column {" fo)

(write-line ": edit_box {" fo)
(write-line (strcat "    key = " (chr 34) "key1" (chr 34) ";") fo)
(write-line  (strcat " label = "  (chr 34) title1 (chr 34) ";" ) fo)
(write-line (strcat "     edit_width = " (rtos width1 2 0) ";" ) fo)
(write-line (strcat "     edit_limit = " (rtos limit1 2 0) ";" ) fo)
(write-line "   is_enabled = true ;" fo)
(write-line "    }" fo)
(write-line "spacer_1 ;" fo)
(write-line ": edit_box {" fo)
(write-line (strcat "    key = " (chr 34) "key2" (chr 34) ";") fo)
(write-line (strcat " label = "  (chr 34) title2 (chr 34) ";"  ) fo)
(write-line (strcat "     edit_width = " (rtos width2 2 0) ";" ) fo)
(write-line (strcat "     edit_limit = " (rtos limit2 2 0) ";" ) fo)
(write-line "   is_enabled = true ;" fo)
(write-line "    }" fo)
(write-line "    }" fo)
(write-line "spacer_1 ;" fo)
(write-line "ok_only;}" fo)
(close fo)

; code part
(setq dcl_id (load_dialog  fname))
(if (not (new_dialog "ddgetval2" dcl_id))
(exit))
(mode_tile "key1" 3)
(action_tile "key1" "(setq val1 $value)")
(mode_tile "key2" 3)
(action_tile "key2" "(setq val2 $value)")

(start_dialog)
(done_dialog)
(unload_dialog dcl_id)
; returns the value of val1 and val2 as strings
(alert (strcat val1 " " val2))
)

; 3 line dcl
; sample code (ah:getval3 "line 1" 5 4 "line2" 8 7 "line3" 6 4)

(defun AH:getval3 (title1 width1 limit1 title2 width2 limit2 title3 width3 limit3 / fname fo dcl_id val1 val2 val3)
(setq fname (strcat (getenv "temp") "\\getval3.dcl"))
(setq fo (open fname "w"))
(write-line "ddgetval3 : dialog {" fo)
(write-line " : column {" fo)
(write-line ": edit_box {" fo)
(write-line (strcat "    key = " (chr 34) "key1" (chr 34) ";") fo)
(write-line  (strcat " label = "  (chr 34) title1 (chr 34) ";" ) fo)
(write-line (strcat "     edit_width = " (rtos width1 2 0) ";" ) fo)
(write-line (strcat "     edit_limit = " (rtos limit1 2 0) ";" ) fo)
(write-line "   is_enabled = true ;" fo)
(write-line "    }" fo)
(write-line "spacer_1 ;" fo)
(write-line ": edit_box {" fo)
(write-line (strcat "    key = " (chr 34) "key2" (chr 34) ";") fo)
(write-line (strcat " label = "  (chr 34) title2 (chr 34) ";"  ) fo)
(write-line (strcat "     edit_width = " (rtos width2 2 0) ";" ) fo)
(write-line (strcat "     edit_limit = " (rtos limit2 2 0) ";" ) fo)
(write-line "   is_enabled = true ;" fo)
(write-line "    }" fo)
(write-line "spacer_1 ;" fo)
(write-line ": edit_box {" fo)
(write-line (strcat "    key = " (chr 34) "key3" (chr 34) ";") fo)
(write-line (strcat " label = "  (chr 34) title3 (chr 34) ";"  ) fo)
(write-line (strcat "     edit_width = " (rtos width3 2 0) ";" ) fo)
(write-line (strcat "     edit_limit = " (rtos limit3 2 0) ";" ) fo)
(write-line "   is_enabled = true ;" fo)
(write-line "    }" fo)
(write-line "    }" fo)
(write-line "spacer_1 ;" fo)
(write-line "ok_only;}" fo)

(close fo)

; code part
(setq dcl_id (load_dialog  fname))
(if (not (new_dialog "ddgetval3" dcl_id))
(exit))
(mode_tile "key1" 3)
(action_tile "key1" "(setq val1 $value)")
(mode_tile "key2" 3)
(action_tile "key2" "(setq val2 $value)")
(mode_tile "key3" 3)
(action_tile "key3" "(setq val3 $value)")
(start_dialog)
(done_dialog)
(unload_dialog dcl_id)
; returns the value of val1 and val2 val3 as strings
(alert (strcat val1 "\n" val2 "\n" val3))
)

Edited by tombu
Switched to using (getenv "temp")
Link to comment
Share on other sites

No worries tombu we just have everybody with a local temp directory and its part of our profile, I have changed my original post but for your info need this change double backslashes \\getval1 to path name.

Link to comment
Share on other sites

No worries tombu we just have everybody with a local temp directory and its part of our profile, I have changed my original post but for your info need this change double backslashes \\getval1 to path name.

 

(getvar "SAVEFILEPATH")

returns "C:\\Users\\BeaufordT\\appdata\\local\\temp\\" with double backslashes at the end so

(strcat (getvar "SAVEFILEPATH") "getval1.dcl")

returns "C:\\Users\\BeaufordT\\appdata\\local\\temp\\getval1.dcl" while

while

(strcat (getvar "SAVEFILEPATH") "\\getval1.dcl")

returns "C:\\Users\\BeaufordT\\appdata\\local\\temp\\\\getval1.dcl"

 

After further thought

(getenv "temp")

which returns "C:\\Users\\BEAUFO~1\\AppData\\Local\\Temp" would be better since SAVEFILEPATH is where autosave sv$ files are saved. While normally the same you can change SAVEFILEPATH without changing the Temp folder location. So I changed it to

(strcat (getenv "temp") "\\getval1.dcl")

in my previously post.

Link to comment
Share on other sites

No worries tombu we just have everybody with a local temp directory and its part of our profile, I have changed my original post but for your info need this change double backslashes \\getval1 to path name.

 

AL, getval.lsp from 2012 works perfect. I cannot get getvals.lsp to write the dcl files to my temp directory (which I have set correctly) any suggestions or example of what I may doing wrong.

Steve

Link to comment
Share on other sites

Tombu interesting getting different results

 

Command: (strcat (getvar "SAVEFILEPATH") "\\getval1.dcl")

"C:\\AcadTemp\\getval1.dcl"

 

Command: (getvar "SAVEFILEPATH")

"C:\\AcadTemp"

 

 

(strcat (getvar "SAVEFILEPATH") "getval1.dcl")

"C:\\AcadTempgetval1.dcl"

Link to comment
Share on other sites

stevesfr simplest way is to just hard code the directory we have a c:\Acadtemp which was what I posted first then changed the code to try to be more generic as another posted did not have Acadtemp.

 

; replace (setq fname (strcat (getvar "SAVEFILEPATH") "\\getval1.dcl"))
(setq fname "C:\\mychoice of directory"))
; note 3 times in code

Link to comment
Share on other sites

Tombu interesting getting different results

 

Command: (strcat (getvar "SAVEFILEPATH") "\\getval1.dcl")

"C:\\AcadTemp\\getval1.dcl"

 

Command: (getvar "SAVEFILEPATH")

"C:\\AcadTemp"

 

 

(strcat (getvar "SAVEFILEPATH") "getval1.dcl")

"C:\\AcadTempgetval1.dcl"

 

Since SAVEFILEPATH where autosave sv$ files isn't always the same as AutoCAD's temp folder I modified the code yesterday anyway.

I still have Civil 3D 2013 on my PC though and (getvar "SAVEFILEPATH") returns "C:\\Users\\BeaufordT\\appdata\\local\\temp\\" on it as well. Wondering if it's a file system thing, I'm on Windows 7 64 bit what's your operating system?

Did

(getenv "temp")

give you your temp folder "C:\\AcadTemp"?

 

I'd like to be able to post file related code in the future that would work on other PCs can you help me figure out a solution for this? What does

(getvar "roamablerootprefix")

result in on your PC? What about

 (vl-filename-directory (getenv "QnewTemplate"))

?

Link to comment
Share on other sites

I must apologise to Alan J Thompson for not acknowledging original code but this is what he used

 

(setq fo (open (setq fn (vl-filename-mktemp "" "" ".dcl")) "w"))

 

I am on WIN 7 64bit. Lee, Remark any comment ?

Link to comment
Share on other sites

A better solution may be using (strcat (getenv "temp") "\\getval1.lsp")) it still needs the \\ slashes

 

I have edited my original code to have 3 choices.

Edited by BIGAL
Link to comment
Share on other sites

A better solution may be using (strcat (getenv "temp") "\\getval1.lsp")) it still needs the \\ slashes

 

I have edited my original code to have 3 choices.

 

Both our (getenv "temp") need the \\ double backslashes at the end which is both consistent and the actual location of AutoCAD's temp file. I've never found a need to change the location of either the temp or SAVEFILEPATH, mine are both out the box locations glad temp worked the same for both of us.

Link to comment
Share on other sites

  • 9 months later...

This is the latest version and basicly you can have as many lines as you like its all worked out from the 1 calling line, problem is it does not work I need help see code in red. The other way around is by somehow creating variables on the fly.

 

; multi line dcl
; sample code a 3 line example
; (AH:getvals (list "Line 1" 5 4 "line 2" 2 4 "line 3" 8 7))
(defun AH:getvals (INFO / fo fname newlst num x y)
; you can hard code a directory if you like for dcl file
;(setq fo (open (setq fname (vl-filename-mktemp "" "" ".dcl")) "w"))
(setq fo (open (setq fname "c:\\temp\\getvals.dcl") "w"))
(write-line "ddgetval : dialog {" fo)
(write-line " : column {" fo)

(setq num (/ (length info) 3))

(setq newlst '())
(repeat num
(setq newlst (cons "-" newlst))
)

(setq x 1)
(setq y 1)

(repeat num
(write-line ": edit_box {" fo)
(write-line (strcat "    key = "  (chr 34) (strcat "key" (rtos y 2 0)) (chr 34) ";") fo)
(write-line (strcat " label = "  (chr 34) (nth (- x 1) info) (chr 34) ";"  )   fo)
(write-line (strcat "     edit_width = " (rtos (nth x info) 2 0) ";" ) fo)
(write-line (strcat "     edit_limit = " (rtos (nth (+ x 1) info) 2 0) ";" ) fo)
(write-line "   is_enabled = true;" fo)
(write-line "  }" fo)
(write-line "spacer_1 ;" fo)
(setq x (+ x 3))
(setq y (+ y 1))
)
(write-line "  }" fo) 
(write-line "ok_only;}" fo)
(close fo)

(setq x 1)
(setq outlst '())
(setq dcl_id (load_dialog  fname))
(if (not (new_dialog "ddgetval" dcl_id))
(exit))

(setq x 0)
(repeat num
;(action_tile (strcat "key" (rtos x 2 0) ) "(setq val1 $value)")
(action_tile (strcat "key" (rtos x 2 0)) "[color="red"](subst $value (nth x newlst) newlst )[/color]")
(mode_tile (strcat "key" (rtos x 2 0)) 3)
(setq x (+ x 1))
)


(start_dialog)
(done_dialog)

(unload_dialog dcl_id)
; returns the value of keys as strings in list newlst
;(vl-file-delete fname)
) ; defun

Link to comment
Share on other sites

This is the latest version and basicly you can have as many lines as you like its all worked out from the 1 calling line, problem is it does not work I need help see code in red. The other way around is by somehow creating variables on the fly.

 

; multi line dcl
; sample code a 3 line example
; (AH:getvals (list "Line 1" 5 4 "line 2" 2 4 "line 3" 8 7))
(defun AH:getvals (INFO / fo fname newlst num x y)
; you can hard code a directory if you like for dcl file
;(setq fo (open (setq fname (vl-filename-mktemp "" "" ".dcl")) "w"))
(setq fo (open (setq fname "c:\\temp\\getvals.dcl") "w"))
(write-line "ddgetval : dialog {" fo)
(write-line " : column {" fo)

(setq num (/ (length info) 3))

(setq newlst '())
(repeat num
(setq newlst (cons "-" newlst))
)

(setq x 1)
(setq y 1)

(repeat num
(write-line ": edit_box {" fo)
(write-line (strcat "    key = "  (chr 34) (strcat "key" (rtos y 2 0)) (chr 34) ";") fo)
(write-line (strcat " label = "  (chr 34) (nth (- x 1) info) (chr 34) ";"  )   fo)
(write-line (strcat "     edit_width = " (rtos (nth x info) 2 0) ";" ) fo)
(write-line (strcat "     edit_limit = " (rtos (nth (+ x 1) info) 2 0) ";" ) fo)
(write-line "   is_enabled = true;" fo)
(write-line "  }" fo)
(write-line "spacer_1 ;" fo)
(setq x (+ x 3))
(setq y (+ y 1))
)
(write-line "  }" fo) 
(write-line "ok_only;}" fo)
(close fo)

(setq x 1)
(setq outlst '())
(setq dcl_id (load_dialog  fname))
(if (not (new_dialog "ddgetval" dcl_id))
(exit))

(setq x 0)
(repeat num
;(action_tile (strcat "key" (rtos x 2 0) ) "(setq val1 $value)")
(action_tile (strcat "key" (rtos x 2 0)) "[color="red"](subst $value (nth x newlst) newlst )[/color]")
(mode_tile (strcat "key" (rtos x 2 0)) 3)
(setq x (+ x 1))
)


(start_dialog)
(done_dialog)

(unload_dialog dcl_id)
; returns the value of keys as strings in list newlst
;(vl-file-delete fname)
) ; defun

 

Maybe you need @LeeMac.

Link to comment
Share on other sites

Morning BigAl !

 

I must admit that I am very rusty on DCL.

 

I've dug thru your early posts and early correspondences and think it is a great idea.

 

Here is how I've approached in the past ( with some tweaks for this thread )

 

[b][color=BLACK]([/color][/b]defun c:gendcl [b][color=FUCHSIA]([/color][/b]/ tiles kl fn wf key lab def vtp id action
                  output code val typ [color=#8b4513]; a q x y z[/color]
                [b][color=FUCHSIA])[/color][/b]

[color=#8b4513];;;25 SINGLE CHARACTER VARIABLES MAX    A->Z   EXCLUDE T[/color]
                   [color=#8b4513];;;   key label    default  type[/color]
 [b][color=FUCHSIA]([/color][/b]setq tiles [b][color=NAVY]([/color][/b]if gv_tiles gv_tiles
             [b][color=MAROON]([/color][/b]list [b][color=GREEN]([/color][/b]list [color=#2f4f4f]"A"[/color] [color=#2f4f4f]"App"[/color]    [color=#2f4f4f]"Open"[/color] [color=#2f4f4f]"STR"[/color][b][color=GREEN])[/color][/b]
                   [b][color=GREEN]([/color][/b]list [color=#2f4f4f]"Q"[/color] [color=#2f4f4f]"Qty"[/color]     [color=#2f4f4f]"1"[/color]   [color=#2f4f4f]"INT"[/color][b][color=GREEN])[/color][/b]
                   [b][color=GREEN]([/color][/b]list [color=#2f4f4f]"X"[/color] [color=#2f4f4f]"Width"[/color]  [color=#2f4f4f]"24"[/color]   [color=#2f4f4f]"REAL"[/color][b][color=GREEN])[/color][/b]
                   [b][color=GREEN]([/color][/b]list [color=#2f4f4f]"Y"[/color] [color=#2f4f4f]"Length"[/color] [color=#2f4f4f]"48"[/color]   [color=#2f4f4f]"REAL"[/color][b][color=GREEN])[/color][/b]
                   [b][color=GREEN]([/color][/b]list [color=#2f4f4f]"Z"[/color] [color=#2f4f4f]"Height"[/color] [color=#2f4f4f]"36"[/color]   [color=#2f4f4f]"REAL"[/color][b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b][b][color=FUCHSIA])[/color][/b]

 [b][color=FUCHSIA]([/color][/b]foreach v tiles
    [b][color=NAVY]([/color][/b]setq kl [b][color=MAROON]([/color][/b]cons [b][color=GREEN]([/color][/b]car v[b][color=GREEN])[/color][/b] kl[b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b]
    [b][color=NAVY]([/color][/b]set [b][color=MAROON]([/color][/b]read [b][color=GREEN]([/color][/b]car v[b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b] [b][color=MAROON]([/color][/b]nth 2 v[b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b][b][color=FUCHSIA])[/color][/b]

 [b][color=FUCHSIA]([/color][/b]setq fn [color=#2f4f4f]"gen.dcl"[/color][b][color=FUCHSIA])[/color][/b]
 [b][color=FUCHSIA]([/color][/b]setq wf [b][color=NAVY]([/color][/b]open fn [color=#2f4f4f]"w"[/color][b][color=NAVY])[/color][/b][b][color=FUCHSIA])[/color][/b]
 [b][color=FUCHSIA]([/color][/b]write-line [b][color=NAVY]([/color][/b]strcat [color=#2f4f4f]"dcl_settings : default_dcl_settings { audit_level = 0; }"[/color][b][color=NAVY])[/color][/b] wf[b][color=FUCHSIA])[/color][/b]
 [b][color=FUCHSIA]([/color][/b]write-line [b][color=NAVY]([/color][/b]strcat [color=#2f4f4f]"fdiin : dialog { label = \"[/color]Generic DCL Inputs\[color=#2f4f4f]" ;"[/color][b][color=NAVY])[/color][/b] wf[b][color=FUCHSIA])[/color][/b]
 [b][color=FUCHSIA]([/color][/b]write-line [b][color=NAVY]([/color][/b]strcat [color=#2f4f4f]" : column {"[/color][b][color=NAVY])[/color][/b] wf[b][color=FUCHSIA])[/color][/b]
 [b][color=FUCHSIA]([/color][/b]foreach v tiles
     [b][color=NAVY]([/color][/b]setq key [b][color=MAROON]([/color][/b]nth 0 v[b][color=MAROON])[/color][/b] lab [b][color=MAROON]([/color][/b]nth 1 v[b][color=MAROON])[/color][/b]
           def [b][color=MAROON]([/color][/b]nth 2 v[b][color=MAROON])[/color][/b] vtp [b][color=MAROON]([/color][/b]nth 3 v[b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b]
     [b][color=NAVY]([/color][/b]write-line [b][color=MAROON]([/color][/b]strcat [color=#2f4f4f]"  : row  { "[/color][b][color=MAROON])[/color][/b]  wf[b][color=NAVY])[/color][/b]
     [b][color=NAVY]([/color][/b]write-line [b][color=MAROON]([/color][/b]strcat [color=#2f4f4f]"   : edit_box {key = \"[/color][color=#2f4f4f]" key "[/color]\[color=#2f4f4f]""[/color]
                         [color=#2f4f4f]" ; label = \"[/color][color=#2f4f4f]" [b][color=GREEN]([/color][/b]strcat key "[/color] [color=#2f4f4f]" lab[b][color=GREEN])[/color][/b] "[/color]:\[color=#2f4f4f]""[/color]
                         [color=#2f4f4f]" ; value = \"[/color][color=#2f4f4f]" def "[/color]\[color=#2f4f4f]""[/color]
                         [color=#2f4f4f]" ; edit_width = 20 "[/color]
                         [color=#2f4f4f]" ; alignment = \"[/color]right\[color=#2f4f4f]""[/color]
                         [color=#2f4f4f]" ; mnemonic = \"[/color][color=#2f4f4f]" key "[/color]\[color=#2f4f4f]" "[/color]
                         [color=#2f4f4f]"; }}"[/color] [b][color=MAROON])[/color][/b] wf[b][color=NAVY])[/color][/b][b][color=FUCHSIA])[/color][/b]
 [b][color=FUCHSIA]([/color][/b]write-line [b][color=NAVY]([/color][/b]strcat [color=#2f4f4f]"    }"[/color][b][color=NAVY])[/color][/b] wf[b][color=FUCHSIA])[/color][/b]
 [b][color=FUCHSIA]([/color][/b]write-line [b][color=NAVY]([/color][/b]strcat [color=#2f4f4f]"  : row { ok_cancel ; }}"[/color][b][color=NAVY])[/color][/b] wf[b][color=FUCHSIA])[/color][/b]
 [b][color=FUCHSIA]([/color][/b]close wf[b][color=FUCHSIA])[/color][/b]

 [b][color=FUCHSIA]([/color][/b]setq id [b][color=NAVY]([/color][/b]load_dialog fn[b][color=NAVY])[/color][/b][b][color=FUCHSIA])[/color][/b]
 [b][color=FUCHSIA]([/color][/b]new_dialog [color=#2f4f4f]"fdiin"[/color] id[b][color=FUCHSIA])[/color][/b]

 [b][color=FUCHSIA]([/color][/b]foreach k kl
     [b][color=NAVY]([/color][/b]action_tile k [b][color=MAROON]([/color][/b]strcat [color=#2f4f4f]"[b][color=GREEN]([/color][/b]setq "[/color] k [color=#2f4f4f]" [b][color=BLUE]([/color][/b]get_tile \"[/color][color=#2f4f4f]" k "[/color]\[color=#2f4f4f]"[b][color=BLUE])[/color][/b][b][color=GREEN])[/color][/b]"[/color][b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b][b][color=FUCHSIA])[/color][/b]
 [b][color=FUCHSIA]([/color][/b]action_tile [color=#2f4f4f]"accept"[/color] [color=#2f4f4f]"[b][color=NAVY]([/color][/b]done_dialog 1[b][color=NAVY])[/color][/b]"[/color][b][color=FUCHSIA])[/color][/b]
 [b][color=FUCHSIA]([/color][/b]action_tile [color=#2f4f4f]"cancel"[/color] [color=#2f4f4f]"[b][color=NAVY]([/color][/b]done_dialog 0[b][color=NAVY])[/color][/b]"[/color][b][color=FUCHSIA])[/color][/b]
 [b][color=FUCHSIA]([/color][/b]setq action [b][color=NAVY]([/color][/b]start_dialog[b][color=NAVY])[/color][/b][b][color=FUCHSIA])[/color][/b]
 [b][color=FUCHSIA]([/color][/b]unload_dialog id[b][color=FUCHSIA])[/color][/b]

[color=#8b4513];;;CREATE GLOBAL TILES LIST[/color]
 [b][color=FUCHSIA]([/color][/b]setq gv_tiles nil[b][color=FUCHSIA])[/color][/b]
 [b][color=FUCHSIA]([/color][/b]foreach v [b][color=NAVY]([/color][/b]reverse tiles[b][color=NAVY])[/color][/b]
   [b][color=NAVY]([/color][/b]setq gv_tiles [b][color=MAROON]([/color][/b]cons [b][color=GREEN]([/color][/b]list [b][color=BLUE]([/color][/b]nth 0 v[b][color=BLUE])[/color][/b] [b][color=BLUE]([/color][/b]nth 1 v[b][color=BLUE])[/color][/b]
                              [b][color=BLUE]([/color][/b]eval [b][color=RED]([/color][/b]read [b][color=PURPLE]([/color][/b]nth 0 v[b][color=PURPLE])[/color][/b][b][color=RED])[/color][/b][b][color=BLUE])[/color][/b]
                              [b][color=BLUE]([/color][/b]nth 3 v[b][color=BLUE])[/color][/b][b][color=GREEN])[/color][/b] gv_tiles[b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b][b][color=FUCHSIA])[/color][/b]

[color=#8b4513];;;CREATE OUTPUT LIST[/color]
 [b][color=FUCHSIA]([/color][/b]foreach k kl
   [b][color=NAVY]([/color][/b]if [b][color=MAROON]([/color][/b]> action 0[b][color=MAROON])[/color][/b]
       [b][color=MAROON]([/color][/b]setq output [b][color=GREEN]([/color][/b]cons [b][color=BLUE]([/color][/b]strcat k [b][color=RED]([/color][/b]eval [b][color=PURPLE]([/color][/b]read k[b][color=PURPLE])[/color][/b][b][color=RED])[/color][/b][b][color=BLUE])[/color][/b] output[b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b]
       [b][color=MAROON]([/color][/b]set [b][color=GREEN]([/color][/b]read k[b][color=GREEN])[/color][/b] nil[b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b][b][color=FUCHSIA])[/color][/b]

[color=#8b4513];;;FORMAT VALUES[/color]
 [b][color=FUCHSIA]([/color][/b]foreach v output
   [b][color=NAVY]([/color][/b]setq code [b][color=MAROON]([/color][/b]substr v 1 1[b][color=MAROON])[/color][/b]
          val [b][color=MAROON]([/color][/b]substr v 2[b][color=MAROON])[/color][/b]
          typ [b][color=MAROON]([/color][/b]nth 3 [b][color=GREEN]([/color][/b]assoc code tiles[b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b]
   [b][color=NAVY]([/color][/b]set [b][color=MAROON]([/color][/b]read code[b][color=MAROON])[/color][/b]
        [b][color=MAROON]([/color][/b]cond [b][color=GREEN]([/color][/b][b][color=BLUE]([/color][/b]= typ [color=#2f4f4f]"REAL"[/color][b][color=BLUE])[/color][/b] [b][color=BLUE]([/color][/b]atof val[b][color=BLUE])[/color][/b][b][color=GREEN])[/color][/b]
              [b][color=GREEN]([/color][/b][b][color=BLUE]([/color][/b]= typ [color=#2f4f4f]"INT"[/color][b][color=BLUE])[/color][/b]  [b][color=BLUE]([/color][/b]atoi val[b][color=BLUE])[/color][/b][b][color=GREEN])[/color][/b]
              [b][color=GREEN]([/color][/b][b][color=BLUE]([/color][/b]= typ [color=#2f4f4f]"STR"[/color][b][color=BLUE])[/color][/b]        val[b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b][b][color=FUCHSIA])[/color][/b]

 [b][color=FUCHSIA]([/color][/b]prin1 output[b][color=FUCHSIA])[/color][/b]

 [b][color=FUCHSIA]([/color][/b]prin1[b][color=FUCHSIA])[/color][/b][b][color=BLACK])[/color][/b]

 

 

 

I'm sure yours is a typo or small format problem as they worked before

 

Good Luck ! -David

Edited by David Bethel
Flushed out the code
Link to comment
Share on other sites

Thanks David The foreach k kl is what I need in particular the action-tile part I went a bit to simple. Like the idea of auto number or string the returned values.

Link to comment
Share on other sites

You're welcome,

 

I flushed out the code some in post #16

 

Added a global variable for memory in the current session only

Added the conversion segment.

 

It is just a starting point but should come in handy for the folks that like DCL inputs

 

-David

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...