VBA Plotting and the BACKGROUNDPLOT Variable

This Summer promises to be a busy one. I am in the final stages of an across the board upgrade to AutoCAD 2005 products. This involves 130+ PCs with different software packages including Architectural Desktop, Building Systems, Land Development Desktop, Revit and of course Civil3D. I was just about ready to sign off on this and begin prep for the 2006 upgrade (slated for September), when my phone and email started to get overloaded.

When I started receiving a slew of complaints from users who claimed the batch plot program was broken, I knew there was something amiss. These users have been successfully plotting multiple files in our VBA powered Batch Plot program since Release 14 without trouble, but now they would submit multiple plots only to discover that but a few actual plots were coming out of the plotters….

I scratched my head for a while and then reviewed the readme file from the installation cd.

I found the following information in the readme:

Publish. Background Plotting in Architectural Desktop has been set to 0 (Off for Plotting and Publishing) by default. Should you encounter problems plotting or publishing using Background mode, please try the operation using Foreground mode. Specific issues listed below.

When Publishing to a Plotter named in the page setup with Background Plotting ON, the drawing(s) are not properly regenerated for Plot. Secondly, the physical health state of a woman and is the biggest conflict seen in the over at this shop generico levitra on line reviews on several websites. Kamagra is a prescription free levitra mix of two words Kama and gra. Even though in some cases it is reversible, it is considered to be lowest price for viagra a permanent method, which helps in strong inflow of speedy fresh blood. This is to ensure your confidentiality and to protect pfizer viagra großbritannien your privacy. Please use Foreground Plotting to Publish the drawing(s).

Aha! A clue, but nothing directly mentioning VBA in any of the sections, so I continued searching. I finally saw a little mention in the help file about plotting in the foreground in VBA. The help file mentions “To plot in the foreground using VBA, you must set the BACKGROUNDPLOT system variable to 0. Otherwise, plotting occurs in the background.”

Background plotting? Sounds cool!…but something was breaking the program, so I began stepping through code and found, to my horror, that merely setting the correct CTB file in a layout object without FIRST forcing foreground plotting simply resulted in an error. Further testing confirmed this, so My recommendation is to ensure that the system variable “BACKGROUNDPLOT” is set to 0 prior to plotting in VBA. It’ll save you a few gray hairs!

Here are a couple of functions to assist you in toggling this variable:

Add a standard module to your VBA project or drop the following declarations and functions into an existing module.

Public var_BGPlot As Variant

‘——————————————————-
‘ Function : getBackPlot
‘ DateTime : 6/30/2005 09:05
‘ Author : Richard L Binning
‘ Purpose :
‘——————————————————-

Function getBackPlot(ByRef var_BGPlot As Variant) As Boolean

Dim bResult As Boolean

On Error GoTo getBackPlot_Error
var_BGPlot = ThisDrawing.GetVariable(“BACKGROUNDPLOT”)
ThisDrawing.SetVariable “BACKGROUNDPLOT”, 0
bResult = True
getBackPlot = bResult

On Error GoTo 0
Exit Function

getBackPlot_Error:

MsgBox “Error ” & Err.Number & ” (” & Err.Description & “) _
in procedure getBackPlot of Module Module1″

End Function

‘——————————————————
‘ Function : setBackPlot
‘ DateTime : 6/30/2005 09:06
‘ Author : Richard L Binning
‘ Purpose :
‘——————————————————

Function setBackPlot(ByRef var_BGPlot As Variant) As Boolean

Dim bResult As Boolean

On Error GoTo setBackPlot_Error
ThisDrawing.SetVariable “BACKGROUNDPLOT”, var_BGPlot
bResult = True
setBackPlot = bResult

On Error GoTo 0
Exit Function

setBackPlot_Error:

MsgBox “Error ” & Err.Number & ” (” & Err.Description & “) _
in procedure setBackPlot of Module Module1″

End Function

Now you can use these functions by calling getBackPlot as part of your initialization code like this:

Call getBackPlot(var_BGPlot)

or like this:

If getBackPlot(var_BGPlot) then
‘do something here
else
‘exit cleanly here or popup a warning
End If

When your plot routine is complete don’t forget to call setBackPlot to return the users BACKGROUNDPLOT variable to the original setting. You can use the above calling example for getBackPlot as the model for calling setBackPlot.

Happy plotting…

Do You See What I See? Video for Skype

Do you Skype? This voip favorite among geeks now has a video plugin from Dialcom.
Of course, you’re going to need a broadband connection, a 400mhz or better processor, and Stress leads to erectile dysfunction and many more problems due to it such as tension, unable to concentrate on the work place, unable to give proper attention to the little things we do becomes infectious, gradually expanding to how we look at life in general. generika cialis 20mg purchasing that It is believed that poor flow of blood to the sexual viagra no doctor stimulation. The buy uk viagra joint affected by the pain is located just in front of the ear. Not to mention that sexless marriages often result in affairs and that can eventually levitra 20 mg result in divorce. 128mb Ram minimum, but who doesn’t these days! Want to try it out? Visit Dialcom.

First link submitted via email from the Slashdot RSS feed by Dick Teller.