Jump to content

need amendment to a "close" script


Recommended Posts

hi all, we have a script written by an ex employee which does some cleaning up of a drawing before closing it. The one thing it does which i dont want it to do, is delete every layer that doesn't have anything on it. Does anyone know how to modify this code so it does everything it currently does, but will NOT delete layers?

here is the code:

 

^C^C-PURGE;ALL;*;N;-PURGE;ALL;*;N;-PURGE;ALL;*;N;-PURGE;ALL;*;N;-PURGE;ALL;*;N;ZOOM;EXTENTS;-INSERT;"X:/AutoCAD Support George/SETTING REINSTATE.DWG";^c^c-LAYER;SET;0;;-COLOR;BYLAYER;-LWEIGHT;BYLAYER;LWDISPLAY;OFF;-LINETYPE;SET;BYLAYER;;-STYLE;AWT;ROMANS.SHX;0;0.650;0;N;N;N;-DIMSTYLE;RESTORE;AWT;^C^C-PURGE;ALL;*;N;-PURGE;ALL;*;N;-PURGE;ALL;*;N;-PURGE;ALL;*;N;-PURGE;ALL;*;N;DIMSCALE;100;QSAVE;CLOSE;

 

Thanks

Link to comment
Share on other sites

This is more complicated than it seems. The current script recursively purges ALL redundant entities (including layers). If you want to purge everything EXCEPT layers, the script would need to purge all other entity types independently (and there are quite a few) as you can see:

 

Enter type of unused objects to purge

[blocks/Dimstyles/LAyers/LTypes/MAterials/MUltileaderstyles/Plotstyles/SHapes/te

xtSTyles/Mlinestyles/Tablestyles/Visualstyles/Regapps/Zero-length

geometry/Empty text objects/All]:

 

The resulting script would be very long and might not even succeed in purging everything (depending on entity dependencies).

 

It would probably be easier to have a LISP routine record the current layer set, purge everything and then restore the layers.

Link to comment
Share on other sites

Hmmm that makes sense, i guess if thats what i need to do then i will do it. We also have a template drawing with all our standard layers. Would it be easier to keep the code as it is (deleting any unused layers) and then at the end adding our template layers (if they are not already there?) this would save having to record the current layer set, and means we would always end up with our standard layers plus any others that we have something drawn on.

 

thanks for your help

Link to comment
Share on other sites

Igot his idea after reading the thread "macro (not lisp) for VP visibility.."

 

A script was used for the extra task. You could end your macro with:

;-script;makleyayers;

 

And makelayers.scr could be something like;

 

-layer

m

layer1,layer2,layer3,layer4,layer5,layer6,layer7

;[2 returns, as in blank lines]

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...