Hello
Maybe this question is so obvious, but I don't know how get multiple values from a subroutine:
For example I have "Entities-within-a-block" subroutine and I want to get values of SubEnt , SubEntLst , SubEntLstTot
How can I do this?
Thanks.
Code:
(defun C:Blksuen ()
(defun Entities-within-a-block (BlockSelect / SubEnt SubEntLst SubEntLstTot)
;;; ; get the entity list
(setq Ent (car BlockSelect))
(setq EntLst (entget Ent))
(setq SubEntLstTot nil)
;;; ; if the entity selected was an insert
(if (equal "INSERT" (cdr (assoc 0 EntLst)))
(progn
;;; ; get entity name from block table
(setq Ename (tblobjname "block" (cdr (assoc 2 EntLst))))
;;; ; get entity list from block table
(setq EntLst (entget Ename))
;;; ; get first subentity of the block
(setq SubEnt (entnext Ename))
(while SubEnt
;;; ; get sub entity list
(setq SubEntLst (entget SubEnt))
(setq SubEntLstTot (append SubEntLstTot (list SubEntLst)))
;;; ; get next subentity and repeat
(setq SubEnt (entnext SubEnt))
)
)
;;; ;else the selection was not an insert
(princ "\selection was not a Block")
)
)
;;; ; select an entity
(setq Entselect (entsel "\nselect border Block: "))
(setq li nil)
(setq li (Entities-within-a-block Entselect))
(print li)
(princ)
)