Hello everyone!
I often work on drawings which have multiple xrefs, each having up to 100 Layers or more, so the layer manager can be a bit difficult to trawl through to find a local layer to select.
I know how to create a local layer filter using the code ~*|* from the new filter area in layer manager, but I wonder if anyone has/can quickly knock up a code to speed this process up.
Ideally all I want to have to type in is: LOCAL
and then the local layer filter would be created, with the filter name being Local-Layers (or similar).
any ideas/help muchly appreciated!!
Solved! Go to Solution.
Solved by Lee_Mac. Go to Solution.
Try this quick code:
(defun c:local ( / dc fn xd ) (setq fn "Local-Layers") ;; Filter Name (if (and (setq xd (cdr (assoc 360 (entget (cdr (assoc 330 (entget (tblobjname "layer" "0") ) ) ) ) ) ) ) (or (setq dc (cdr (assoc -1 (dictsearch xd "ACAD_LAYERFILTERS")))) (setq dc (dictadd xd "ACAD_LAYERFILTERS" (entmakex '( (000 . "DICTIONARY") (100 . "AcDbDictionary") (280 . 0) (281 . 1) ) ) ) ) ) (null (dictsearch dc fn)) ) (dictadd dc fn (entmakex (list '(000 . "XRECORD") '(100 . "AcDbXrecord") '(280 . 1) (cons 1 fn) '(001 . "~*|*") '(001 . "*") '(001 . "*") '(070 . 0) '(001 . "*") '(001 . "*") '(-3 ( "ACAD" (1000 . "( NAME== \"~*|*\" )") ) ) ) ) ) ) (princ) )
FYI, you can also create layer filters from the -layer command.
eg.
Command: la -LAYER Current layer: "0" Enter an option [?/Make/Set/New/Rename/ON/OFF/Color/Ltype/LWeight/TRansparency/MATerial/Plot/Fre eze/Thaw/LOck/Unlock/stAte/Description/rEconcile]: filter Current layer filter: "All" Enter a layer filter option [New/Set/Rename/Edit/Delete/eXit]:
@barry2104 wrote:
hmm doesn't seem to work/do anything when I type in LOCAL after loading her in... does it work for anyone else out there?
Does it not create the layer filter as required?
Did you check the Layer Manager after using the program?
Thank Barry
Since I am adding the layer filter XRecord directly to the ACAD_LAYERFILTERS dictionary, it is likely that the Layer Manager would need to be reopened to read any new items from this dictionary.
In this case, it may be simpler to follow Alan's suggestion of automating the -LAYER command to create & set the layer filter current, rather than my rather more 'purist' route.
Happy to help.
I have tried the code, it creates a new filter but the layer manager and layer toolbar don't work properly. The layer list doesn't update when you click any filter items including filters under xref.
BTW, there are some rouintes in the forum which allow you setup some filter conditions in a txt file. When you open a drawing, the routine can read it and create filters for you.
If I use the -layer command with the filter option to create a property filter, how should I define my filter definition?
For instance if I want all layers from which the name starts with X-.
Any tips are very welcome!
Regards,
Marcel Pennings
Hello there,
I'm trying to add your suggestions to a lisp routine i use to insert blocks.
but i cannot seem to get the layers to add to the group filter
The filters are all created fine, it just won't add the layers to the filter.
Any ideas?
I am using the following
(command "-layer" "_filter" "_N" "_G" "Formwork" "M_PANEL" "EcoAS" "")
(command "-layer" "_filter" "_S" "All" "" "")
or
(command "-layer" "Fil" "N" "G" masterGRPname eLay subGRPname "")
(command "-layer" "_filter" "_S" "All" "" "")
Regards,
Lee
Can't find what you're looking for? Ask the community or share your knowledge.