Jump to content

layer properties manager autofilter


hpimprint

Recommended Posts

layer properties manager autofilter

i have a .dwg having many layers inside.
these layers have similar names in series
example

(CWS)
(CWS) 100-101
(CWS) 100-325
(CWS) 100.675
(TFR)
(TFR) 200-345
(TRF) 324-100
...
..
.

As you see the layer initial part let to separate them as different groups.

in the example above the group (CWS), the group (TFR) ,....

Is there a way to auto-create filters (inside the layer property manager) automatically so that each filter contains one of these groups?
Eventualy also a lisp where i write by hand (in the lisp code, before starting the lisp) the group list (example: (CWS); (TFR); ...) and then the lisp work on layers to creare filter layers?

here attached an example:

example.dwg

Link to comment
Share on other sites

https://knowledge.autodesk.com/support/autocad-architecture/learn-explore/caas/CloudHelp/cloudhelp/2019/ENU/AutoCAD-Architecture/files/GUID-EABD5D5F-CEB0-4089-AA8C-CA9E2BF65723-htm.html

Link to comment
Share on other sites

Load this:

(defun hpimprint (/ collection names)
  (setq names (list ""))
  (if (not (vl-catch-all-error-p (setq collection (vl-catch-all-apply
    (function (lambda () (vla-item (vla-getextensiondictionary (vla-get-layers (vla-get-activedocument (vlax-get-acad-object)))) "ACAD_LAYERFILTERS")))
  ))))
  (vlax-for item collection (setq names (cons (vla-get-name item) names))))
  names 
  (or(member "Linetype" names)(command "._-layer" "filter" "new" "property" "All" "LINETYPE==\"~Continuous\"" "Linetype" "X" nil))
  (or(member "Lineweight" names)(command "._-layer" "filter" "new" "property" "All" "LINEWEIGHT==\"~Default\"" "Lineweight" "X" nil))
  (or(member "NCS" names)(command "._-layer" "filter" "new" "property" "All" "NAME==\"[A,C,E,L,V]-*\" or NAME== \"Layer*\"" "NCS" "X" nil))
  (or(member "CWS" names)(command "._-layer" "filter" "new" "property" "All" "NAME==\"(CWS)*\" or NAME== \"Layer*\"" "CWS" "X" nil))
  (or(member "TFR" names)(command "._-layer" "filter" "new" "property" "All" "NAME==\"(TFR)*\" or NAME== \"Layer*\"" "TFR" "X" nil))
  (or(member "BD" names)(command "._-layer" "filter" "new" "property" "All" "NAME==\"(BD)*\" or NAME== \"Layer*\"" "BD" "X" nil))
  (princ "Layer Filter Names » ")(princ names)
;  (princ "\nSave, close and reopen the DWT or DWG for the Filters to be put into alphabetical order.")
  (princ)
)
(vl-load-com)
(hpimprint)

 

  • Like 1
Link to comment
Share on other sites

a question:

the line

 (or(member "NCS" names)(command "._-layer" "filter" "new" "property" "All" "NAME==\"[A,C,E,L,V]-*\" or NAME== \"Layer*\"" "NCS" "X" nil))

what objects will eleborate?

Link to comment
Share on other sites

5 hours ago, hpimprint said:

a question:

the line

 (or(member "NCS" names)(command "._-layer" "filter" "new" "property" "All" "NAME==\"[A,C,E,L,V]-*\" or NAME== \"Layer*\"" "NCS" "X" nil))

what objects will eleborate?

Three of those were part of a list of Layer Filters I use included as examples. NCS or National CAD Standards layer names are followed by the default template installed with our Civil 3D and are explained at https://www.nationalcadstandard.org/ncs5/pdfs/ncs5_clg_lnf.pdf.  The "NCS" Layer Filter works for the NCS Layers we use.

The "Linetype" Layer Filter only displays Layers with a Linetype assigned and the "Lineweight" Layer Filter only displays Layers with a Lineweight assigned.

You can delete any of those lines that add Layer Filters you don't need or add lines for new ones you need.

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