Button Macro

Button Macro

cleftwich
Enthusiast Enthusiast
821 Views
8 Replies
Message 1 of 9

Button Macro

cleftwich
Enthusiast
Enthusiast

Can someone assist me with a macro that turn on and off an xref layer or layers. Here is what I have so far but its missing something that initiates an xref layer ^C^C-layer;thaw;lights-n;; . Any help would be greatly appreciated.

Accepted solutions (3)
822 Views
8 Replies
Replies (8)
Message 2 of 9

pendean
Community Legend
Community Legend
Accepted solution
Open LAYER command and look at the exact name of the XREF layers in the top file the XREF resides in: see what you forgot to add to your macro yet?

Hint: xref name is ahead of the layer name.

The question is, to make your macro useful, do you only call XREFs in all of your files the same exact name? Or do you give then the same exact override name?

Side question if I may: Why a macro if I may ask, are you an LT version of AutoCAD user?

Message 3 of 9

Kent1Cooper
Consultant
Consultant
Accepted solution

@pendean wrote:
Open LAYER command and look at the exact name of the XREF layers in the top file the XREF resides in: ....

But when you do, be sure it is showing "All" Layers:

Kent1Cooper_0-1662563601794.png

or an appropriate filter in the "Xref" category, not the "All non-Xref Layers" filter that may be in effect [I most often use that].

Kent Cooper, AIA
Message 4 of 9

cleftwich
Enthusiast
Enthusiast

We are using straight Autocad 2022. I ended up remembering to use *.* in front of the layer name

Message 5 of 9

Kent1Cooper
Consultant
Consultant
Accepted solution

If you are using full AutoCAD [with or without overlay], not LT, I have a routine called LayerQuellPick, >here<, which defines commands for turning off or freezing the Layers of Picked objects, including Nested objects in the command names with N at the end.  So you can call the LOPN or LFPN command, and pick an object Nested in an Xref, and it will turn off or freeze that Nested Layer.  No need to have a separate macro for every possible Xref Layer-name root and nested Layer name.

Kent Cooper, AIA
0 Likes
Message 6 of 9

cleftwich
Enthusiast
Enthusiast
Thank you
0 Likes
Message 7 of 9

pendean
Community Legend
Community Legend
@Kent1Cooper Isn't that what the built-in LAYFRZ and LAYOFF command do already (BLOCK sub-option)? In LT an AutoCAD OOTB.
@cleftwich
0 Likes
Message 8 of 9

Kent1Cooper
Consultant
Consultant

@pendean wrote:
@Kent1Cooper Isn't that what the built-in LAYFRZ and LAYOFF command do already (BLOCK sub-option)? ....

[My commands far pre-date those, so I'm accustomed to using mine, and don't always remember those exist.  See some little benefits in the description at the link.]

Kent Cooper, AIA
0 Likes
Message 9 of 9

pendean
Community Legend
Community Legend
Most likely for sure, you are a great LISP creator, but since it is now an OOTB ability then macro writing will be a lot easier for @cleftwich and anyone else wanting it.
0 Likes