TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: alanjt on July 22, 2008, 08:05:03 AM

Title: resetting existing pagesetups
Post by: alanjt on July 22, 2008, 08:05:03 AM
in our acaddoc.lsp file, we have a small routine that inserts a block (includes all dim settings/styles and page setups). the problem i've noticed is that if a page setup is modified, even though we have it delete all page setups at the beginning of startup, it will load the page setups, but the old settings will still be intact.
the only way i've noticed to get this back to normal, is to open the specific page setup through "pagesetup", open the pagesetup to modify, close it (don't have to make any changes) and it will reset all layouts that have that page setup to the way the are supposed to be.

any thoughts?

here's the code that inserts the block with pagesetups, etc.
Code: [Select]
(defun imdim ()
(progn
(command "-insert" "mbc-dimsetup.DWG=" nil)
(command "-purge" "b" "mbc-DIMSETUP" "n")
(prompt "\nMBC DimStyles Successfully Loaded!")
)
)
(imdim)

also, can you "tblsearch" for page setups?
Title: Re: resetting existing pagesetups
Post by: KewlToyZ on July 22, 2008, 08:37:37 AM
I've been helped by the folks here before with this.
You could fire this off before setting your current page setups:
Code: [Select]
(defun c:deletepagesetups()
(vl-load-com)
  (vlax-for ps (vla-get-plotconfigurations  (vla-get-activedocument  (vlax-get-acad-object)))
  (vla-delete ps)
)
(princ "\nPage setups reset!\n")
)
Title: Re: resetting existing pagesetups
Post by: ronjonp on July 22, 2008, 10:50:51 AM
Here's my version:

Code: [Select]
(defun c:del_pagesetups (/)
  (vlax-map-collection
    (vla-get-Plotconfigurations
      (vla-get-ActiveDocument
(vlax-get-Acad-Object)
      )
    )
    'vla-delete
  )
  (princ)
)
Title: Re: resetting existing pagesetups
Post by: alanjt on July 22, 2008, 12:55:31 PM
we have that, it and a purge all are among the first things that run on startup.
the problem is, even if you delete the page setup, once you reload it, if a layout was set to it before, it will just keep the old settings, but show that it's using the correct page setup.

Code: [Select]
(defun deleteAllPS ()
  (vl-load-com)
  (vlax-for ps (vla-get-plotconfigurations
               (vla-get-activedocument
               (vlax-get-acad-object)))
  (vla-delete ps)
  )
)
Title: Re: resetting existing pagesetups
Post by: KewlToyZ on July 22, 2008, 02:36:49 PM
Here is an example of what I run against a 30x42 paper space layout without removing the viewports.
Code: [Select]
(defun c:r30x42()
(prompt "\nDelete Old Page Setups !!!")
(vl-load-com)
  (vlax-for ps (vla-get-plotconfigurations
  (vla-get-activedocument
  (vlax-get-acad-object)))
  (vla-delete ps)
)
;(command "CTAB" "30x42")
(prompt "\nSetting 30x42 Plot to file Page Setups !!!")
(command "psetupin" "30x42.dwt" "Plot to File Full Size")
(command "psetupin" "30x42.dwt" "Plot to File Half Size")

(prompt "\nSetting default 30x42 full size Page Setup !!!")
(command "-plot" "n" (getvar "CTAB") "Plot to File Full Size" "Plot to File 30x42.pc3" "n" "y" "n")
(princ)
)
I maintain a dwt file for default page setups in my templates folder.
This seems to work everytime?