View Full Version : Pagesetup SetCurrent
emanski
2011-05-26, 07:03 AM
I need some help, I have thousand of drawings & it has pagesetup (model space) in each drawing...only i want to do is to make it all current to the pageset that i've made (not 1 by 1 :( ) using VBA or Lisp...im sick of looking for a solution....any idea? i know there is.
nextvkin
2011-05-29, 08:18 AM
You can use the Sheet Set Manager & assign your page setup to publish selected drawings.
emanski
2011-05-29, 02:39 PM
unfortunately all of the title blocks are in model space....not in the layout...
arshiel88
2011-05-30, 11:54 AM
See if this will help. Check attached vba project.
1. Open the drawing on where you want to copy from the page setup.
2. Command: Plot, in the Page Setup group, click "Add" to save the Page Setup and give it a name, otherwise it will not be available in the choices. Click cancel to close the Plot Dialog.
3. VBALOAD the attached dvb file, and Enable Macros.
4. VBARUN the ApplyPageSetup Macro
5. Select Page Setup from the Drop-down list.
6. Add Drawings, then apply page setup.
Tested on AutoCAD 2008, 32-bit.
irneb
2011-05-30, 03:10 PM
unfortunately all of the title blocks are in model space....not in the layout...Unfortunately that's the major reason behind paperspace - it makes these multiple plot / DWF / PDF / etc so much easier.
Are all these TB's in the same spot in MS? Are they all to the same scale? If not you'll have to start looking at Lisp - and then only if the TB is an actual block, otherwise it's going to be extremely difficult to perform a "batch" print.
If it is a block, then you could have a lisp looking through the DWG for the relevant TB's name, find its DXF data / vla-object and see what the scale it supposed to be. Then do a command-line plot-window of the TB to whatever your printer is named. Once you've got a lisp which works for a single DWG then run it through ScriptPro / AutoScript on multiple DWGs.
emanski
2011-05-31, 04:32 AM
See if this will help. Check attached vba project.
1. Open the drawing on where you want to copy from the page setup.
2. Command: Plot, in the Page Setup group, click "Add" to save the Page Setup and give it a name, otherwise it will not be available in the choices. Click cancel to close the Plot Dialog.
3. VBALOAD the attached dvb file, and Enable Macros.
4. VBARUN the ApplyPageSetup Macro
5. Select Page Setup from the Drop-down list.
6. Add Drawings, then apply page setup.
Tested on AutoCAD 2008, 32-bit.
its working men! this is what i want...its a relief! its works in ACAD 2010 aswell...thanks!
arshiel88
2011-05-31, 05:57 AM
You're welcome. I'm glad it helped.
mhannan.100562
2011-09-23, 01:54 PM
Has anyone tried this on AutoCAD 2012 64 bit?
I keep running into an error at
" .hwndOwner = ThisDrawing.HWND."
Matt
arshiel88
2011-09-23, 02:38 PM
Just replace it with Thisdrawing.HWND32
mhannan.100562
2011-09-23, 03:24 PM
I changed it, but now it won't even load the dialog box. It shows up and then disappears.
Sorry it did let me add drawing files, but when I went to apply the pagesetup, it gave me run-time error of Invalid object type, and the debug stop at this line: ThisDrawing.Layouts("Model").CopyFrom PlotConfig
I'm also trying to use this on "Paperspace" "Layout" tabs.
Matt
irneb
2011-09-23, 04:37 PM
There are some problems with VBA in newer ACads, especially on 64 bit. The object ID's seem to be larger numbers (64bit integers instead of 32 bit ;)). It seems in this scenario, you've run into a situation where the VBA just causes issues.
Perhaps you could try to use some lisp instead. Here are a few threads showing some useful routines:
Zooming & Orientating the UCS to a selected TB in model space: http://forums.augi.com/showthread.php?t=94760
A lisp script to plot numerous TB's in the same model space (see post #13): http://www.cadtutor.net/forum/showthread.php?59069-Plotting-suggestions-Easy-way-to-print-100s-of-sheets
Sample of getting any object's bounding box to use a window to plot (see post #4): http://www.cadtutor.net/forum/showthread.php?54496-Pick-a-specific-block-in-Autocad
Or if you want to go a further route, try translating that VBA into a Lisp, or going even further try VB.Net instead.
Or you could use some other programs like AutoWisePlot (http://www.awpsoft.com/) (it's not free though). I haven't used it, simply got it from google. The author states it works on acad 2000-2010, so I'm not sure if it would work on 2011/12 and/or 64bit. There might be others in a google search. Though I'm not going to list them all :mrgreen:.
arshiel88
2011-09-23, 04:50 PM
I changed it, but now it won't even load the dialog box. It shows up and then disappears.
Sorry it did let me add drawing files, but when I went to apply the pagesetup, it gave me run-time error of Invalid object type, and the debug stop at this line: ThisDrawing.Layouts("Model").CopyFrom PlotConfig
I'm also trying to use this on "Paperspace" "Layout" tabs.
Matt
Its working fine on my end. As well as applying to paper space layouts.
It seems that the Invalid object type error occurs when you try a plot configuration saved from Model space to be applied on a Paper space layout. I guess they are not applicable. You can confirm it when you make a plot manually, the page setup saved from the model space is not available from the drop-down list of page setups.
mhannan.100562
2011-09-23, 06:17 PM
There are some problems with VBA in newer ACads, especially on 64 bit. The object ID's seem to be larger numbers (64bit integers instead of 32 bit ;)). It seems in this scenario, you've run into a situation where the VBA just causes issues.
Perhaps you could try to use some lisp instead. Here are a few threads showing some useful routines:
Zooming & Orientating the UCS to a selected TB in model space: http://forums.augi.com/showthread.php?t=94760
A lisp script to plot numerous TB's in the same model space (see post #13): http://www.cadtutor.net/forum/showthread.php?59069-Plotting-suggestions-Easy-way-to-print-100s-of-sheets
Sample of getting any object's bounding box to use a window to plot (see post #4): http://www.cadtutor.net/forum/showthread.php?54496-Pick-a-specific-block-in-Autocad
Or if you want to go a further route, try translating that VBA into a Lisp, or going even further try VB.Net instead.
Or you could use some other programs like AutoWisePlot (http://www.awpsoft.com/) (it's not free though). I haven't used it, simply got it from google. The author states it works on acad 2000-2010, so I'm not sure if it would work on 2011/12 and/or 64bit. There might be others in a google search. Though I'm not going to list them all :mrgreen:.
I would love to translating this into VB.Net if I knew anything about how to go about that. My level of programming is pretty basic.
I guess I don't understand why page setups can't be stored like a CTB file are stored.
Matt
tbingaman.94615
2012-05-07, 05:56 PM
Its working fine on my end. As well as applying to paper space layouts.
It seems that the Invalid object type error occurs when you try a plot configuration saved from Model space to be applied on a Paper space layout. I guess they are not applicable. You can confirm it when you make a plot manually, the page setup saved from the model space is not available from the drop-down list of page setups.
I was trying to get this project to run on acad 2010 64 bit and kept getting an error on this line of code:
"ThisDrawing.PaperSpace.Layout.CopyFrom PlotConfig"
All drawings the title block is in paper space. the Layout tabs are named differently in each drawing. Any further help on this would greatly be appreciated!
arshiel88
2012-05-08, 02:28 PM
I was trying to get this project to run on acad 2010 64 bit and kept getting an error on this line of code:
"ThisDrawing.PaperSpace.Layout.CopyFrom PlotConfig"
All drawings the title block is in paper space. the Layout tabs are named differently in each drawing. Any further help on this would greatly be appreciated!
Are you trying to apply a plot configuration to ALL paper space layouts?
First, make sure the "PlotConfig" is for paper space layouts.
Then, iterate all the layouts and make sure it is not the model layout.
Dim xLayout As AcadLayout
If PlotConfig.ModelType = True Then Exit Sub
For Each xLayout In ThisDrawing.Layouts
If xLayout.Name <> "Model" Then
xLayout.CopyFrom PlotConfig
End If
Next
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.