VBA Macro at Startup Hangs AutoCAD

VBA Macro at Startup Hangs AutoCAD

Anonymous
Not applicable
576 Views
4 Replies
Message 1 of 5

VBA Macro at Startup Hangs AutoCAD

Anonymous
Not applicable
I have a macro I am loading at startup that causes AutoCAD to hang under
some pretty odd conditions.

Here are some specifics from my application:
1) I have a macro in a custom dvb file that I want to run every time I open
a new drawing.
2) My desired solution is to run the macro from a LISP routine that already
runs from the acad.ml file. (Part of this is timing, I'm integrating VBA
functionality into a very complex set of LISP routines we are already using
and I'm passing information back and forth right now.) However, I have tried
using S::Startup functions called from Acaddoc2000.lsp, and several other
options mentioned in the newsgroups, they all have the same problem.
3) That problem is that AutoCAD hangs when opening an existing drawing while
a new drawing that was never saved is still open. (e.g. AutoCAD opens with a
blank drawing, I immediately open an existing drawing AutoCAD hangs. If I
close the new drawing first, then open an existing drawing there is no
problem. Also, if I start another new drawing from a template there is also
no problem.
4) I am 99.9% sure that this is because when opening an existing drawing,
AutoCAD closes the unsaved new drawing that was open. However, when starting
another new drawing AutoCAD keeps that unsaved new drawing open.

I am completely at a lost. I can include the code if anybody wants to see
it, but I'm sure it's not my code because it doesn't matter if the macro
even exists or if the macro is empy. Furthermore, as I mentioned it doesn't
seem to matter how I start the macro or from where.
0 Likes
577 Views
4 Replies
Replies (4)
Message 2 of 5

Anonymous
Not applicable
Sure post the code or e-mail it directly to me. Perferable not as a DVB
file, but as a text file and steps on what you are trying to do.

Thanks,
Lee Ambrosius
HyperPics, http://www.hyperpics.com
0 Likes
Message 3 of 5

Anonymous
Not applicable
Have you tried calling your DVB file acad.dvb and placing it in an AutoCAD
support directory. AutoCAD should load the file without need anything done
to the MNL or a LSP file.

Thanks,
Lee Ambrosius
HyperPics, http://www.hyperpics.com
0 Likes
Message 4 of 5

Anonymous
Not applicable
I have had that same problem in the past and this is how I solved it.
My acad.lsp is set NOT to load in every drawing. I use it to load my vba app and run the macro.
It looks something like this:
(defun S::STARTUP()
(VL-vbarun "location and name of app.dvb!macroname.macro")
);;defun
I can use my acaddoc.lsp to load other applications automatically.
This seems to allow me to open as many drawings as I want and the application runs on all of them.
Hope this helps
0 Likes
Message 5 of 5

Anonymous
Not applicable
Using acad200doc.lsp to load my appilications and run the macro seems to
work fine. However, I think this is because it no longer closes the blank
drawing AutoCAD starts with. That really isn't an ideal solution since that
drawing now needs to be closed manually. I'm also nervous on depending on all of
my users not changing the setting for loading acad.lsp. Does anybody know why
acad2000doc.lsp doesn't close the blank drawing and acad.lsp does?


style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
I
have had that same problem in the past and this is how I solved it.
My
acad.lsp is set NOT to load in every drawing. I use it to load my vba app and
run the macro.
It looks something like this:
(defun S::STARTUP()

(VL-vbarun "location and name of app.dvb!macroname.macro")
);;defun

I can use my acaddoc.lsp to load other applications automatically.

This seems to allow me to open as many drawings as I want and the
application runs on all of them.
Hope this helps
0 Likes