PDA

View Full Version : Express tools layiso replacement


bjlottis
2006-11-21, 10:17 PM
I used to modify the Express Tools Layiso command by editing the acetlayr.lsp file. I changed it so that it would freeze all the layers instead of just turning them off.

Now in 2007, it's part of the core program and I can't edit it. I thought about renaming acetlayer.lsp from a previous version and trying to run it anyhow. But I'm afraid it might interfere with other elements of the core program.

Any thoughts on this? Suggestions?

By the way, what's the point of just turning them off? I rarely turn layers off, I always freeze.

Thanks,
Brian

Opie
2006-11-21, 11:30 PM
Brian,

I'm not understanding your need to adjust the LAYISO command. Could you explain a bit more.

Do you use the LAYUNISO command as well?

bjlottis
2006-11-21, 11:33 PM
Currently, layiso turns OFF all the layers except the selected ones. I prefer having all the layers FROZEN. So I modified acetlayr.lsp file to accomplish this.

I typically use the Layer Previous command instead of layuniso.

Opie
2006-11-21, 11:38 PM
Currently, layiso turns OFF all the layers except the selected ones. I prefer having all the layers FROZEN. So I modified acetlayr.lsp file to accomplish this.
I don't see any reason why you would not be able to edit this file again.

bjlottis
2006-11-21, 11:40 PM
It's gone in 2007. LAYISO is now part of the core program, not a separate lisp routine.

Opie
2006-11-21, 11:43 PM
It's gone in 2007. LAYISO is now part of the core program, not a separate lisp routine.
Use your old version. It should still work as long as all the supporting files are loaded.

madcadder
2006-11-22, 01:37 AM
Use your old version. It should still work as long as all the supporting files are loaded.

Just rename the command line...

T.Willey
2006-11-22, 06:40 PM
Here are ones that I wrote to replace the express tool's ones. Change to suit your needs, as it turns the layers off right now.

(defun c:IsoLays (/ ss Ent LayName LayNameList ActDoc Str)

(if (setq ss (ssget))
(progn
(while (setq Ent (ssname ss 0))
(setq LayName (cdr (assoc 8 (entget Ent))))
(if (not (vl-position LayName LayNameList))
(setq LayNameList (cons LayName LayNameList))
)
(ssdel Ent ss)
)
(setq ActDoc (vla-get-ActiveDocument (vlax-get-Acad-Object)))
(setvar "clayer" (car LayNameList))
(vlax-for i (vla-get-Layers ActDoc)
(if (not (vl-position (vla-get-Name i) LayNameList))
(progn
(setq GlbVarLayerStateList (cons (cons (vla-get-Name i) (vla-get-LayerOn i)) GlbVarLayerStateList))
(vla-put-LayerOn i :vlax-false)
)
)
)
(setq Str "")
(foreach i LayNameList
(if (= i (last LayNameList))
(setq Str (strcat Str "\"" i "\"."))
(setq Str (strcat Str "\"" i "\","))
)
)
(prompt (strcat "\n Layers isolated - " Str))
)
(prompt "\n Nothing selected.")
)
(princ)
)

;--------------------------------------------------------------------------------

(defun c:UnIsoLays (/ tmpList)

(if GlbVarLayerStateList
(vlax-for i (vla-get-Layers (vla-get-ActiveDocument (vlax-get-Acad-Object)))
(if (setq tmpList (assoc (vla-get-Name i) GlbVarLayerStateList))
(vla-put-LayerOn i (cdr tmpList))
)
)
(prompt "\n Need to run \"IsoLays\" command first.")
)
(setq GlbVarLayerStateList nil)
(princ)
)

pnorman
2006-11-22, 08:12 PM
And here is mine:

(defun c:slo ( / CMDECHO LYR1 LYRLIST *error*); turn layers off
(defun *error* (MSG) ; local error handler
(princ (strcat "\n" MSG))
(vla-EndUndoMark (vla-get-activedocument (vlax-get-acad-object)))
(if CMDECHO (setvar "cmdecho" CMDECHO))
)
(vla-StartUndoMark (vla-get-activedocument (vlax-get-acad-object)))
(princ "\nSelect object(s) on the layer(s) to be isolated: ")
(ppn_mlyrslct)
(setq CMDECHO (getvar "cmdecho"))
(setvar "cmdecho" 0)
(command "_.layer" "_off" "*" "_y" "")
(if LYRLIST
(command "_.layer" "_set" LYR1 "_on" LYRLIST "")
(command "_.layer" "_set" LYR1 "")
)
(vla-EndUndoMark (vla-get-activedocument (vlax-get-acad-object)))
(setvar "cmdecho" CMDECHO)
(princ)
)
(defun c:slf ( / CMDECHO LYR1 LYRLIST *error*); freeze layers
(defun *error* (MSG) ; local error handler
(princ (strcat "\n" MSG))
(vla-EndUndoMark (vla-get-activedocument (vlax-get-acad-object)))
(if CMDECHO (setvar "cmdecho" CMDECHO))
)
(vla-StartUndoMark (vla-get-activedocument (vlax-get-acad-object)))
(princ "\nSelect object(s) on the layer(s) to be isolated: ")
(ppn_mlyrslct)
(setq CMDECHO (getvar "cmdecho"))
(setvar "cmdecho" 0)
(command "_.layer" "_set" LYR1 "")
(command "_.layer" "_f" "*" "")
(if LYRLIST (command "_.layer" "_t" LYRLIST ""))
(vla-EndUndoMark (vla-get-activedocument (vlax-get-acad-object)))
(setvar "cmdecho" CMDECHO)
(princ)
)
(defun ppn_mlyrslct ( / E1 E2 LYR2) ; multiple layer select for slo,slf
(setq E1 (entsel "\nSelect first layer: "))
(if E1
(ppn_get:edata E1 "LYR1" 8)
(setq LYR1 (getvar "clayer"))
)
(princ (strcat "\n" LYR1))
(while
(setq E2 (entsel "\nSelect next layer: "))
(if E2
(progn
(ppn_get:edata E2 "LYR2" 8)
(princ (strcat "\n" LYR2))
(if LYRLIST
(setq LYRLIST (strcat LYRLIST "," LYR2))
(setq LYRLIST LYR2)
)
)
)
)
(princ)
)



Regards
Phill

bjlottis
2006-11-29, 04:38 PM
Thanks guys. I'll take a look at your suggested codes.

By the way. When and why do you turn OFF layers instead of FREEZing them?

I don't see when it would an advantage.

madcadder
2006-11-29, 04:51 PM
Its not the full story but...

If a layer is "off" it still regens and is calculated in "zoom extents".
If a layer is " frozen" entities are not part of the regen, require a regen when thawed and are not considered in "zoom extents".

pnorman
2006-11-29, 04:51 PM
By the way. When and why do you turn OFF layers instead of FREEZing them?
I don't see when it would an advantage.
Here is one example. We use the architects drawing as a reference for our structural drawings. But we don't use their drawing as part of our final plot. There are many layers in the architectural drawing we are not interested in so these are frozen. When we xref the architectural drawing we place it on its own layer S-ANNO-REFR-ARCH. When we want to turn the architectural drawing on and off we just freeze and thaw that one layer. This doesn't upset all the other frozen layers we are not interested in. Now for our sturctural layers, lets say I am working on concrete outlines and I don't want the steel reinforcing or text or dimensions in the way. I turn those layers "off" not frozen. Then I can toggle "on" and "off" layers without upsetting the frozen layers which I don't care about and want to be always off.
Another important difference between off and frozen layers is the way associative hatch works. If a hatch boundary for an associative hatch is "off" and I move or stretch the boundary the hatch will update but if the boundary layer is forzen it will not.

Hope that helps.
Cheers
Phill

bjlottis
2006-11-29, 05:21 PM
Thanks for the example.

The thing that always scared me about OFF is that the entities on that layer are still subject to change.

For example you may unkowinlgy select entities on an OFF layer with Quick Select and modify them somehow. And since the layer is turned off you might not notice unitl it's too late.

So I've always prefered to FREEZE layer.

CAB2k
2006-11-29, 10:54 PM
One more to try.
;; CAB 11.29.06
;; User pick of layers to remain Thawed
;; Picked layers turn off as picked, when Enter is pressed
;; picked layers are thawed and all others are frozen
;; ignores current layer
(defun c:layfrz (/ *doc *layers laylst ent lname)
(vl-load-com)
(setq *doc (vla-get-activedocument (vlax-get-acad-object))
*layers (vla-get-layers *doc)
clayer (getvar "clayer")
)
(vla-endundomark *doc)
(vla-startundomark *doc)
(prompt "\nLayers picked will turn off during selection.")
(while
(setq ent (nentsel "\nSelect object(s) on the layer(s) to be isolated:"))
(setq lname (vla-get-layer (vlax-ename->vla-object (car ent)))
laylst (cons lname laylst)
)
(vla-put-layeron (vla-item *layers lname) :vlax-false)
)
(if laylst
(progn
(vlax-for layerobj *layers
(setq lname (vlax-get-property layerobj 'name))
(if (member lname laylst)
(progn
(vla-put-layeron (vla-item *layers lname) :vlax-true)
(if (/= lname clayer)
(vla-put-freeze (vla-item *layers lname) :vlax-false)
)
)
(vl-catch-all-apply
'vla-put-freeze
(list (vla-item *layers lname) :vlax-true)
)
)
)
(vla-regen *doc acactiveviewport)
(prompt "\nLayers Isolated: ")
)
)
(vla-endundomark *doc)
laylst
)
(prompt "\n*-* Layers Freeze_Except loaded, Enter LayFrz to run. *-*")
(princ)

ccowgill
2006-11-30, 01:19 PM
I typically use off for temporary, freeze for permanent, however when you have layers inside of blocks, you need to freeze the layer of that block to get all the layers inside to dissapear when those layers are still turned on.