Jump to content

Recommended Posts

Posted

Hello,

 

Iàm looking for a lisp that can create 4 layer group filters. Group1 = installation,

group2 =bis1, group3 =bis2 and group4 =bis3 at once.

Also looking for a lisp to turn a layer group filter on/off or freeze/thaw or viewport freeze/thaw.

 

Many thanks,

 

Jaap

Posted
Iàm looking for a lisp that can create 4 layer group filters. Group1 = installation,

group2 =bis1, group3 =bis2 and group4 =bis3 at once.

(vl-load-com)
;;; Create layer "Lay1" "Lay2" "Lay3"
(mapcar '(lambda(lay)
 (vla-add(vla-get-layers(vla-get-activedocument (vlax-get-acad-object))) lay)
 )
 (list "Lay1" "Lay2" "Lay3")
 )
;;; Add group filter text
(vva-Layer-GroupFilter-Make "installation")
(vva-Layer-GroupFilter-Make "bis1")
(vva-Layer-GroupFilter-Make "bis2")
(vva-Layer-GroupFilter-Make "bis3")
;;; Add Layer to Group Filter
(vva-Layer-GroupFilter-Layer-add "installation" '("Lay1" "Lay2") t)
(vva-Layer-GroupFilter-Layer-add "bis1" '("Lay1" "Lay2" "Lay3") t)
(vva-Layer-GroupFilter-Layer-add "bis2" '("0" "Lay1") t)

Also looking for a lisp to turn a layer group filter on/off or freeze/thaw or viewport freeze/thaw

Function (vva-Layer-GroupFilter-getLayerList) returns a list of layers which belong to the filter

;; ! Returns : List of Lists ((FilterName1 LayerName1 LayerName2 ... LayerNameN) ... (FilterNameN LayerName1 LayerName2 ... LayerNameN))

;; (("Group filter2" "Lay1" "Lay2") ("Group filter2" "Lay1"))

knowing the names of layers, you can programmatically set the properties you want them.

layerFilter.lsp

Posted

from this thread to learn that command _-layer has the option to "_filter"

Posted

Thanks..............but wat is the command for runnung the lisp? iàm not so into lisp.

I`ve already made a script with -layer/filter option. And it works. I only can`t find the awnser to turn groups on or off with a script or lisp. Wel i keep on searching on the www.

 

pmxcad

Posted

Need some functions from #2

(defun on_off_layer_by_groupFilterName (groupFilterName what)
 ;;;groupFilterName - name of Layer Group Filter.  Case sensitive
 ;;; what - options command _-layer. "_on" or "_off"
 ;;; (setq groupFilterName "installation")
 ;;; USE (on_off_layer_by_groupFilterName "installation" "_on")
 ;;; USE (on_off_layer_by_groupFilterName "installation" "_off")
 ((lambda(lst / lays)
     (setq lays(apply 'strcat (mapcar '(lambda(x)(strcat x ",")) lst)))
     (command "_-LAYER" what lays "")
     )
   (cdr (assoc groupFilterName (vva-Layer-GroupFilter-getLayerList)))
  )
 )

Use

(on_off_layer_by_groupFilterName "installation" "_off") ;;; Turn off all layers of the Gruopfilter "installation"
(on_off_layer_by_groupFilterName "installation" "_on") ;;; Turn on all layers of the Gruopfilter "installation"

Posted

VVA,

 

There's no need to invoke -LAYER command (multiple times?), see this thread. ;)

Posted

Also, same problem as in other 'create layer' thread:

 

There's no need to repeatedly call the Layers Collection, nor is it considered "Best Practice" to attempt adding layers that already exist.

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