Author Topic: Globally change page setups?  (Read 1372 times)

0 Members and 1 Guest are viewing this topic.

Birdy

  • Guest
Globally change page setups?
« on: January 19, 2009, 02:45:20 PM »
I have a file with 20 or so layouts.
Each layout has maybe a dozen named page setups.
Is there a way to change the page setup in all the layouts at once, rather than doing each one at a time? :ugly:

Matt__W

  • Seagull
  • Posts: 12955
  • I like my water diluted.
Re: Globally change page setups?
« Reply #1 on: January 19, 2009, 02:51:12 PM »
Code: [Select]
; Jason Piercey . May 16th, 2003
; assign a pagesetup to a layout
; [layout] - string, layout name
; [setup] - string, pagesetup to assign
; return: T or nil
(defun putPagesetup (layout setup / layouts plots)
(defun item-p (collection item)
(if
(not
(vl-catch-all-error-p
(vl-catch-all-apply
'(lambda () (setq item (vla-item collection item))))))
item
)
)
(and
(or *acad* (setq *acad* (vlax-get-acad-object)))
(or *doc* (setq *doc* (vla-get-activedocument *acad*)))
(setq layouts (vla-get-layouts *doc*))
(setq plots (vla-get-plotconfigurations *doc*))
(setq layout (item-p layouts layout))
(setq setup (item-p plots setup))
(not (vla-copyfrom layout setup))
)
)

(defun massoc (key alist / x nlist)
(foreach x alist
(if (eq key (car x))
(setq nlist (cons (cdr x) nlist))
)
)
(reverse nlist)
)


; Return: list of all pagesetups defined in the current drawing or nil
(defun getPagesetups ()
(massoc 3 (dictsearch (namedobjdict) "Acad_PlotSettings"))
)

; Jason Piercey . May 19th, 2003
; assign pagesetup to layout(s)
; LIMITED testing
; written for Shawn McDonald
(defun c:psetup (/ lst page res)
(command "-psetupin" "e:/plot.dwg" "PLOT")
(setq lst (mapcar 'strcase (getPagesetups)))
(while (not page)
(setq page (strcase (getstring T "\nspecify pagesetup to apply: ")))
(if (or (= "" page) (not (member page lst)))
(progn (princ "\npagesetup not found") (setq page nil))
)
)

(initget "All Current")
(if
(not
(setq
res
(getkword
"\n[All/Current]apply pagesestup to which layout(s) : ")))
(setq res "All")
)

(if (= "All" res)
(foreach x (vl-remove "Model" (layoutlist)) (putPagesetup x page))
(putPagesetup (getvar "ctab") page)
)
(princ "\nFinished")
(princ)
)
Autodesk Expert Elite
Revit Subject Matter Expert (SME)
Owner/FAA sUAS Pilot @ http://skyviz.io

Birdy

  • Guest
Re: Globally change page setups?
« Reply #2 on: January 19, 2009, 02:54:04 PM »
cool.
Thanks Matt.
Will give it a whirl.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Globally change page setups?
« Reply #3 on: January 19, 2009, 03:44:57 PM »
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

Atook

  • Swamp Rat
  • Posts: 1029
  • AKA Tim
Re: Globally change page setups?
« Reply #4 on: January 19, 2009, 04:15:29 PM »
I'm glad you guys have solutions to this. It seems like a huge undersight of Autodesk not to include it in the page setup manager..

Birdy

  • Guest
Re: Globally change page setups?
« Reply #5 on: January 19, 2009, 04:28:39 PM »
Thank You CAB.
That didn't turn up in my search.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Globally change page setups?
« Reply #6 on: January 19, 2009, 05:15:03 PM »
You're welcome. I had a space in the title that no doubt threw off the search.
I modified the title for future searches. :)
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.