Jump to content

Delete only plot configs that contain specific word in name...


TheMadCADer

Recommended Posts

First off, Hello everybody. I'm a long, long, time guest, first time participant. Thanks for the many years of assistance, but I know have one I can not figure out.

 

Now to my problem...

We recently upgraded the plotter in our office and I created new named plot configs to work with the new plotter. I've successfully setup a LISP which automatically retrieves all named plot configs from a specific .dwt and updates or adds them to each drawing is opened.

 

The part I'm have trouble with is getting rid of the old named plot configs. I've found routines that delete all, but I'm looking for one that deletes only ones with a certain printer name in the named config.

 

ie.

I want it to automatically delete the following configs:

24x36-OceTDS400

36x48-OceTDS400

11x17-RICOH

8.5x11-RICOH

 

But leave the following alone:

24x36-hpT3500

36x48-hpT3500

11x17-LANIER

8.5-LANIER

 

So, a routine that deletes all named configs with "OCE" or "RICOH" in them but leaves all others alone would do the job. I've looked around quite a bit today and did not find anything that works quite like this. If anybody has something similar or could point me in the right direction, I'd be greatly appreciative.

 

Thanks Again!

Link to comment
Share on other sites

Welcome to CADTutor.

 

In AcadDoc.lsp, add a function that iterates the ActiveDocument Object's PlotConfigurations Collection, deleting those that match... Posting from an iPhone, and going from memory here, so forgive any code errors Haha:

 

(defun _DeletePlotConfigurations (acDoc)
 (vlax-for x (vla-get-plotconfigurations acDoc)
   (if (wcmatch (strcase (vla-get-name x)) "*OCE,*RICOH")
     (vla-delete x)
   )
 )
)

(_DeletePlotConfigurations (vla-get-activedocument (vlax-get-acad-object)))

 

 

... That will handle getting rid of unwanted named Page Setups, but setting one as active will require something like this:

 

http://forums.augi.com/showthread.php?80461-Page-Setup-Manager&p=1219546&viewfull=1#post1219546

 

(foreach layoutname (layoutlist)
 (vla-SetActivePageSetup layoutname “[color="red"]YourPageSetupName[/color]”)
)

 

 

... Both of which, will work with ObjectDBX.

 

 

Cheers

Edited by BlackBox
Link to comment
Share on other sites

Apparently I didn't look hard enough.

Thank you BlackBox. I too am mobile at the moment, but this looks to be exactly what I need. Ill post here again once I test it out and let you know if you've solved my problem.

Link to comment
Share on other sites

  • 1 month later...

BlackBox,

 

Thank you for your help last month. The code you provided help me clean up our plotting environment quite a bit. Requests for my assistance with plotting have dropped substantially also.

 

Thanks Again

Link to comment
Share on other sites

BlackBox,

 

Thank you for your help last month. The code you provided help me clean up our plotting environment quite a bit. Requests for my assistance with plotting have dropped substantially also.

 

Thanks Again

 

You're welcome, TheMadCADer; I'm happy to help. :beer:

 

Cheers

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...