PDA

View Full Version : page setup import vlisp


David van Erk
2007-06-20, 09:58 PM
Hello there,

I've written a little routine that will selectively delete page setups (add as many as you like) from our drawings as soon as the drawing is loaded. This gets rid of faulty page setups (no pc3s) so that publisher won't keep looking for them and will now load faster.
Sooooo... now I've got setups that sometimes do and sometimes don't have the pc3 in there and I want to selectively replace these with the one from my template on the server.
- What is the command for import and how do I indicate both the path to the template and page setup name in one line? (or more if needed)
- Can "vla-put-..." do the same trick in replacing/updating the page setup. If so then still how do I indicate object path and name and tell it to update?
Let me know if you please.

David


(defun replace ()
(vl-load-com)
(vlax-for ps (vla-get-plotconfigurations
(vla-get-activedocument
(vlax-get-acad-object)
)
)
(if (= (strcase (vla-get-name ps))
(strcase "hpdj 1050c 19th Fl (standard 36 x 24)")
)
(vla-delete ps)
)
)
)

CAB2k
2007-06-20, 10:36 PM
This what I use. Add this lisp to your startup suite.
;; Function to delete all user plot set ups
(defun c:Del_Pagesetups (/ curdwg pslayout x)
(vl-load-com)
(setq curdwg (vla-get-ActiveDocument (vlax-get-Acad-Object))
pslayout (vla-get-Layout (vla-get-PaperSpace curdwg))
)
;; Call RefreshPlotDeviceInfo before GetPlotDeviceNames
(vla-RefreshPlotDeviceInfo pslayout)
(vlax-for x (vla-get-Plotconfigurations curdwg)
(vla-delete x)
)
(princ)
)

Add this to one of your buttons.
^C^CDel_Pagesetups;^C^C.-PSETUPIN "PageSetups.dwg" "*"

Another routine i use is the one attached.