pmxcad Posted August 22, 2011 Posted August 22, 2011 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 Quote
VVA Posted August 23, 2011 Posted August 23, 2011 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 Quote
VVA Posted August 23, 2011 Posted August 23, 2011 from this thread to learn that command _-layer has the option to "_filter" Quote
pmxcad Posted August 24, 2011 Author Posted August 24, 2011 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 Quote
VVA Posted August 26, 2011 Posted August 26, 2011 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" Quote
BlackBox Posted August 26, 2011 Posted August 26, 2011 VVA, There's no need to invoke -LAYER command (multiple times?), see this thread. Quote
BlackBox Posted August 26, 2011 Posted August 26, 2011 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. Quote
Recommended Posts
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.