0 Members and 1 Guest are viewing this topic.
; SS - Pickset; SSnm - name for the selection set to be stored in the SS collection(defun VanillaSS->VlaSS ( SS SSnm / i L SScoll SfArrayObjs vSS ) (cond ( (not (eq 'PICKSET (type SS))) nil) ( (not (and (eq 'STR (type SSnm)) (snvalid SSnm))) nil) (T (repeat (setq i (sslength SS)) (setq L (cons (vlax-ename->vla-object (ssname SS (setq i (1- i)))) L)) ) (setq SScoll (vla-get-SelectionSets (vla-get-ActiveDocument (vlax-get-acad-object)))) (if (not (vl-catch-all-error-p (vl-catch-all-apply 'vla-Item (list SScoll SSnm)))) (vla-Delete (vla-Item SScoll SSnm)) ) (setq vSS (vla-Add SScoll SSnm)) (setq SfArrayObjs (vlax-make-safearray vlax-vbObject (cons 0 (1- (length L))))) (setq i -1) (foreach o L (vlax-safearray-put-element SfArrayObjs (setq i (1+ i)) o) ) (vla-AddItems vSS SfArrayObjs) vSS ) ); cond); defun VanillaSS->VlaSS
(defun ss2vlalst (ss) (if (= (type ss) 'pickset) (mapcar 'vlax-ename->vla-object (vl-remove-if 'listp (mapcar 'cadr (ssnamex ss)))) ));; (ss2vlalst (ssget))
what are you doing with a vla ss that you can't accomplish with a list of vla objects?
Quote from: ronjonp on March 16, 2017, 01:36:16 pmwhat are you doing with a vla ss that you can't accomplish with a list of vla objects?Saving it as a named SS, that could be gripped later (I think). But I like tasks, even if they have purely academical purpose.