Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Set Current PageSetup

3 REPLIES 3
Reply
Message 1 of 4
Anonymous
1961 Views, 3 Replies

Set Current PageSetup

Could someone tweak this routine to...
1. use the preset pagesetup name "pdf 30x42" rather than prompting for the
name
2. use the current layout rather than prompting for All or Current

BTW - Thanks Jason P. for the usefull code
Ken


; 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)
(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 (layoutlist) (putPagesetup x page))
(putPagesetup (getvar "ctab") page)
)
(princ "\nFinished")
(princ)
)
3 REPLIES 3
Message 2 of 4
Anonymous
in reply to: Anonymous

You could just do

(putPagesetup (getvar "ctab") "pdf 30x42")


"kDispoto" wrote in message
news:6164843@discussion.autodesk.com...
Could someone tweak this routine to...
1. use the preset pagesetup name "pdf 30x42" rather than prompting for the
name
2. use the current layout rather than prompting for All or Current

BTW - Thanks Jason P. for the usefull code
Ken
Message 3 of 4
Anonymous
in reply to: Anonymous

[using acad2008]

If I use just this in the command line I get...

Command: (putPagesetup (getvar "ctab") "pdf 30x42")
; error: no function definition: PUTPAGESETUP

Or is (putPagesetup (getvar "ctab") "pdf 30x42") to be placed somewhere in
the larger code?
Message 4 of 4
Anonymous
in reply to: Anonymous

You still have to load the code for it to function. You just don't
need this defined command (defun c:psetup (/ lst page res).


"kDispoto" wrote in message
news:6165001@discussion.autodesk.com...
[using acad2008]

If I use just this in the command line I get...

Command: (putPagesetup (getvar "ctab") "pdf 30x42")
; error: no function definition: PUTPAGESETUP

Or is (putPagesetup (getvar "ctab") "pdf 30x42") to be placed somewhere in
the larger code?

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost