Author Topic: How do I purge Page setups from a drawing?  (Read 3739 times)

0 Members and 1 Guest are viewing this topic.

hudster

  • Gator
  • Posts: 2848
How do I purge Page setups from a drawing?
« on: February 17, 2004, 11:25:36 AM »
I have a lisp I've written that imports the page setups into a drawing whenever i click on the plot button.  But some drawings already have them loaded when I open them.  I click purge but the setups are still loaded.

Does anyone know how I can purge them out of the drawing after I plot it?

Cheers
Andy
Revit BDS 2017, 2016, 2015, 2014, AutoCAD 2017, 2016, Navisworks 2017, 2016, BIM360 Glue

CADaver

  • Guest
How do I purge Page setups from a drawing?
« Reply #1 on: February 17, 2004, 11:48:44 AM »
The only way I know to delete them is through the plot dialog box.  Hit the ADD button and select the one you need ot delete, then pick DELETE.

But this begs the question, once you've imported them, why do you want to delete them?  Aren't you going to plot again someday?

hendie

  • Guest
How do I purge Page setups from a drawing?
« Reply #2 on: February 17, 2004, 11:54:21 AM »
can't you just close the dwg without saving ?

hudster

  • Gator
  • Posts: 2848
How do I purge Page setups from a drawing?
« Reply #3 on: February 17, 2004, 11:55:47 AM »
I want to delete them cause there are 50 of them, and when I use the command psetupin, it asks me 50 times if i want to reload this command, and it makes my plot routing hang.

So if i could delete them after i run the plot routine, I know they would plot fine unattended next time.
Revit BDS 2017, 2016, 2015, 2014, AutoCAD 2017, 2016, Navisworks 2017, 2016, BIM360 Glue

daron

  • Guest
How do I purge Page setups from a drawing?
« Reply #4 on: February 17, 2004, 11:56:56 AM »
Why not have a routine to setup the page when you run it, instead of importing the pagesetup?

hudster

  • Gator
  • Posts: 2848
How do I purge Page setups from a drawing?
« Reply #5 on: February 17, 2004, 12:04:29 PM »
I could do that I suppose.

But I'm one of those people who doesn't like to be beaten and I'm determined to find a way I can delete the page setups on Mass.
Revit BDS 2017, 2016, 2015, 2014, AutoCAD 2017, 2016, Navisworks 2017, 2016, BIM360 Glue

daron

  • Guest
How do I purge Page setups from a drawing?
« Reply #6 on: February 17, 2004, 12:17:32 PM »
Well, have fun. I don't deal with them, much.

SMadsen

  • Guest
How do I purge Page setups from a drawing?
« Reply #7 on: February 17, 2004, 12:18:08 PM »
Use at own risk:
Code: [Select]
(defun delPagesetups (/ pdict)
  (cond ((setq plotsetDict
              (cdr (assoc -1 (dictsearch (namedobjdict) "ACAD_PLOTSETTINGS"))))
         (while (setq pdict (dictnext plotsetDict (not pdict)))
           (initget "Yes No")
           (cond ((= "Yes" (getkword (strcat "\nDelete " (cdr (assoc 1 pdict))
                                       "? [Yes/No] <No>: ")))
                  (vla-delete (vlax-ename->vla-object (cdr (assoc -1 pdict))))
                 )
           )
         )
        )
  )
  (princ)
)


The pagesetups (.. plotsettings or plotconfigurations) are contained within a dictionary found in the NOB (named object dictionary). I guess the correct procedure for the above would be to get the Dictionaries collection from the active document then the plotsettings thingie and so on. Just didn't feel like writing a 100 line proc using ActiveX

Spageddie

  • Guest
How do I purge Page setups from a drawing?
« Reply #8 on: February 17, 2004, 06:07:35 PM »
:shock: I'm curious....why not just just have all the page setups in a template/prototype that way you don't have to import and delete at all. 8)

hudster

  • Gator
  • Posts: 2848
How do I purge Page setups from a drawing?
« Reply #9 on: February 18, 2004, 03:51:50 AM »
they are not all my page setups, some of them are specific to projects and are pre-loaded by other members of design team.

I just like to be sure that they are all set as they are meant to be.
Revit BDS 2017, 2016, 2015, 2014, AutoCAD 2017, 2016, Navisworks 2017, 2016, BIM360 Glue

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
How do I purge Page setups from a drawing?
« Reply #10 on: February 18, 2004, 08:12:43 AM »
Stig,
I was using this one I borrowed :)
I can't tell how this method differs from yours.
That is I don't understand the ActiveX stuff.

Code: [Select]
;;  Function to delete all user plot set ups
(defun Del_Plot_config_list (/ curdwg pslayout x)
    (vl-load-com)
    (setq
      curdwg   (vla-get-ActiveDocument (vlax-get-Acad-Object))
      pslayout (vla-get-Layout (vla-get-PaperSpace curdwg))
    ) ;_ end of setq
    ;; Call RefreshPlotDeviceInfo before GetPlotDeviceNames
    (vla-RefreshPlotDeviceInfo pslayout)
    (vlax-for x (vla-get-Plotconfigurations curdwg)
      (vla-delete x)
    ) ;_ end of vlax-for
  ) ; End Plot_config_list
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

SMadsen

  • Guest
How do I purge Page setups from a drawing?
« Reply #11 on: February 18, 2004, 09:47:40 AM »
Quote from: CAB

I can't tell how this method differs from yours.

It's better. Of course it differs directly by deleting all at once where my routine runs through each. But the point of 'better' is that plain AutoLISP sucks at handling some aspects of dictionaries. Not all - but some. And this is one of them.

hudster

  • Gator
  • Posts: 2848
How do I purge Page setups from a drawing?
« Reply #12 on: February 18, 2004, 10:50:58 AM »
I'm a complete noob at this.

How do i load cabs code into AutoCAD? :oops:
Revit BDS 2017, 2016, 2015, 2014, AutoCAD 2017, 2016, Navisworks 2017, 2016, BIM360 Glue

SMadsen

  • Guest
How do I purge Page setups from a drawing?
« Reply #13 on: February 18, 2004, 11:00:32 AM »
You generally don't load CABs or Se7ens code into AutoCAD - it'll create havoc  :D :D

Ok, ok, I'll be nice. Copy the code to a text editor or VisualLISP, save as file with extension ".lsp", return to AutoCAD and type (load "whateverfilename") at the command line.

Or, in VisualLISP, choose Tools->Load Text in Editor after having copied it to a document in VLIDE.

Then run by typing (Del_Plot_config_list)

hudster

  • Gator
  • Posts: 2848
How do I purge Page setups from a drawing?
« Reply #14 on: February 18, 2004, 12:11:25 PM »
cheers.

I got the bit about saving it as a lsp file, but it wouldn't load for me, does now, cool wee bit of code.

***edit***

I was forgetting to add the brackets to the load name.
Revit BDS 2017, 2016, 2015, 2014, AutoCAD 2017, 2016, Navisworks 2017, 2016, BIM360 Glue