;|Reply From: Esquivel, Luis Date: May/05/03 - 06:54 (GMT) Re: Reactor kevin bell, >Is it possible to quiry an object to find out what reactors are attached to it ??? Here are two functions that will help you: |; ;; will return T if an object has reactor attached (defun HAS-REACTOR? (OBJ) (vl-some (function (lambda (X) (numberp X))) (mapcar (function (lambda (R) (vl-position OBJ (vlr-owners R)))) (cdar (vlr-reactors :vlr-object-reactor)) ) ) ) ;; this will return a list of reactors attached to the object of the type: :vlr-object-reactor (defun WHAT-REACTOR? (OBJ) (vl-remove-if-not (function (lambda (R) (if (vl-position OBJ (vlr-owners R)) R ) ) ) (cdar (vlr-reactors :vlr-object-reactor)) ) ) ;;And here is another one to query to any type of reactor: ;; (attached-to obj) ;; return a list with the list of reactors or nil (defun ATTACHED-TO (OBJ) (vl-remove NIL (mapcar (function (lambda (REACTOR-TYPE) (vl-remove-if-not (function (lambda (R) (cond ((and (equal REACTOR-TYPE :vlr-object-reactor) (vl-position OBJ (vlr-owners R)) ) R ) ((and (not (equal REACTOR-TYPE :vlr-object-reactor ) ) (vl-position OBJ (vlr-data R)) ) R ) ) ) ) (cdar (vlr-reactors REACTOR-TYPE)) ) ) ) (vlr-types) ) ) ) |