TheSwamp
Code Red => AutoLISP (Vanilla / Visual) => Topic started by: SPDCad on June 06, 2005, 11:26:58 AM
-
Anyone have a lisp that will translate DCL code to a string?
I like to write my dcl code in file.dcl format first. Then I translate it to a string when my lisp is complete.
Then I insert the string into my lisp and have my lisp generate the dcl code when executed.
I practice this to keep the number of files to a minimum and to make sure the lisp finds the dcl code and doesn't return an error because the user has not put the dcl code in a search path.
If no lisp is available;
I am currently writing a lisp to translate the code and I am stuck at
replacing “ (quote symbol) with \”. Current autocad won’t accept the following code.
(setq CHK (vl-string-subst """ "\"" Line)
Any help would be greatly appreciated.
-
Some times I write the dcl code to a tmp file then call it.
(defun mktemp-dcl (/ tmpf tmpfo)
(setq tmpf (vl-filename-mktemp nil nil ".dcl")
tmpfo (open tmpf "w")
)
(write-line
(strcat
"diag1 : dialog {
label = \"Select a program to run\";
: boxed_column {
label = \"\";
:row {
: button {
fixed_width = true;
key = \"button1\";
label = \"Lisp1\";
}
: button {
fixed_width = true;
key = \"button2\";
label = \"Lisp2\";
}
: button {
label = \"Cancel\";
is_cancel = true;
key = \"cancel\";
fixed_width = true;
}}}}"
) ; strcat
tmpfo
)
(close tmpfo)
tmpf
)
-
Indeed, I do that in many apps, like the info and axprops utils.
Did you know you don't have to use a dcl extension?
:)
-
Kenny has a little tutorial on this here.
http://www.afralisp.com/lisp/dclatt.htm
-
I sorry guys I must have explained what I am looking for wrong. I know how to get AutoCad to make the temporary dcl file and have autocad read it. As explained at the link http://www.afralisp.com/lisp/dclatt.htm. . I wrote a lisp called MAKEDCL years ago that does that.
What I am looking for is a way to take a pre-made dcl file and make it into a string.
ie. take a file containing
TEST : dialog {
: text { label = "Test"
key = TXT;
}
ok_cancel;
}
And turn it into a string
"TEST : dialog { : text { label = \"Test\" key = TXT; } ok_cancel; }"
that I then feed into the MAKEDCL lisp.
Like I mentioned above I am currently writing a lisp to translate the code from dcl to a string but I am stuck at replacing “ (quote symbol) with \”.
Currently autocad won’t accept the following code.
Code:
(setq CHK (vl-string-subst """ "\"" Line)
I hope that explanation is a little cleaner….
-
http://www.theswamp.org/phpBB2/viewtopic.php?t=1706&highlight=dcl2lisp
-
Thanks CAB, thats is similar to what i was looking for.
:)