Riddlez Posted November 14, 2008 Posted November 14, 2008 Hi all! After getting past my last problem with viewports, I have now come across a weird problem/ occurance when trying to edit my page sizes. What I currently have is a part of my code that assigns a new page configuration: Set plotconfig = acaddoc.PlotConfigurations.Add("Setup 1") plotconfig.ConfigName = "None" plotconfig.CanonicalMediaName = "ARCH_D_(24.00_x_36.00_Inches)" 'acaddoc is an external reference to the drawing, i.e. ThisDrawing.Blah Later on I call my page config as the following and then move and resize my viewport: acaddoc.ActiveLayout = clayout clayout.CopyFrom plotconfig clayout.Regen 'clayout=current layout For i = 1 To clayout.Block.count - 1 acaddoc.mspace = False Set Entity = clayout.Block.Item(i) If TypeOf Entity Is AcadPViewport Then Set PVport = Entity PVport.Display True PVport.Height = VPheight PVport.Width = VPwidth VPcenter = PVport.Center VPcenter(0) = TitleIPx + distfromx + 0.5 * VPwidth VPcenter(1) = TitleIPy + distfromy + 0.5 * VPheight VPcenter(2) = 0 PVport.Center = VPcenter acaddoc.mspace = True 'lower left corner of the zoom window LLCZ(0) = (counter - 1) * Targetwidth LLCZ(1) = 0 LLCZ(2) = 0: 'upper right corner of the zoom window UPCZ(0) = (counter) * Targetwidth UPCZ(1) = Targetheight UPCZ(2) = 0: acadapp.ZoomWindow LLCZ, UPCZ acaddoc.mspace = False End If Next My problem is that when the code is done, the Viewport is in the 'right' place, but the page below it is not. i.e. the corner is the right coordinate, but when the page size was refreshed it changed it's origin. To further try and clarify: if I go into the layout and manually insert a block, and specify that the block be inserted to point (0,0,0), it is placed off of the white space in the layout. Additionally, when I move my cursor over the insertion point specified on the block (i.e. it's lower left corner of a rectangle) then it says that its current position is negative. I can try to make some pictures if needed. Thanks in advance! Riddlez. Quote
Riddlez Posted November 14, 2008 Author Posted November 14, 2008 One other clarification: I am trying to do the equivalent of going into a word document and changing the pagesetup property to Landscape, Size ARCH D 24x36, where the page is the white 'background'/page that is always in a layout (the printable area?). Riddlez Quote
borgunit Posted November 14, 2008 Posted November 14, 2008 Just an FYI, some page setups (the "white background" like a print preview) is determined by what the printer driver will allow. Some demand a "margin" and cannot truly be set to the outer border while others can. I do not know if this is your case or not. I wrote something in VB to do what you are asking but the paper sizes must be "pre-arranged" to removed margins and have exact sizes. Quote
Riddlez Posted November 14, 2008 Author Posted November 14, 2008 I think I know what you are talking about to some extent. Some context first: I am trying to duplicate the following steps to set up my page: 1. Go to the plotter manager and select Modify for the current layout 2. Set the Printer to none so that you can do step 3 3. Set the page size to "ARCH_D_(24.00_x_36.00_Inches)" in order to force the white background to be the aformentioned pagesize 4. Apply settings and press ok. 5. Go back to plot manager and make a setup with the printer and prefered printer size To sum it up: Make the white background "ARCH_D_(24.00_x_36.00_Inches)" and the print it off on, for say, "Tabloid_(11.00_X_17.00_Inches). Regarding your FYI, borgunit, I bypass what my printer can do and then print off the layout as a "FitToSize," "Centred," and "Extents" Printout. I hope that clarifies it a bit more. Some more detail on my problem: When my program finishes, the entire layout has a white background. If I place any objects into that layout (BEFORE) and leave the layout to go to another, the white space is turned back into a page with the extents of the viewport and objects shrunk to fit to the given page size(AFTER). Before: After: If I specify the insertion point of a new object, it will always put the object at the same point that is not the lower left corner of my page/white space. Frustrating. Riddlez. Quote
Riddlez Posted November 14, 2008 Author Posted November 14, 2008 So this part of my code is part should be tossed in the trash: acaddoc.ActiveLayout = clayout clayout.CopyFrom plotconfig clayout.Regen 'clayout=current layout Replace it with: clayout.ConfigName = "None" clayout.CanonicalMediaName = "ARCH_D_(24.00_x_36.00_Inches)" acaddoc.Regen acAllViewports clayout.PlotType = acExtents clayout.CenterPlot = True clayout.StandardScale = acScaleToFit AND toss the next part in after the for loop: clayout.ConfigName = "[url="file://LAN/PrinterSomeWhereInTheEther"]\\LAN\PrinterSomeWhereInTheEther[/url] " clayout.CanonicalMediaName = "Tabloid" Now I get something close to what I want. The page setup is all done the way I want, however, the white space keeps resizing to something undesireable. ...I'll keep on experimenting... Riddlez. Quote
SEANT Posted November 15, 2008 Posted November 15, 2008 I'm not sure if this plays a part in anything, but it might be something to consider. From the Developer Docs: Quote
Riddlez Posted November 18, 2008 Author Posted November 18, 2008 Thanks for that note SEANT, but I had already checked that out. I solved(/got around) my problem by just applying the printer to "none" and the page size to Arch D in order to get the 'white space' in the layout to resize. The respective lines of code would be: 'clayout is an object refering to some layout clayout.ConfigName = "None" clayout.CanonicalMediaName = "ARCH_D_(24.00_x_36.00_Inches)" Then I just embeded a new plot config into the dwg file so taht I can use it to publish all of the layouts. I used the the following code: Dim acaddoc As Object 'the autocad document that is being opened Dim plotconfig As Object 'the object of the generated plot config Set acadapp = _ GetObject(, "AutoCADLT.Application") 'ACAD must be open Set acaddoc = acadapp.ActiveDocument Set plotconfig = _ acaddoc.PlotConfigurations.Add("PLOT CONFIG NAME") plotconfig.ConfigName = "[url="file://\\SomePrinterOnMyLAN"]\\SomePrinterOnMyLAN[/url]" plotconfig.PlotType = acExtents plotconfig.CenterPlot = True plotconfig.StandardScale = acScaleToFit plotconfig.CanonicalMediaName = "Tabloid" plotconfig.StyleSheet = "123456abcd.ctb" A note regarding CanonicalMediaName: the string that is entered is as shown in the slide down menu in the plot or plot setup manager window. However all spaces must be represented by an underscore ("_"), at least from my experiements with it. I hope this helps anyone else who has been trudging along internet forums wondering how to figure this out or automate some boring layout setups, Riddlez. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.