Author Topic: How do I load VLX and LISP files with VBA?  (Read 6806 times)

0 Members and 1 Guest are viewing this topic.

Matersammichman

  • Guest
How do I load VLX and LISP files with VBA?
« 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:
« Last Edit: June 27, 2006, 08:42:52 PM by nivuahc »

Bob Wahr

  • Guest
Re: How???
« Reply #1 on: June 27, 2006, 01:37:30 PM »
You could use sendcommand

Matersammichman

  • Guest
Re: How???
« Reply #2 on: June 27, 2006, 01:46:33 PM »
True, but if I can load ARX and DVB with VBA, why not Lisp and Visual Lisp?

Bob Wahr

  • Guest
Re: How???
« Reply #3 on: June 27, 2006, 01:55:04 PM »
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.

Matersammichman

  • Guest
Re: How???
« Reply #4 on: June 27, 2006, 02:23:17 PM »
Bob,
I'm having a bad brain day...could you drop me a complete line of example code to modify?

Bob Wahr

  • Guest
Re: How???
« Reply #5 on: June 27, 2006, 02:28:10 PM »
thisdrawing.sendcommand "(load ""lispname.lsp"")" & vbcr

ought to work

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: How???
« Reply #6 on: June 27, 2006, 02:39:05 PM »
ThisDrawing.SendCommand "(load ""lispname.lsp"" 'doh)" & vbCr
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

Bob Wahr

  • Guest
Re: How???
« Reply #7 on: June 27, 2006, 02:42:28 PM »
'doh?

Maverick®

  • Seagull
  • Posts: 14778
Re: How???
« Reply #8 on: June 27, 2006, 02:43:52 PM »
Re, Me, Fa, So, La, Ti, Do   

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: How???
« Reply #9 on: June 27, 2006, 02:48:25 PM »
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
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

Bob Wahr

  • Guest
Re: How???
« Reply #10 on: June 27, 2006, 02:52:33 PM »
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.

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: How???
« Reply #11 on: June 27, 2006, 02:56:50 PM »
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)
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

Matersammichman

  • Guest
Re: How???
« Reply #12 on: June 27, 2006, 03:05:59 PM »
Bob,

So...If its on a drive other than "C"
say "G",
do I need to path it "G:\..." :ugly:

Bob Wahr

  • Guest
Re: How???
« Reply #13 on: June 27, 2006, 03:07:38 PM »
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.

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: How???
« Reply #14 on: June 27, 2006, 03:09:47 PM »
Carry on Bob, bigger things to worry about; all is cool.
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

Atook

  • Swamp Rat
  • Posts: 1029
  • AKA Tim
Re: How???
« Reply #15 on: June 27, 2006, 03:13:38 PM »
..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

Matersammichman

  • Guest
Re: How???
« Reply #16 on: June 27, 2006, 03:14:56 PM »
 :wink:It's all good...
All I had to do was add double backslashes.

Thanks all!

Bob Wahr

  • Guest
Re: How???
« Reply #17 on: June 27, 2006, 03:47:08 PM »
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.

David Hall

  • Automatic Duh Generator
  • King Gator
  • Posts: 4075
Re: How???
« Reply #18 on: June 27, 2006, 04:21:00 PM »
Dont toss the binky....
Everyone has a photographic memory, Some just don't have film.
They say money can't buy happiness, but it can buy Bacon and that's a close second.
Sometimes the question is more important than the answer. (Thanks Kerry for reminding me)

Atook

  • Swamp Rat
  • Posts: 1029
  • AKA Tim
Re: How???
« Reply #19 on: June 27, 2006, 04:33:12 PM »
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.

Bob Wahr

  • Guest
Re: How???
« Reply #20 on: June 27, 2006, 05:10:27 PM »
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.