View Full Version : Isolate objects - Rest remain visible?
Mr Cory
2007-03-08, 04:52 AM
This is more than likely impossible but is there any way to isolate a few objects to work on yet leave the rest visible?
This is more than likely impossible but is there any way to isolate a few objects to work on yet leave the rest visible?
Hi Cory,
Unless I'm misunderstanding what you want to do, I don't think so. But have you concidered locking the layers of the objects that you don't want edited?
Mr Cory
2007-03-08, 05:37 AM
Sigh. Yea i just wanted something quick and easy owell its all good cheers anyway
Sigh. Yea i just wanted something quick and easy owell its all good cheers anyway
Don't give up. Maybe someone else out there will have an idea. You never know. :)
CAB2k
2007-03-09, 02:40 PM
How about this?
Pseudo Code
Routine 1
Get all layer states (locked/unlocked) in a global variable
User selects objects
Create a list of selected objects & there layer in a global variable
Get current Layer in a global variable
Create a New layer "WorkingLayer", set current
Change selected objects to "WorkingLayer"
Lock All Layers
Routine 2
Unlock layers in the global variable
Change objects in the global list from "WorkingLayer" to there previous layer
Reset current layer
Delete the "WorkingLayer"
If error deleting "WorkingLayer" then a new object was created, warn user
Mr Cory
2007-03-10, 04:56 AM
Hmm i like the sound of that, sorry but i wouldnt have a clue even where to start. Least i know its possible
anderson.scottglen
2007-03-11, 06:26 AM
I don't know if these are 3rd party commands or native to the Autodesk programs I'm running (Map and Land Development Desktop), but IF you have the lightbulb (circled in the attached image) on your autocad taskbar, then you have the following commands: AECISOLATEOBJECTS, AECHIDEOBJECTS and AECUNISOLATEOBJECTS. Prime cadidates for aliases or custom toolbar buttons! But *huge* productivity increases with these commands.
The best speed gain will be used with the SELECTSIMILAR command. By using all these commands with LAYISO and LAYUNISO commands, you can really fine tune your work and make working in cluttered 2nd/3rd party drawings manageable.
In a network environment, *always* remember to unhide before you save and close, the majority of your coworkers might not know about hiding objects! Also, I've run into cases where I've hidden objects and saved while working in an xref, and others have reloaded that xref to find the hidden objects not displayed in the main drawings. While this may seem desirable in some situations, this is a very unreliable approach as the objects can always be made visible by another user.
Mr Cory
2007-03-11, 09:48 PM
Yea i use these features when working in 3d. The problem with this is it hides all the other objects, i would like to leave them visible. I think CAB2k has the right idea but just making it work is the hard part lol
kennet.sjoberg
2007-03-12, 09:09 AM
Create a temporary block with all objects that you want "only visible" and lock the insertion layer.
Explode it when you are done.
: ) Happy Computing !
kennet
jaseh
2007-03-12, 03:05 PM
1. How about erasing all but required objects,
2. carry on working...
3. OOPS to bring back erased objects.
will only work though if you don't erase anything from your "working set of objects" ie during step 2 or close the drawing
Tom Beauford
2007-03-12, 03:52 PM
Sure:; ent_isolate.lsp
; Hide Entities
(defun C:EI (/ ss count)
(setq ss (ssget "X"))
(prompt "Select objects to isolate: ")
(setq ss1 (ssget))
(setq count 0)
(while (< count (sslength ss1))
(ssdel (ssname ss1 count) ss)
(setq count (+ count 1))
)
(setq count 0)
(while (< count (sslength ss))
(redraw (ssname ss count)2)
(setq count (+ count 1))
)
(prompt (strcat "\n" (itoa(sslength SS))" Objects hidden. They will reappear with next Regen!"))
(princ)
)
CAB2k
2007-03-12, 09:42 PM
Here is a stab at the routines.
Limited testing.
<Enjoy>
;;;=======================[ ObjISO.lsp ]======================
;;; Author: Copyright© 2007 Charles Alan Butler
;;; Version: 1.1 Mar. 12, 2007
;;; Purpose: To Isolate objects by placing them on a seperate
;;; layer, then locking all other layers
;;; Run ObjUnISO to restore then to there previous layer &
;;; ther locked state
;;;===========================================================
;|
http://forums.augi.com/showthread.php?t=56965
Routine 1 : ObjISO
User selects objects *ISO_Entity_List
Get all layer states (locked/unlocked) in a global variable *ISO_Layers_Locked
Create a list of selected objects & there layer in a global variable
Get current Layer in a global variable *ISO_Current_Layer
Create a New layer "WorkingLayer", set current
Change selected objects to "WorkingLayer"
Lock All Layers
Routine 2 : ObjUnISO
Unlock layers in the global variable
Change objects in the global list from "WorkingLayer" to there previous layer
Reset current layer
Delete the "WorkingLayer"
If error deleting "WorkingLayer" then a new object was created, warn user
|;
;;;
;;; This software is provided "as is" without express or implied ;
;;; warranty. All implied warranties of fitness for any particular ;
;;; purpose and of merchantability are hereby disclaimed. ;
;;; You are hereby granted permission to use, copy and modify this ;
;;; software without charge, provided you do so exclusively for ;
;;; your own use or for use by others in your organization in the ;
;;; performance of their normal duties, and provided further that ;
;;; the above copyright notice appears in all copies and both that ;
;;; copyright notice and the limited warranty and restricted rights ;
;;; notice appear in all supporting documentation. ;
(defun c:ObjISO (/ entlst ent layname layobj ss)
;; Global Variables
;; *ISO_Entity_List list of selected objects & there layer
;; *ISO_Current_Layer layer to be restored
;; *ISO_Layers_Locked all layer states (locked/unlocked)
;; CAB version
;; returns nil if make failed
(defun MakeLayer (lyrname acDoc / lyrobj)
(vl-load-com)
(if
(not
(vl-catch-all-error-p
(setq lyrobj
(vl-catch-all-apply
'vla-add
(list (vla-get-layers acDoc) lyrname)
)
)
)
)
lyrobj
)
)
;; return a list of layer locked state
;; Ignore xref layers
(defun get_layers_locked (acDoc / lst)
(vlax-for layObj (vla-get-layers acdoc)
(setq layname (vla-get-name layObj))
(if (not (vl-string-search "|" layname)) ; xref layer
(setq lst (cons (list layObj (vla-get-lock layObj)) lst))
)
)
lst
)
(defun Yesno (msg / return)
(initget 0 "Yes No")
(or (setq return (getkword (strcat "\n" msg " [Yes/No] < Yes >: ")))
(setq return "Yes")
)
return
)
;; return a list of entities that the layer was changed
;; changed to layer "WorkingLayer"
(defun ChangeLayer (entlst acdoc / obj lst)
;;(setq WLobj (vla-item (vla-get-layers *doc*) "WorkingLayer"))
(foreach ent entlst
(setq obj (vlax-ename->vla-object (car ent)))
(if (vl-catch-all-error-p
(vl-catch-all-apply 'vla-put-layer (list obj "WorkingLayer"))
)
(prompt "\n** Warning: object layer could not be changes **")
(setq lst (cons ent lst))
)
)
lst
)
;; Lock all layers except "WorkingLayer" & xref layers
(defun LockAllLayers (acdoc / lname lst)
(vlax-for layObj (vla-get-layers acdoc)
(setq layname (vla-get-name layObj))
(if (and (not (vl-string-search "|" layname)) ; xref layer
(/= layname "WorkingLayer")
)
(setq lst (cons (list layObj (vla-put-lock layObj :vlax-true)) lst))
)
)
lst
)
;; Returns T if Locked
(defun islayerlocked (lname / entlst)
(and (setq entlst (tblsearch "LAYER" lname))
(= 4 (logand 4 (cdr (assoc 70 entlst))))
)
)
;;===================
;; Start of Routine
;;===================
(vl-load-com)
(or *acad* (setq *acad* (vlax-get-acad-object)))
(or *doc* (setq *doc* (vla-get-activedocument *acad*)))
(vla-endundomark *doc*)
(vla-startundomark *doc*)
(if (and (tblsearch "Layer" "WorkingLayer")
(setq ss (ssget "_X" '((8 . "WorkingLayer"))))
)
(progn
(prompt "\n** Warning: Objects found on WorkingLayer.")
(if (= (YesNo "Do you want to restore them to there original layers?")
"Yes"
)
(c:ObjUnISO)
)
)
)
;;================== Removed =============================
;|
(setq entlst '())
(while (setq ent (car (entsel "\nPick Objects to Isolate.")))
(if (islayerlocked (cdr (assoc 8 (entget ent))))
(prompt "\n** Object ois on a locked layer. **")
(progn
(setq entlst (cons (list ent (assoc 8 (entget ent))) entlst))
(redraw ent 3)
)
)
)
|;
;; ================== Added ==============================
(setq ss (ssget ":L")) ; Reject Locked Layers
(if (setq entlst (vl-remove-if 'listp (mapcar 'cadr (ssnamex ss))))
(setq entlst (mapcar '(lambda(x) (list x (assoc 8 (entget x)))) entlst))
)
;;==========================================================
(if entlst
(progn
(if (tblsearch "Layer" "WorkingLayer")
;; Warning to user
;;(if (setq ss (ssget "_X" '((8 . "WorkingLayer"))))
(princ)
;;)
;; ELSE Create the layer
(if (setq layObj (makelayer "WorkingLayer" *doc*))
(vla-put-color layobj 231) ; change the color
)
)
(setq *ISO_Layers_Locked (get_layers_locked *doc*))
(setq *ISO_Current_Layer (getvar "clayer"))
(if (setq *ISO_Entity_List (ChangeLayer entlst *doc*))
(progn
(setvar "clayer" "WorkingLayer")
(LockAllLayers *doc*) ; All except "WorkingLayer" & xref layers
(prompt (strcat "\n*** ObjISO complete: "
(itoa (length *ISO_Entity_List))
" objects Isolated ***"
)
)
(prompt "\nEnter ObjUnISO to restore the layers.")
)
(progn
(setq *ISO_Layers_Locked nil
*ISO_Current_Layer nil
)
(prompt "\n*-* ObjISO failed to isolate any objects *-*")
)
)
)
)
(vla-endundomark *doc*)
(princ)
)
(prompt "\n*-* ObjISO loaded, Enter ObjISO to run. *-*")
(princ)
;;;=======================[ ObjUnISO.lsp ]===================
;;; Author: Copyright© 2007 Charles Alan Butler
;;; Version: 1.0 Mar. 12, 2007
;;; Purpose: To Unisolate objects Isolated via ObjISO Lisp
;;;==========================================================
(defun c:ObjUnISO (/ entlst ent LayObj elst ss t-f)
(vl-load-com)
(or *acad* (setq *acad* (vlax-get-acad-object)))
(or *doc* (setq *doc* (vla-get-activedocument *acad*)))
;; Set layer status as per list
(defun PutLocked (lst acdoc)
(vlax-for layObj (vla-get-layers acdoc)
(if (setq t-f (cadr (assoc LayObj lst)))
(vla-put-lock LayObj t-f)
)
)
)
(if *ISO_Current_Layer
(if (and (tblobjname "layer" *ISO_Current_Layer)
(/= *ISO_Current_Layer (getvar "clayer"))
)
(progn
(setq LayObj (vla-item (vla-get-layers *doc*) *ISO_Current_Layer))
(vla-put-freeze LayObj :vlax-false)
(vla-put-activelayer *doc* LayObj)
)
)
(prompt "\n** No variable set, can not restore current layer **")
)
(if *ISO_Layers_Locked
(PutLocked *ISO_Layers_Locked *doc*)
)
(if *ISO_Entity_List
(progn
(foreach ent *ISO_Entity_List
(setq elst (entget (car ent)))
(entmod (subst (cadr ent) (assoc 8 elst) elst))
)
(if (setq ss (ssget "_X" '((8 . "WorkingLayer"))))
(alert "New objects remain on WorkingLayer")
(if (vl-catch-all-error-p
(vl-catch-all-apply
'vla-delete
(list (vla-item (vla-get-layers *doc*) "WorkingLayer"))
)
)
(prompt "\n** Warning: Could not delete WorkingLayer **")
)
)
)
(prompt "\n** No variable set, can not restore objects **")
)
(setq *ISO_Current_Layer nil
*ISO_Layers_Locked nil
*ISO_Entity_List nil
)
(princ)
)
Mr Cory
2007-03-12, 09:54 PM
CAB2k, Perfect thank you very much! Thats exactly what i was after! Cheers! Just one thing is there anyway to get a selection box instead of having to select the individual objects?
Tom, Thats a very handy lisp! i can see me using it alot! Cheers!
CAB2k
2007-03-12, 10:59 PM
Yes, I just changed the code.
Mr Cory
2007-03-12, 11:35 PM
What needs changed and changed to what? Sorry
CAB2k
2007-03-13, 02:58 PM
What needs changed and changed to what? Sorry
I changed the code I posted as per your request. Rather than posting another version I replaced the code in my previous post with the updated code. So copy it again. It allows a selection of objects to isolate, ignoring objects on locked layers.
Mr Cory
2007-03-13, 09:32 PM
(defun c:- (/ entlst ent)
Do i need to change "entlist ent" part to "ss" or something like that, is that what you are talking about?
CAB2k
2007-03-13, 09:45 PM
Just copy the code again & try it out. No change should be necessary, except any bugs there may be. :)
Mr Cory
2007-03-13, 09:53 PM
OMG Duh! Sorry about that i didnt click that you edited your previous post!! <hides in the corner> sorry about that! Thats perfect! Cheers!
Mr Cory
2007-03-19, 04:34 AM
CAB2k, Is it possible to select the objects the i want to be locked and the rest get transferred to the working layer? Instead of goin, selectall, deselect what i dont want the running the isolate lisp
Cheers
CAB2k
2007-03-19, 05:32 AM
Like this?
;;;=======================[ ObjISO.lsp ]======================
;;; Author: Copyright© 2007 Charles Alan Butler
;;; Version: 1.2 Mar. 18, 2007
;;; Purpose: To Isolate objects by placing them on a seperate
;;; layer, then locking all other layers
;;; Run ObjUnISO to restore then to there previous layer &
;;; ther locked state
;;;===========================================================
;|
http://forums.augi.com/showthread.php?t=56965
Routine 1 : ObjISO
User selects objects *ISO_Entity_List
Get all layer states (locked/unlocked) in a global variable *ISO_Layers_Locked
Create a list of selected objects & there layer in a global variable
Get current Layer in a global variable *ISO_Current_Layer
Create a New layer "WorkingLayer", set current
Change selected objects to "WorkingLayer"
Lock All Layers
Routine 2 : ObjUnISO
Unlock layers in the global variable
Change objects in the global list from "WorkingLayer" to there previous layer
Reset current layer
Delete the "WorkingLayer"
If error deleting "WorkingLayer" then a new object was created, warn user
|;
;;;
;;; This software is provided "as is" without express or implied ;
;;; warranty. All implied warranties of fitness for any particular ;
;;; purpose and of merchantability are hereby disclaimed. ;
;;; You are hereby granted permission to use, copy and modify this ;
;;; software without charge, provided you do so exclusively for ;
;;; your own use or for use by others in your organization in the ;
;;; performance of their normal duties, and provided further that ;
;;; the above copyright notice appears in all copies and both that ;
;;; copyright notice and the limited warranty and restricted rights ;
;;; notice appear in all supporting documentation. ;
(defun c:ObjISO (/ entlst ent layname layobj ss ss2 entlst2)
;; Global Variables
;; *ISO_Entity_List list of selected objects & there layer
;; *ISO_Current_Layer layer to be restored
;; *ISO_Layers_Locked all layer states (locked/unlocked)
;; CAB version
;; returns nil if make failed
(defun MakeLayer (lyrname acDoc / lyrobj)
(vl-load-com)
(if
(not
(vl-catch-all-error-p
(setq lyrobj
(vl-catch-all-apply
'vla-add
(list (vla-get-layers acDoc) lyrname)
)
)
)
)
lyrobj
)
)
;; return a list of layer locked state
;; Ignore xref layers
(defun get_layers_locked (acDoc / lst)
(vlax-for layObj (vla-get-layers acdoc)
(setq layname (vla-get-name layObj))
(if (not (vl-string-search "|" layname)) ; xref layer
(setq lst (cons (list layObj (vla-get-lock layObj)) lst))
)
)
lst
)
(defun Yesno (msg def / return)
(initget 0 "Yes No")
(or (setq return (getkword (strcat "\n" msg " [Yes/No] < "def" >: ")))
(setq return def)
)
return
)
;; return a list of entities that the layer was changed
;; changed to layer "WorkingLayer"
(defun ChangeLayer (entlst acdoc / obj lst)
;;(setq WLobj (vla-item (vla-get-layers *doc*) "WorkingLayer"))
(foreach ent entlst
(setq obj (vlax-ename->vla-object (car ent)))
(if (vl-catch-all-error-p
(vl-catch-all-apply 'vla-put-layer (list obj "WorkingLayer"))
)
(prompt "\n** Warning: object layer could not be changes **")
(setq lst (cons ent lst))
)
)
lst
)
;; Lock all layers except "WorkingLayer" & xref layers
(defun LockAllLayers (acdoc / lname lst)
(vlax-for layObj (vla-get-layers acdoc)
(setq layname (vla-get-name layObj))
(if (and (not (vl-string-search "|" layname)) ; xref layer
(/= layname "WorkingLayer")
)
(setq lst (cons (list layObj (vla-put-lock layObj :vlax-true)) lst))
)
)
lst
)
;; Returns T if Locked
(defun islayerlocked (lname / entlst)
(and (setq entlst (tblsearch "LAYER" lname))
(= 4 (logand 4 (cdr (assoc 70 entlst))))
)
)
;;===================
;; Start of Routine
;;===================
(vl-load-com)
(or *acad* (setq *acad* (vlax-get-acad-object)))
(or *doc* (setq *doc* (vla-get-activedocument *acad*)))
(vla-endundomark *doc*)
(vla-startundomark *doc*)
(if (and (tblsearch "Layer" "WorkingLayer")
(setq ss (ssget "_X" '((8 . "WorkingLayer"))))
)
(progn
(prompt "\n** Warning: Objects found on WorkingLayer.")
(if (= (YesNo "Do you want to restore them to there original layers?" "Yes")
"Yes"
)
(c:ObjUnISO)
)
)
)
;;================== Removed =============================
;|
(setq entlst '())
(while (setq ent (car (entsel "\nPick Objects to Isolate.")))
(if (islayerlocked (cdr (assoc 8 (entget ent))))
(prompt "\n** Object ois on a locked layer. **")
(progn
(setq entlst (cons (list ent (assoc 8 (entget ent))) entlst))
(redraw ent 3)
)
)
)
|;
;; ================== Added ==============================
(setq ss (ssget ":L")) ; Reject Locked Layers
(if (and ss (setq entlst (vl-remove-if 'listp (mapcar 'cadr (ssnamex ss)))))
(setq entlst (mapcar '(lambda(x) (list x (assoc 8 (entget x)))) entlst))
)
;;==========================================================
(if entlst
(progn
(if (tblsearch "Layer" "WorkingLayer")
;; Warning to user
;;(if (setq ss (ssget "_X" '((8 . "WorkingLayer"))))
(princ)
;;)
;; ELSE Create the layer
(if (setq layObj (makelayer "WorkingLayer" *doc*))
(vla-put-color layobj 231) ; change the color
)
)
;; Added 03.18.07 ------------------------------------
(if (= (YesNo "Inverse Selection Set?" "No") "Yes")
(progn
(setq ss2 (ssget "ALL")) ; Reject Locked Layers
(setq entlst2 (vl-remove-if 'listp (mapcar 'cadr (ssnamex ss2))))
(setq entlst2 (vl-remove-if '(lambda(x) (assoc x entlst)) entlst2))
(setq entlst (mapcar '(lambda(x) (list x (assoc 8 (entget x)))) entlst2))
)
)
;; -----------------------------------------------------
(setq *ISO_Layers_Locked (get_layers_locked *doc*))
(setq *ISO_Current_Layer (getvar "clayer"))
(if (setq *ISO_Entity_List (ChangeLayer entlst *doc*))
(progn
(setvar "clayer" "WorkingLayer")
(LockAllLayers *doc*) ; All except "WorkingLayer" & xref layers
(prompt (strcat "\n*** ObjISO complete: "
(itoa (length *ISO_Entity_List))
" objects Isolated ***"
)
)
(prompt "\nEnter ObjUnISO to restore the layers.")
)
(progn
(setq *ISO_Layers_Locked nil
*ISO_Current_Layer nil
)
(prompt "\n*-* ObjISO failed to isolate any objects *-*")
)
)
)
)
(vla-endundomark *doc*)
(princ)
)
(prompt "\n*-* ObjISO loaded, Enter ObjISO to run. *-*")
(princ)
;;;=======================[ ObjUnISO.lsp ]===================
;;; Author: Copyright© 2007 Charles Alan Butler
;;; Version: 1.0 Mar. 12, 2007
;;; Purpose: To Unisolate objects Isolated via ObjISO Lisp
;;;==========================================================
(defun c:ObjUnISO (/ entlst ent LayObj elst ss t-f)
(vl-load-com)
(or *acad* (setq *acad* (vlax-get-acad-object)))
(or *doc* (setq *doc* (vla-get-activedocument *acad*)))
;; Set layer status as per list
(defun PutLocked (lst acdoc)
(vlax-for layObj (vla-get-layers acdoc)
(if (setq t-f (cadr (assoc LayObj lst)))
(vla-put-lock LayObj t-f)
)
)
)
(if *ISO_Current_Layer
(if (and (tblobjname "layer" *ISO_Current_Layer)
(/= *ISO_Current_Layer (getvar "clayer"))
)
(progn
(setq LayObj (vla-item (vla-get-layers *doc*) *ISO_Current_Layer))
(vla-put-freeze LayObj :vlax-false)
(vla-put-activelayer *doc* LayObj)
)
)
(prompt "\n** No variable set, can not restore current layer **")
)
(if *ISO_Layers_Locked
(PutLocked *ISO_Layers_Locked *doc*)
)
(if *ISO_Entity_List
(progn
(foreach ent *ISO_Entity_List
(setq elst (entget (car ent)))
(entmod (subst (cadr ent) (assoc 8 elst) elst))
)
(if (setq ss (ssget "_X" '((8 . "WorkingLayer"))))
(alert "New objects remain on WorkingLayer")
(if (vl-catch-all-error-p
(vl-catch-all-apply
'vla-delete
(list (vla-item (vla-get-layers *doc*) "WorkingLayer"))
)
)
(prompt "\n** Warning: Could not delete WorkingLayer **")
)
)
)
(prompt "\n** No variable set, can not restore objects **")
)
(setq *ISO_Current_Layer nil
*ISO_Layers_Locked nil
*ISO_Entity_List nil
)
(princ)
)
Mr Cory
2007-03-19, 05:51 AM
Ok now that is seriously cool! Thats perfect cheers!
Mr Cory
2007-03-19, 06:01 AM
The prompt "Do you want them to restore to the orginal layers?" If you select no do the objects stay on the working layer?
Nop just tried it they go back, Whats the prompt for?
CAB2k
2007-03-19, 02:22 PM
This is how it works, if you get the prompt
** Warning: Objects found on WorkingLayer.
then object exist in the drawing that are on the WorkingLayer.
If you then enter Yes to the prompt
Do you want to restore them to there original layers?
The ObjUnISO is run, and IF these variables exist
*ISO_Current_Layer *ISO_Layers_Locked *ISO_Entity_List
the information is them is used to restore the previous state.
If you close a drawing with objects on the WorkingLayer the variables are lost
and the previous state can not be restored. That would take more programing to
save the variables in the DWG database & then restore them.
PS: I did change one line in the code above, so recopy it.
Also it does not combine working groups so if you unlock layers & run ObjISO agan without Unisolating the previous group that layer data will be lost.
Mr Cory
2007-03-19, 10:33 PM
I figured that mite be the case, I get a message saying that "no variable set can not restore objects" Did the original not delete the layer once things were unisolated?
kennet.sjoberg
2007-03-21, 01:23 AM
Create a temporary block with all objects that you want "only visible" and lock the insertion layer.
Explode it when you are done.
I had to wake it up. . .
(defun c:LockObj ( / OldLay SelSet TempBlock )
(setq OldLay (getvar "CLAYER" ) )
(prompt "\nCommand: Select object(s) to Lock : " )
(if (setq SelSet (ssget) )
(progn
(if (tblsearch "LAYER" "LockLay" ) (setvar "CLAYER" "LockLay" ) (command "._layer" "m" "LockLay" "" ) )
(while (tblsearch "BLOCK" (setq TempBlock (vl-string-left-trim (getenv "TEMP" ) (vl-filename-mktemp )))) )
(command "._block" TempBlock '(0.0 0.0 0.0 ) SelSet "" ) ; you must --^-- check if this one exist, or change it
(command "._insert" TempBlock '(0.0 0.0 0.0 ) "" "" "" ) ; so it correspond with the vl-filename-mktemp statement
(setvar "CLAYER" OldLay )
(command "._layer" "LO" "LockLay" "" )
(princ (strcat "\nCommand: " (itoa (sslength SelSet )) " object(s) Locked. " ) )
)
(princ "..no object selected. " )
)
(princ)
)
(defun c:UnLockObj ( / SelSet Objects Item BlName )
(vl-load-com)
(prompt "\nCommand: Select object(s) to UnLock : " )
(if (setq SelSet (ssget '((0 . "INSERT") (8 . "LockLay" ))) )
(progn
(setq Objects 0 Item 0 )
(command "._layer" "u" "LockLay" "" )
(repeat (sslength SelSet )
(setq BlName (cdr (assoc 2 (entget (ssname SelSet Item )))) )
(command "._explode" (ssname SelSet Item ) )
(setq Objects (+ Objects (sslength (ssget "_P" ))) )
(vla-Delete (vla-Item (vla-get-Blocks (vla-get-ActiveDocument (vlax-get-Acad-Object )) ) BlName ))
(setq Item (1+ Item ))
)
(command "._layer" "LO" "LockLay" "" )
(princ (strcat "\nCommand: " (itoa Objects ) " object(s) UnLocked. " ) )
)
(princ "..no legal object(s) selected." )
)
(princ)
)
: ) Happy Computing !
kennet
Mr Cory
2007-03-21, 01:36 AM
Cool, thats another way Cheers for your time!
kennet.sjoberg
2007-03-21, 01:48 AM
Cool, thats another way Cheers for your time!
It's fun, isn’t it ?
Enjoy :beer:
: ) Happy Computing !
kennet
Mr Cory
2007-03-28, 03:34 AM
Is there anyway to force all the objects that are locked turn to colour 8? Then be restored to their appropriate colours upon being unisolated?
Mr Cory
2007-04-13, 04:24 AM
Anyone know if this is possible?
kennet.sjoberg
2007-04-15, 02:22 AM
Anyone know if this is possible?
Yes it is possible, but it is a bad task/idea.
: ) Happy Computing !
kennet
Mr Cory
2007-04-15, 06:20 AM
Kennet, why is this so? How would you go about doing is? I thought i might be simple modifing the lisp posted by CAB2k so that when it changes the objects colour instead of changing the layer?
kennet.sjoberg
2007-04-15, 11:01 AM
Kennet, why is this so? How would you go about doing is? I thought i might be simple modifing the lisp posted by CAB2k so that when it changes the objects colour instead of changing the layer?
To change the colour of the objects in the block is easy, but you have to remember each colour to each objects and save the information in a safe place, so you can restore the colour before you explode the block so all objects will return to the previous state, in this task or next year.
: ) Happy Computing !
kennet
peter
2007-04-15, 05:37 PM
One way to do it.
Maybe...
Another way to do it is to create a block of all of the objects not selected put it on a locked layer, and then manipulate the selected objects and then later explode the block.
(defun C:Isolate (/ entSelection ssSelection1 ssSelection2)
(princ "\nSelect Objects to Isolate: ")
(setq ssSelection1 (ssget)
ssSelection2 (ssget "x" (list (cons 410 (getvar "ctab"))))
)
(repeat (setq intCount (sslength ssSelection1))
(setq entSelection (ssname ssSelection1 (setq intCount (1- intCount)))
ssSelection2 (ssdel entSelection ssSelection2)
)
)
(command "block" (setq strBlock (rtos (getvar "cdate") 1 10)) "0,0" ssSelection2 "")
(command "insert" strBlock "0,0" "1" "1" "0")
(while (= (getvar "cmdactive") 1)(command ""))
(command "layer" "m" "lockit" "lo" "lockit" "")
(command "change" (entlast) "" "p" "la" "lockit" "")
(princ)
)
Peter
Mr Cory
2007-04-15, 10:47 PM
Im not worried about the objects being isolated, its more just changing the colour to colour 8, if that makes it easier lol
kennet.sjoberg
2007-04-15, 11:46 PM
Im not worried about the objects being isolated, its more just changing the colour to colour 8, if that makes it easier lol
Here is how I should do lol
When locking lol :
- retrive all selected objects handles and colour info lol,
- write the info as XDATA to the new created block lol,
- change all object in the block to colour 8 lol.
When unlocking lol :
- read the blocks XDATA lol,
- reset the colour to original state lol,
- explode the block lol.
You need to know about -3 code and 1001 group lol,
all documented behind the [F1] button lol
: ) Happy Computing lol !
kennet
BTW lol is not needed
Mr Cory
2007-04-16, 12:04 AM
BTW lol is not needed
Figured that
K you lost me. Thats ok though ill just use regions and hide when i go to print. Thanks for you time
kennet.sjoberg
2007-04-16, 12:11 AM
K you lost me. . . .
No problem, because there is a breakpoint between free and fee... 8)
: ) Happy Computing !
kennet
vBulletin® v3.6.7, Copyright ©2000-2009, Jelsoft Enterprises Ltd.