I would like some help in understanding error trapping and the like. I've writte this procedure for a job I'm doing and I don't want to send it out able to break. What I'd like is for someone to, if it's possible, show me where to put in something like vl-catch- and vl-exit-with functions and then make this thing error out properly. As you can see in the t statement in the code, it says it's going to reset variables. I have nothing to do that with.
;;;-------------------------pseudo-code-----------------------------------;
;;;-Take a selection set (any number of ssget objects) and parse through ;
;;; them converting each object to a vla-object and appending them in a ;
;;; list. Then, deleting the entity from the selection set, until the loop;
;;; returns nil. Make sure the selection set is of type pickset ;
;;;-------------------------ss-vla-list-----------------------------------;
;;;-Takes any selection set and coverts it into a list of AX objects ;
;;;-Arguments: selection set ;
;;;-Example: (ss-vla-list ss) ;
;;;-----------------------------------------------------------------------;
;;; Author: Daron Rogers ;
;;; Date: October 22, 2004 10:32PM ;
;;;_______________________________________________________________________;
(defun ss-vla-list (selset / ename ax-list)
;define function (arguments / local vars)
(cond
((= (type selset) 'PICKSET)
;ensures the argument selset is usable by the ssname function
(while (setq ename (ssname selset 0))
;while there are entity names in selset
(setq ax-list
(append
ax-list
;append each item in the list to each other
(list (vlax-ename->vla-object ename))
;after converting them to ActiveX objects
)
)
(ssdel (ssname selset 0) selset)
;ssdel will take selset and remove the first item in the list
)
)
(t
(princ
"\nArgument passed to this function was not of TYPE, PICKSET.\nResetting variables."
)
(setq ax-list nil)
)
)
;while continues until ename variable equals nil
ax-list
;ax-list is the return value. If it weren't there ss-vla-list would
;return nil and any program accessing it would error out.
)
P.S. I just remembered another thing. Can someone show me how to properly use entdel. I was trying to use it yesterday and although it deleted the object, it would error out, thus making further calls not work.