Need help with printing using VBA

I am attempting to create a VBA routine, which will find all the titleblocks in modelspace and plot a window enclosing that titleblock.I can't find any good examples of printing from AutoCAD/BricsCad, and am just lost.I have found the following items in the Object Browser. the following,AcadLayout.SetWindowToPlot(LowerLeft, UpperRight)AcadPlotConfiguration.SetCustomScale(Numerator As Double, Denominator As Double)But, when I use the option to Complete Word (CNTL-SPACE) none of these appear. I find other similar choices, including;AcPlotScaleAcadApplication.ActiveDocument.PlotBricscadApp.AcadDocument.PlotAnyway, below is the code I currently have. But, get a compile error as noted below. I can assume that I already have the document in AutoCAD open and in modelspace.----------------------Dim LL(0 To 1) As DoubleDim UR(0 To 1) As DoubleDim MyPlotWindow(0 To 1)LL(0) = 0LL(1) = 0UR(0) = 158UR(0) = 228MyPlotWindow(0) = LLMyPlotWindow(1) = URAcPlotScale = 1/24AcadLayout.SetWindowToPlot = LL,UR ' VBA says it is expecting "end of ' statement" at the UR variableAcadDocument.PlotEnd Sub----------------------------I would greatly appreciate some advice.Joe Dunfee

Comments

  • This weekend we plan to release a new beta build V8.0.10. It will contain sample code for a batch printing tool. One version of the tool is implemented using COM (VB), a second version is implemented in LISP. Hope this will shed some light.Hans De Backer

  • Correction: unfortunately the sample code did not make it into V8.0.10. We will send it directly to you instead. It will be included in the next installer.

  • Of course, I thank Hans for the special attention he has given me by E-mailing me their example VBA code. But, am still having problems. The VBA example (A VBA batch plot utility) is just too complex for me to follow. I can't even find where the routine actually prints anything.Perhaps someone can help me with just one aspect. How can I set the plot scale? I see two methods.The first is a variable that I find when I use the "Complete Word" feature.AcPlotScale = 1/24But, when I compile the VBA code, it says the variable is not defined.So, I tried the other method I found in the Object Browser,AcadPlotConfiguration.SetCustomScale(1,24)VBA responds saying "Expected ="So, I tried AcadPlotConfiguration.SetCustomScale = (1,24)VBA highights the comma and says "Expected )"So, I triedAcadPlotConfiguration.SetCustomScale = (1)(24)Then VBA highlights the second "(" and says "Expected end of statement"Programming by guessing is obviously not getting me anywhere. What bit of understanding am I lacking?Joe Dunfee

  • Joe, without exactly knowing what you routine looks like here's a hint.Try:CALL AcadPlotConfiguration.SetCustomScale(1,24)or AcadPlotConfiguration.SetCustomScale 1,24 (Typical VB syntax, use a CALL and include brackets or ommit CALL and ommit brackets)Hope this helps,Arno van Eeuwen

  • I get a "Variable not defined" when I compile, and the word "AcadPlotConfiguration" is highlited in the code.Could this be related to the reference I've loaded? I have the following references loaded (they are listed in the order they are given;Visual Basic for ApplicationsBricscad App 1.0 Type LibraryOLE AutomationMicrosoft Forms 2.0 Object LibraryBricscad DB 2.3 Type LibraryJoe Dunfee

  • Apparently the example code you received will be included in the next V8 release. I can have a look at that when it's available. See if it makes sense to me. ;))TTYLArno van Eeuwen

This discussion has been closed.