Not sure if it helps as it looks the same to me, but this has always worked great:
Code:
; https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/purge-all-page-setup-names/m-p/830018#M55676
(defun DelPageSetup ( Name / Cfgs) ; by Jason Piercey - Autodesk Discussion Forum Moderator
(setq Cfgs
(vla-get-plotconfigurations
(vla-get-activedocument
(vlax-get-acad-object)
)
)
)
(cond
((vl-string-search "*" Name)
(vlax-for x Cfgs
(if (wcmatch (vla-get-name x) Name)
(vla-delete x)
)
)
)
(T
(vl-catch-all-apply
'(lambda () (vla-delete (vla-item Cfgs Name)))
)
)
)
(princ)
)
;; (DelPageSetup "*") to run or
;; (or DelPageSetup (load "DelPageSetup.lsp"))(DelPageSetup "*") to load if needed then run
To import an 11×17 layout deleting any existing Page Setups beginning with "11×17" and importing Page Setups "11×17" & "11×17 PDF" I use the macro:
Code:
^C^C^P(DelPageSetup "11×17*")(Steal (strcat (vl-filename-directory (getenv "QnewTemplate")) (chr 92) "AutoCAD Template" (chr 92) "Templates.dwt") (list (list "Page Setups" (list "11×17" "11×17 PDF"))))(Steal (strcat (vl-filename-directory (getenv "QnewTemplate")) (chr 92) "AutoCAD Template" (chr 92) "Templates.dwt") (list (list "Layouts" (list "11×17")))) .regen
I lean heavily on Lee Mac's Steal from Drawing code and others. While I've written a bit myself I don't feel the need to rewrite code others have already shared online.