TheSwamp
Code Red => VB(A) => Topic started by: Matersammichman on June 27, 2006, 01:27:39 PM
-
1. What command can I use to load a VLX file with VBA? :realmad:
2. What command can I use to load a LISP file? :pissed:
-
You could use sendcommand
-
True, but if I can load ARX and DVB with VBA, why not Lisp and Visual Lisp?
-
Because AutoCAD VBA doesn't have a built in LoadLSP method. Of course, you can load Lisp and Visual Lisp, just maybe not the way you want to. There's a better than even chance that referencing a library will allow you to achieve your desired results but if so, someone else will have to chime in on it.
-
Bob,
I'm having a bad brain day...could you drop me a complete line of example code to modify?
-
thisdrawing.sendcommand "(load ""lispname.lsp"")" & vbcr
ought to work
-
ThisDrawing.SendCommand "(load ""lispname.lsp"" 'doh)" & vbCr
-
'doh?
-
Re, Me, Fa, So, La, Ti, Do
-
Sure.
ThisDrawing.SendCommand "(load ""lispname.lsp"" 'crapweasel)" & vbCr
ThisDrawing.SendCommand "(load ""lispname.lsp"" (alert ""Load knackered.""))" & vbCr
yada ...
But generally speaking I wouldn't use --
ThisDrawing.SendCommand "(load ""lispname.lsp"")" & vbCr
-
OK, he asked a question that no one else was answering, I gave him an answer that works. If you don't like it, instead of knocking it why don't you dazzle us with your fucking brilliance and show him a better way.
-
OK, he asked a question that no one else was answering, I gave him an answer that works. If you don't like it, instead of knocking it why don't you dazzle us with your 42616E6E656400[/b]ing brilliance and show him a better way.
No need to go hexipostal. I was just demonstrating the optional argument you can pass the load statement so it returns something more illuminating or desirable than --
[0.43] (VL-BT)
[1.39] (*ERROR* "LOAD failed: \"lispname.lsp\"")
[2.34] (_call-err-hook #<SUBR @0312b078 *ERROR*> "LOAD failed:
\"lispname.lsp\"")
[3.28] (sys-error "LOAD failed: \"lispname.lsp\"")
:ERROR-BREAK.23 nil
[4.20] (LOAD "lispname.lsp")
[5.15] (#<SUBR @03288be0 -rts_top->)
[6.12] (#<SUBR @02a22334 veval-str-body> "(load \"lispname.lsp\")" T #<FILE
internal>)
:CALLBACK-ENTRY.6 (:CALLBACK-ENTRY)
:ARQ-SUBR-CALLBACK.3 (nil 0)
-
Bob,
So...If its on a drive other than "C"
say "G",
do I need to path it "G:\..." :ugly:
-
MP:
Sorry, I misunderstood and it was uncalled for regardless. Looks like I probably shouldn't be in public today.
MSM:
If the lisp is in your support path you don't need to path it, if it's not you do.
-
Carry on Bob, bigger things to worry about; all is cool.
-
..ThisDrawing.SendCommand "(load ""lispname.lsp"" (alert ""Load knackered.""))" & vbCr..
MP:
Are there too many quotes in the alert line?
(load "lispname.lsp" (alert "Load knackered.")) works for me, but I had to delete some of the quotes.
With the extra quotes the load tossed a binky.. :-D
-
:wink:It's all good...
All I had to do was add double backslashes.
Thanks all!
-
Atook, as a lisp statement, (load "lispname.lsp" (alert "Load knackered.")) is correct. If you want that to work from vba though, it needs to be ThisDrawing.sendcommand "(load ""lispname.lsp"" (alert ""Load knackered.""))"
Double quotes("") in a string in VBA add a single quote(") to the string. It's pretty much the same reason that you have to use a double backslash (\\) in lisp.
-
Dont toss the binky....
-
Thanks for pointing that out Bob, I should have seen it.
I always used Chr$(34) for a quote in VB6, but never had to evaluate a quote in VBA.
Good to know.
-
heh, missed the tossed the binky. Chr$(34)/Chr(34) works in VBA as well, I just couldn't remember the number so "" was easier. AFAIR, "" works in VB6 as well. When it gets down to it, it probably doesn't matter which way you skin the cat as long as it ends up on the fish hook.