AUTOMATIC PURGE UPON OPENING A DWG.

AUTOMATIC PURGE UPON OPENING A DWG.

cory
Enthusiast Enthusiast
3,132 Views
15 Replies
Message 1 of 16

AUTOMATIC PURGE UPON OPENING A DWG.

cory
Enthusiast
Enthusiast

Im using AutoCad 2016 and opening drawings that were created in an old (like 2004) version of autocad.  I want to open these drawings as I need them and save them according to my new template standards.  Is there a way I can get set up to automatically purge a drawing just by opening it?  After that, can I automaticaly run a "Standards check" or will I always have to initiate the process?

0 Likes
Accepted solutions (1)
3,133 Views
15 Replies
Replies (15)
Message 2 of 16

scot-65
Advisor
Advisor
Inside S::STARTUP is one possible method.

(repeat 3 (command "._purge" "All" "" "No"))
(c:StandardsCheck)
(princ)

???

Scot-65
A gift of extraordinary Common Sense does not require an Acronym Suffix to be added to my given name.

0 Likes
Message 3 of 16

Satoews
Advocate
Advocate
Accepted solution

This work?

 

(defun-q s::startup ()
(repeat 3
(command
"_.purge" "all" "" "no")
)
(command
"standardscheck")
(princ)
)

Do you know how to save this as a lisp file and get it into your startup suite? (this will effect every drawing you open up).

 

otherwise

 

(defun c: psc ()
(repeat 3 (command "_.purge" "all" "" "no") ) (command "standardscheck") (princ) )

 

With this you would have to go into a drawing and type in psc.

 

edit: fixed an error with both codes.

 

Shawn T
0 Likes
Message 4 of 16

cory
Enthusiast
Enthusiast

I am fairly new to managing Autocad.  I have been an everyday user for 6 years but have basically been going through the motions of what I was taught.  I now am in charge of updating our engineering department and keeping our autocad current.

 

To answer your question... No I dont know how to save as a lisp file get into the startup suite.  I have heard of it but never done it.  I am learnig fast and am very impressed with the help that is available.  (Thank you!) 

Eventualy all of our drawings that were created in Autocad 2004 will be updated.  Is there a reason anyone can think of NOT to automatically purge a drawing when it is opened?  Keeping in mind that we will also be opening new drawings that have already been standarized.  Maybe it should be initiated after the drawing is open?  My challange with this would be that I have three other engineers accessing drawings.

0 Likes
Message 5 of 16

dgorsman
Consultant
Consultant

I'm not a fan of automatically changing a drawing just by opening it.

 

Purging is something of a grey area compared to, say, changing layer settings.  I would assume you have a standard set of layers and text styles for the drawings.  If they are purged every time the drawing is opened, then those items need to be added if needed later.  I'd advocate for a slightly more intelligent system which leaves your stuff alone, and only tries to remove that which shouldn't be there.  If you don't have *everything* automated for layer control, text style control, etc. then the users will have to keep adding the missing items before they do something.  If its just there to begin with there's less temptation to get creative, and less frustration at having to stop/add/work, stop/add/work, etc.

----------------------------------
If you are going to fly by the seat of your pants, expect friction burns.
"I don't know" is the beginning of knowledge, not the end.


0 Likes
Message 6 of 16

scot-65
Advisor
Advisor
Nice input.
If I had to add a comment it would be something like this:

IF a user commits to making changes to a file as opposed to
opening it (per-say "read-only"), then the first occurrence of
"QSave" would be a good place to instill a "File Maintenance"
program/script.

🙂

Scot-65
A gift of extraordinary Common Sense does not require an Acronym Suffix to be added to my given name.

0 Likes
Message 7 of 16

Satoews
Advocate
Advocate

This dose a pretty good job at explaining how to put lisps into the start up suite.

 

Before you start this though whatever code you choose copy and paste the code into notepad and save it as a "anything.lsp"

 

http://lee-mac.com/autoloading.html

 

I am honestly not too familiar with the purge command but judging from other posters I would advise against loading this lisp by default for everyone. So there are a few options:

 

  • Use the command version of the code. this will save you a few button clicks.
  • If you update your old files in batches you can always add the lisp to the start up suite and remove it when done.
  • Finnally you can figure out a way to not activate the lisp unless it meets conditions that will omit when it will have potential problems.

         This is a bit out of my range but it could be a possiblility to give the lisp a if statement to only activate when it hits an older file type. The link below          was messing around with getting the file types with lisps.

 

http://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/checking-drawing-version/td-p/1893492

Shawn T
0 Likes
Message 8 of 16

cory
Enthusiast
Enthusiast

This is good stuff.  Thank you for your input.  I do have a good template with standard layers and text styles.  Through the advise of another user I created a block that contains these layers and styles and nested that block inside of our company logo on the layout sheet.  Many of our old drawings are cluttered with un-used layers, text and dimension styles.  When I open an old drawing in our new autocad environment and purge it, most of the old stuff goes away and the new stuff nested in the block is being used so it is not purged.  I then do a standards check (which is also new to me but Im working on it) to replace the old with the new standards.  I'm confident that I can find a way to do this and be fairly efficient at it, but the easier it is the more likely my co-workers will do it.  A new drawing will not be a problem, but we use many old drawings as templates to modify for new parts.  We are going to pick a day and say from this day forward we are all upgraded to autocad 2016 and we are all utilizing company wide drawing standards.  Im trying to get ready for that.  Oh yea most of my dimension styles and blocks are being pulled from pallets which I can export and import to other computers (good...bad?)

By the way I had to laugh when you wrote about the "temptation to get creative".  That is how we have described our engineering department for the last 25 years.  Smiley Frustrated 

Any other suggestions would be greatly appreciated.

0 Likes
Message 9 of 16

Anonymous
Not applicable

Would it be acceptable to run the purge only when saving the drawing instead of every time it's opened? I think my installation of Civ 2014 is screwed up because it always generates database errors if drawings are not purged before saving. As a result, all of my drawings do a partial purge before saving.

 

(defun c:command_name()
(command "_.zoom" "e")
(command "-purge" "r" "*" "n")
(command "_.qsave")
(command "_.close")
(princ) ;/silent exit
)

 

It works great so far. Mine is just purging registered applications (-purge r), but you can purge anything. Absolute hack and slash would be -purge all.

0 Likes
Message 10 of 16

cory
Enthusiast
Enthusiast

This is what I would like to try but I cant get it to work the way you have it typed.  I just copy and pasted then loaded this into the startup.  Should it purge when I hit "file" save?  or do I need to type something? wait for an automatic save? I am using Autocad 2016.  Any pointers?

0 Likes
Message 11 of 16

Satoews
Advocate
Advocate
IT WOULD RUN WHEN YOU TYPE IT IN THE COMMAND LINE "COMMAND_NAME" AT THE MOMENT TRY THAT IT SHOULD ZOOM EXTENTS PURGE QSAVE THEN CLOSE.
Shawn T
0 Likes
Message 12 of 16

Satoews
Advocate
Advocate
(defun c:purge_save()
  (command 
     "_.zoom" "e"
     "-purge" "r" "*" "n"
     "_.qsave"
     "_.close")
  (princ)
)

(defun c:psa()
  (c:purge_save)
)

Try this, you can use either "purge_save" or "psa" to activate the code.

 

Shawn T
Message 13 of 16

cory
Enthusiast
Enthusiast

Works perfectly! Thank you.  My new drawings are now purged and saved as I need  them.  I believe the only project I have left is to figure out how to open an old drawing and have all of my standard drawing properties automaticaly inserted into it.  Standards check maybe? Can I automaticaly open an old drawing into my new .dwg template without physically copy and pasting then doing a save as?

0 Likes
Message 14 of 16

cory
Enthusiast
Enthusiast

I got ahead of myself.  You shared a .lsp with me on how to automaically run standards check.. I got that and it works good.  Can I make all font styles automacialy "fix" and use my standard font without stepping through each one?  Can I do the same for layers and so on?

0 Likes
Message 15 of 16

scot-65
Advisor
Advisor
>>how to open an old drawing and have all of my standard drawing properties automaticaly inserted into it

(command ".INSERT" <your template or standard drawing> 0,0 "" "" "")
(command ".Erase" (entlast) "")

If you have font issues, open the template, insert the "old" file (exploded)
and do a Save As...

???

Scot-65
A gift of extraordinary Common Sense does not require an Acronym Suffix to be added to my given name.

0 Likes
Message 16 of 16

Satoews
Advocate
Advocate

Automating the standards checker from the looks of it is a tall task, I am wondering though if we can use this type of code to change to the layers/text before hand. 

 

Drawing Clean Up.

 

Also this kind of problem would probably do best as a new post. Use the code that has gotten us this far and post a new thread stating the problem and what your trying to accomplish.

 

thanks!

 

Shawn 

 

 

Shawn T