ade_editlockobjs

AutoCAD Map 3D AutoLISP

Up a level
ade_editlockobjs
 
 

Locks a set of objects and adds them to the save set.

(ade_editlockobjs sel_set)

Returns the number of objects locked (real) or nil.

sel_set Selection set name.

The function locks the objects contained in the designated selection set. Locking these objects adds them to the save set.

It is a good idea to compare the number of objects locked with the number of objects in the designated selection set. If the number locked is less than the number in the selection set, an error occurred in the locking process, and you should check the error stack.

The following example creates a selection set, adds its object to the save set, and checks the result.

(entmake '(
     ( 0 . "circle") 
     (62 . 1) 
     (10 12.0 2.0 0.0) 
     (40 . 1.0))) 
; Get the new entity.
(setq e (entlast))
; Create a selection set containing e.
(setq ss (ssadd e))
; Check how many objects in ss.
(setq num_tolock (sslength ss))
; Lock the objects in ss and get the number locked.
(setq num_locked (fix (ade_editlockobjs ss)))
          ; Fix truncates the real return value of  
          ; ade_editlockobjs. 
(if (equal num_tolock num_locked)
    (progn 
         (princ "\nObjects locked " 
         (princ "and added to save set: ") 
         (princ num_locked)) 
    (princ "\nUh-oh") 
)