Problems with (vla-select ...)

Alexander V. Koshman

Usenet Archive
Joined
Dec 16, 2003
Messages
61
Reaction score
0
Hello NG!
I want to try to work with ActiveX part of VLISP and can't achieve success... I have to realize ActiveX variant of:

;;; (setq ss (ssget "x" '((8 . "Layer1"))))

And AutoCAD selects ALL the objects and doesn't filter them!
What I do wrong???

(setq acad (vlax-get-Acad-Object))
(setq doc (vla-get-ActiveDocument acad))
(setq ss (vla-add (vla-get-SelectionSets doc) "temp_ss")) (vla-select ss acSelectionSetAll (vlax-SafeArray-Fill (vlax-Make-SafeArray vlax-vbInteger (cons 0 0)) (list
8))
(vlax-SafeArray-Fill (vlax-Make-SafeArray vlax-vbVariant (cons 0 0)) (list "Layer1")) ) ; - 'vla-select' (alert (strcat "Number of objects: " (itoa (vla-get-Count ss))))
 
Oh my God!

I found it!

Reply From: Bell, R. Robert
Re: AcSelectionSetAll Method

Great thanks to you Robert!!!

;;; ============================================================= (setq ss (vla-add (vla-get-SelectionSets doc) "temp_ss"))

(vla-select ss acSelectionSetAll

nil ; - 'for OPTIONAL Point1' ; )

nil ; - 'for OPTIONAL Point2' ; )

(vlax-SafeArray-Fill (vlax-Make-SafeArray vlax-vbInteger (cons 0 0)) (list
60))

(vlax-SafeArray-Fill (vlax-Make-SafeArray vlax-vbVariant (cons 0 0)) (list
1))

) ; - 'vla-select'
;;; =============================================================

Thanks again to everybody for your time
and your hard labour of asking and aswering! : )
 
This is the way that I ended up working with ActiveX selection sets in vlisp.

(setq ss (ssget "x" '((8 . "Layer1"))))

(if ss
(setq vlaSS
(vla-get-ActiveSelectionSet
(vla-get-activeDocument
(vlax-get-acad-object)
)
)
)
)
 
Yes!
Thank you Bobby for an another way!

And how about simply

(setq ss (ssget "x" '((8 . "Layer1"))))

and then

(vlax-ename->vla-object ...)

?

Will there be problems using the selection sets
made with (ssget ...) in the reactors callback functions?

Alexander V. Koshman
 
Hi Alexander,
Yes, it is possible to iterate the lisp selection set and get the ActiveX wrapper for each object within like you've shown. I personally prefer to grab the ActiveX selection set and iterate it with the (vlax-for...) statement though. That just comes down to a personal preference IMHO and I don't see a problem with either method.

The act of creating selections sets with (ssget...) in and of itself shouldn't cause problems in your callback functions.

Hope that helps!
 

Latest threads

Back
Top