- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I have the following command which temporarily turns on all layers in a drawing including xrefs, allows you to select one to keep on and then it turns the rest back off and even reports the name of the layer for you. One slight problem. It seems after selecting the item it remains highlighted after the command is run . . . Could someone shed a light on why the selected object remains highlighted. Not even a regenall helps until the drawing is closed and reopened.
;-----------------------------------------------------------------------------
;**************************** Super Layer Command ff ***********************
;*****************************************************************************
;-----------------------------------------------------------------------------
(defun c:ff (/ ActDoc LayCol LayList Sel tempLayName OnLayList)
(setq ActDoc (vla-get-ActiveDocument (vlax-get-Acad-Object)))
(setq LayCol (vla-get-Layers ActDoc))
(vlax-for Lay LayCol
(setq LayList (cons (list Lay (vla-get-Freeze Lay) (vla-get-LayerOn Lay))
LayList))
(if (not (equal (vla-get-ActiveLayer Actdoc) Lay))
(vla-put-Freeze Lay :vlax-false)
)
(vla-put-LayerOn Lay :vlax-true)
)
(setq acadobject (vlax-get-acad-object))
(setq activedocument (vla-get-activedocument acadobject))
(vla-regen activedocument acActiveViewport )
(setvar "errno" 0)
(while (not (equal (getvar "errno") 52))
(if (setq Sel (nentsel "\n Select object on layer to leave On
Layer will stay on & Thawed: "))
(progn
(redraw (car Sel) 3)
(setq tempLayName (cdr (assoc 8 (entget (car Sel)))))
(if (not (vl-position tempLayName OnLayList))
(setq OnLayList (cons tempLayName OnLayList))
)
;-------------------------
(prompt (strcat "\n Following layer will stay on. Gigidy Gigidy!: " (vl-princ-to-string
OnLayList)))
;-------------------------
(foreach item (last Sel)
(if
(and
(equal (type item) 'ENAME)
(setq tempLayName (cdr (assoc 8 (entget item))))
(not (vl-position tempLayName OnLayList))
)
(setq OnLayList (cons tempLayName OnLayList))
)
)
)
)
)
(foreach Lst LayList
(if (not (vl-position (vla-get-Name (car Lst)) OnLayList))
(progn
(if (not (equal (vla-get-ActiveLayer Actdoc) (car Lst)))
(vla-put-Freeze (car Lst) (cadr Lst))
)
(vla-put-LayerOn (car Lst) (caddr Lst))
)
)
)
(princ)
)
;-----------------------------------------------------------------------------
;**************************** Remove Dim override RS *************************
;*****************************************************************************
;-----------------------------------------------------------------------------
;must have dimstyle set current
(defun c:rs ()
(setvar "cmdecho" 0)
(command "Dim" "Restore" (getvar "DIMSTYLE") "Exit")
(PRINC "CURRENT DIMSTYLE OVERIDES REMOVED, PREVIOUS TEXT OVERIDES POSSIBLY REMOVED")
(setvar "cmdecho" 1)
(princ)
)
Solved! Go to Solution.