Hello,
I have a Lisp that will bring up a dialogue and let users pick a page side and will pull in a page setup from a template file.
It works well except if there is already a pagesetup with the same name in the file.
What I am looking to do is check if the page setup name exists in the file, and itf it does delete it.
Does anyone know how to do this?
I got it.
for those looking for it:
(defun psdel ( / appAcad colPgSetups docCurrent objPgSetup)
(vl-load-com)
(setq appAcad (vlax-get-acad-object)
docCurrent (vla-get-ActiveDocument appAcad)
colPgSetups (vla-get-PlotConfigurations docCurrent)
)
(vlax-for objPgSetup colPgSetups
(if (= (vla-get-name objPgSetup) psname) (vla-delete objPgSetup))
(vlax-release-object objPgSetup)
)
(vlax-release-object colPgSetups)
(vlax-release-object docCurrent)
(vlax-release-object appAcad)
(princ)
)
where psname is the name of the pagesetup
@spm5 wrote:....
What I am looking to do is check if the page setup name exists in the file, and itf it does delete it.
....
[I'm not sure about Page Setups, but I wonder whether you couldn't just delete it, without checking whether it exists already. I know you can do that with certain other things, such as Views and Layouts. If the one you ask to delete isn't there, a message goes by that it didn't find one with that name, but it doesn't cause an error, or interfere with anything that follows.]