- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello everybody,
I want to import one or more page setups into a drawing. It is easy to import them with the "-psetupin" command. But how can I make the imported page setup current?
I found some lisp files on the internet but they doesn't work if I combine these..
The first part of the lisp shall remove all the excisting page setups in the drawing and, after that, it's shall import the specific page setup I want to make current for the layout. But after importing this page setup, I need to make it current manually. It must change automatically.
The lisp file has to do the following steps in this order;
- Delete all the created page setups in the drawing:
(vl-load-com) (vlax-for pc (vla-get-plotconfigurations (vla-get-ActiveDocument (vlax-get-acad-object))) (vla-delete pc) )
- Import the specific page setup for the current layout you'll see on your screen.
(command "._-PSETUPIN" "C:/Users/myself/AppData/Roaming/Autodesk/AutoCAD 2015/R20.0/enu/Plotters/PAGE_SETUP_PDF.dwg" "example1")
- Make the imported page setup current. If you have more layouts, you must switch to the other for make another or the same page setup current. (maybe is it possible to add a function which will let you choose "make this page setup current for "All" or "Current Layout only")
;; Set multiple layouts to a page setup (defun c:-MPageSetup (/ PS-Lst PS Tabs TabSel str val) ;; Get the Layout Tabs to be changed (setq Tabs (Get-Obj-Names (Get-Tab-Col))) (princ "\n\nAvailable Layout Tabs: ") (foreach str Tabs (princ str) (princ " | ") ) (setq TabSel nil str nil) (while (and (not str) (setq str (vl-string-trim " \t\n" (strcase (getstring t "\nSelect the tabs you wish to apply the setup to [*=All; or Add each in turn; blank to stop]: "))))) (cond ((= str "") (if (not TabSel) (setq TabSel Tabs))) ((= str "*") (setq TabSel Tabs)) ((setq val (member str Tabs)) (setq TabSel (cons (car val) TabSel) str nil)) (T (princ (strcat str " is not an available Tab Name\n")) (setq str nil)) ) (princ "Selected Tabs: ") (if TabSel (foreach val TabSel (princ val) (princ " | ") ) ) ) (setq PS-Lst (Get-Obj-Names (Get-PS-Col))) (princ "\n\nAvailable Plot Setups: ") (foreach str PS-Lst (princ str) (princ " | ") ) (setq PS nil str nil) (while (and (not str) (setq str (vl-string-trim " \t\n" (strcase (getstring t "\nSelect the Setup you wish to apply: "))))) (cond ((setq val (member str PS-Lst)) (setq PS (car val))) (T (princ (strcat str " is not an available Setup\n")) (setq str nil)) ) ) (princ (strcat "\nAbout to assign " PS " to " (vl-prin1-to-string TabSel))) (MpageSetup TabSel PS) (princ) )
- Delete all the imported page setups in the drawing. (code first step)
If I create a new command/ lisp (defun C:PSN .........) by following these codes. It doesn't work. But if I load more lisp files, with only 1 code, there are no problems. I only have to select the layout if I use the -mpagestup command.
I want to create a toolbar with several buttons for different page setups for the (current) layout(s).
for example: One for make the "example1" page setup current for the current layout, one for "example3" and "example4" for all the layouts.
Who wants to help me?
Solved! Go to Solution.