PDA

View Full Version : Problem Plotting with VBA



CADdancer
2004-07-22, 05:58 PM
Hello to Everyone at AUGI:

I have a simple VBA routine that plots the current drawing file in AutoCAD 2005.

The routine is called from a lisp program that loads the VBA code, runs the module and then unloads the VBA code.

When plotting a drawing in paper space everything works OK. However, when I try to plot a drawing from model space the form stays open and does not allow me to select the two points required for the plot window. If I try to hide the form (Me.Hide) the form disappears and I can define the plot window but after the plot is completed the lisp routine does not unload the VBA file. It appears that the VBA code does not release control back to the lisp environment.

Does anyone have any suggestions on how to solve this situatuon.

Any help would be appreciated.

Regards,
Vince

RobertB
2004-07-22, 11:52 PM
You state that this is a plotting project. Since plotting is a common task, wouldn't it be better to leave the project loaded anyway?

That being said, you also mention that the code works fine in a layout, but fails in ModelSpace. Could that really be the issue? Do you have an error handler that is concealing an error in you code? For instance, a named page setup defined for a layout cannot be used in ModelSpace.

CADdancer
2004-07-23, 11:38 AM
Robert:

Thank you for your response.

I want the VBA code to return control to the Autolisp routine that called the VBA plotting program in the first place because the lisp routine performs other operations before exiting the program completely.

I do not believe that an error is causing the problem because we trapped for errors and did not get any however, there must be something that VBA does not like that causes it to exit the routine before returning control to the lisp program.

Thank you for the advice......!.....I will continue to research this problem and let you know if I find what is causing the problem.

Regards,
Vince

Wes.Stueve
2004-08-11, 01:11 PM
I've been having some problems with my plot routine I am upgrading from 2002. The problem I ran in to was that if I tried to set the Layout.PlotType to acLimits, it would tell me it was an invalid property value. The workaround was to make it do a window, but this is going to get messy when there are 3D drawings I'm afraid. If you know the solution, please share. As far as making your VBA routine continue with the Lisp, can you just split the Lisp into two routines (one pre-VBA and one post-VBA) and call the lisp routine from VBA when it is ready to exit? Good luck!

arshiel88
2006-03-06, 09:07 PM
I don't know why do you need to use two different languages (LISP and VBA) when almost all (if not all) that can be done in LISP can also be done in VBA. If the problem is loading of VBA projects (*.dvb), I have my toolbars with the macro name prefixed with the dvb filename, and it loads the file automatically whenever its not loaded.

caddzzarr
2006-03-14, 01:41 PM
I hope this helps:

Layout.PlotType = acLimits