PDA

View Full Version : How to change a printer setup on a layout tab


dfuehrer
2008-02-27, 09:11 PM
Hello everyone,

I am faced with a challenge (to me anyway). Here are my job I have reciently changed locations, and thus my networked printers have changed. Here's the problem. We have literally hundreds and hundreds of drawing files that I use on a regular basis that are now mapped to the wrong printer because they are set that way in the Pagesetup Manager.

I have been attempting to write some code that I can at least run on a drawing by drawing basis, to change this setup. So far, no luck. There are a couple of other considerations here too. There may be portrait or landscape layouts, as well as multiple layout tabs within the same drawing.

I received some help a while ago here, on another routine that used visual basic to search the individual drawing for a named layout tab that *might* be named this, or that. I have attemped to use this as a basis for what I am writing now, but no joy. When I run what I have, I get: ; error: no function definition: VLAX-GET-ACAD-OBJECT. here is my code for the vertical (portrait) orientation.

(defun c:cpv ()

(command "cmdecho" "0")

(setq ActDoc (vla-get-ActiveDocument (vlax-get-Acad-Object)))
(vlax-for lo (vla-get-Layouts ActDoc)
(setq LoName (vla-get-Name lo))
(if
(and
(vl-string-search "11" LoName)
(vl-string-search "17" LoName)
(vl-string-search "Vertical" LoName)

)
(vla-put-ActiveLayout ActDoc lo)
)
)


(command "-plot" "Y" "11x17 Vertical" "\\PRNSRV13\LN1016826" "Ansi B 11 x 17 in" "inches" "portrait"
"no" "layout" "1:1" "0.00,0.00" "no" "" "yes" "no" "no" "no" "yes" "no")

(command "cmdecho" "1")

(princ)
)

Anyone have any ideas?? I'm in over my head...

Thank you in advance!

Don

Moderator Note:
How to use [ CODE ] tags... (http://forums.augi.com/misc.php?do=bbcode#code)

Ed Jobe
2008-02-27, 10:32 PM
Things like that always change. A better way is to store your standard in a template and then import the pagesetup/s into a dwg as you need to. To do that, go to page setup manager and click on the import button. You can search this forum for lisp routines that others have written for importing page setups. I have attached my vba solution.

dfuehrer
2008-02-28, 08:46 PM
Hi Ed,

Thanks for the reply. That really wasn't what I was after here. I am looking to come up with some sort of a lisp, that I can use a script file, and run it against an entire directory, and SAVE me lots of clicks with the mouse.

Don

RobertB
2008-02-28, 09:08 PM
No need to use LISP. You can do it all with a script, using the PSetupIn command. When you run the command from a script, you specify the template name at the command prompt. The file dialog will not appear.

dfuehrer
2008-02-28, 09:17 PM
Robert,

So will I need a template file for each orientation? Some of these have a portrait orientation, some are landscape. There are also some, but not all, that have multiple tabs in each drawing. So am I screwed here? Even a lisp that I could run inside each file would be faster than going through the Page setup manager in each drawing, on each tab. Help!

dfuehrer
2008-02-28, 10:36 PM
I just discovered a VBA routine called PageSetupUtil.dvb. It was on an old disk of utilities, and won't run in 2008, but I also have 2006 on my machine, so....

It seems to work OK. When run, it imports named page setups from multiple files within a folder, unlike Psetupin in 2008 that will only import into the current file open.

New question here. Is there an updat to this VBA routine out there that does run in AutoCAD 2008?

Thanks!

RobertB
2008-02-29, 12:12 AM
I just discovered a VBA routine called PageSetupUtil.dvb. It was on an old disk of utilities, and won't run in 2008, but I also have 2006 on my machine, so....

New question here. Is there an updat[e] to this VBA routine out there that does run in AutoCAD 2008?Who is the author of the code?

azarko
2008-02-29, 10:12 AM
look this http://www.theswamp.org/index.php?topic=12439.msg153420#msg153420
http://www.theswamp.org/index.php?topic=21651.0

Ed Jobe
2008-03-03, 05:34 PM
Hi Ed,

Thanks for the reply. That really wasn't what I was after here. I am looking to come up with some sort of a lisp, that I can use a script file, and run it against an entire directory, and SAVE me lots of clicks with the mouse.

Don

Robert,

So will I need a template file for each orientation? Some of these have a portrait orientation, some are landscape. There are also some, but not all, that have multiple tabs in each drawing. So am I screwed here? Even a lisp that I could run inside each file would be faster than going through the Page setup manager in each drawing, on each tab. Help!
Who said anything about lots of clicks or having to set each layout? All of that is programmable. I have mine set up so that I preconfigure which template to import from. Then I click on a toolbar button and everything is imported... a single click without a single prompt. This frees me from the tedium of having to process whole directories and even drives. I just update a file as I need to.