DB007 Posted August 23, 2011 Share Posted August 23, 2011 We get drawings regularly with many layers and only need about 25% of them, I created a Macro which renames the ones we want and locks them so I can do a select all and delete without losing the layers i want. unlock them, purge and zoom extents. This works perfectly except for some of the drawings we get have an extra layer. When the Macro searches for this layer if its not there it goes into a loop. Is it possible to check if the layer exists 1st before running the rename command? Is this possible without LISP/VBA? Thanks example of the macro:- ^C^C-layer;r;layer1;AA_layer1;r;layer2;AA_layer2;r;layer3;AA_layer3;R;layer4;AA_layer4;lo;AA*;;erase;all;;-layer;u;*;;-purge;all;*;n;zoom;e; Quote Link to comment Share on other sites More sharing options...
BIGAL Posted August 24, 2011 Share Posted August 24, 2011 I would write a lisp etc and probably have it read a TXt file with the layer names in it makes it easier to add or subtract or even use different layer combos. Quote Link to comment Share on other sites More sharing options...
BlackBox Posted August 24, 2011 Share Posted August 24, 2011 Consider the LAYTRANS command. :wink: Quote Link to comment Share on other sites More sharing options...
DB007 Posted August 24, 2011 Author Share Posted August 24, 2011 I would write a lisp etc and probably have it read a TXt file with the layer names in it makes it easier to add or subtract or even use different layer combos. Consider the LAYTRANS command. :wink: Thanks to both but neither will work as I really need it to run on LT too. Quote Link to comment Share on other sites More sharing options...
DNK Posted August 24, 2011 Share Posted August 24, 2011 We get drawings regularly with many layers and only need about 25% of them, I created a Macro which renames the ones we want and locks them so I can do a select all and delete without losing the layers i want. unlock them, purge and zoom extents. This works perfectly except for some of the drawings we get have an extra layer. When the Macro searches for this layer if its not there it goes into a loop. Is it possible to check if the layer exists 1st before running the rename command? Is this possible without LISP/VBA? Thanks example of the macro:- ^C^C-layer;r;layer1;AA_layer1;r;layer2;AA_layer2;r;layer3;AA_layer3;R;layer4;AA_layer4;lo;AA*;;erase;all;;-layer;u;*;;-purge;all;*;n;zoom;e; How about creating a second macro that deals specifically with this layer? You could run that first, if the layer's not there, then esc and run this one. Quote Link to comment Share on other sites More sharing options...
DB007 Posted August 24, 2011 Author Share Posted August 24, 2011 I've done that already but was hoping to make it a little cleaner and save the moans about having to run two macros every time. (Even though a quick look at the drawing would make it obvious which macro to use.) Would it be worth looking into Diesel? I know very little about it. Quote Link to comment Share on other sites More sharing options...
DNK Posted August 24, 2011 Share Posted August 24, 2011 Keeping it in the macro form, add the layer at the beginning of the macro, then it will always be there when you go to manipulate it later. Quote Link to comment Share on other sites More sharing options...
DB007 Posted August 24, 2011 Author Share Posted August 24, 2011 Keeping it in the macro form, add the layer at the beginning of the macro, then it will always be there when you go to manipulate it later. Yes! It Works Perfect! Thank you. Quote Link to comment Share on other sites More sharing options...
DNK Posted August 24, 2011 Share Posted August 24, 2011 No worries. Quote Link to comment Share on other sites More sharing options...
BlackBox Posted August 24, 2011 Share Posted August 24, 2011 Thanks to both but neither will work as I really need it to run on LT too. Admittedly, I do not use LT. Would you be kind enough to explain to me how using an AutoCAD command will not work for both versions (Full & LT)? Quote Link to comment Share on other sites More sharing options...
DB007 Posted August 24, 2011 Author Share Posted August 24, 2011 Admittedly, I do not use LT. Would you be kind enough to explain to me how using an AutoCAD command will not work for both versions (Full & LT)? LAYTRANS is an unknown command in LT and there is nothing in the help either. So im guessing it was removed from LT? Thanks for the input though. Quote Link to comment Share on other sites More sharing options...
BlackBox Posted August 24, 2011 Share Posted August 24, 2011 Weird; thanks for the clarification. Quote Link to comment Share on other sites More sharing options...
BIGAL Posted August 25, 2011 Share Posted August 25, 2011 You can create a txt file and copy and paste to the command line advantage here is easy to edit use notepad sorry not tested you use a space as an enter so end of lines may have spaces not seen or else just do new blank line -la N layer1 r layer1 ;AA_layer1 r layer2 AA_layer2 r layer3 AA_layer3 R layer4 AA_layer4 lo AA* erase all -layer u * -purge all * n zoom e Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.