TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: scottafro on April 08, 2019, 03:13:51 PM

Title: Resetting Xref Layer Overrides of only selected objects
Post by: scottafro on April 08, 2019, 03:13:51 PM
Seems like there would be a pretty simple solution to this but my LISP skills are limited. Was hoping to manipulate options by means of -layer but there are no good options.
To be clear I want to be able to select xref objects and have the layers of those objects only reset. Thoughts? Thanks!
Title: Re: Resetting Xref Layer Overrides of only selected objects
Post by: tombu on April 08, 2019, 04:05:30 PM
You're trying to modify the layers in the drawing that's xrefed into the current drawing?
Title: Re: Resetting Xref Layer Overrides of only selected objects
Post by: scottafro on April 08, 2019, 09:51:45 PM
Yes. I want to set the layers of an xref back to what they are in the xref but only for selected items. I have a routine which resets all layers back to the xrefs original content but would like to be able to do that for just selected items.
Title: Re: Resetting Xref Layer Overrides of only selected objects
Post by: scottafro on April 08, 2019, 09:54:30 PM
Sorry I believe I misread that. I've overridden an xrefs layer properties in the drawing in which it is xrefed too. I want to set those overridden properties back to the original properties located in the xrefd drawing. But only for the layers of selected objects.
Title: Re: Resetting Xref Layer Overrides of only selected objects
Post by: tombu on April 08, 2019, 10:59:35 PM
Starting with 2019 versions AutoCAD displays xref overrides in the layer manager.  They can be reset easily.
Title: Re: Resetting Xref Layer Overrides of only selected objects
Post by: Lee Mac on April 09, 2019, 08:03:34 AM
This program (http://lee-mac.com/resetxreflayers.html) could be modified to target specific layers.
Title: Re: Resetting Xref Layer Overrides of only selected objects
Post by: scottafro on April 10, 2019, 01:36:53 PM
Thanks Lee! I'm a LISP newbie. Can you provide me one more favor and point me to the piece of code I can investigate adjusting? Appreciate your help!
Title: Re: Resetting Xref Layer Overrides of only selected objects
Post by: Lee Mac on April 10, 2019, 02:07:41 PM
Thanks Lee! I'm a LISP newbie. Can you provide me one more favor and point me to the piece of code I can investigate adjusting? Appreciate your help!

The easiest modification would be to add the following line between lines 365 & 366:
Code - Auto/Visual Lisp: [Select]
  1. (member (substr lyn (+ 2 pos)) (mapcar 'strcase '("TargetLayer1" "TargetLayer2" "TargetLayer3")))

(Changing "TargetLayer1" "TargetLayer2" "TargetLayer3" to the name or names of the layers that you wish to modify).

Implementing a user selection of such layers is possible but would require far more modification.