(defun c:test ( / ll-pt ss ss1 ss2 ur-pt )
(initget 1)
(setq ll-pt (getpoint "\nLOWER LEFT point :"))
(initget 32)
(setq ur-pt (getcorner ll-pt "\nUPPER RIGHT point :"))
(setq ss1 (ssget "_C" ll-pt ur-pt))
(if (:VLA-EXPLODE-SS ss1)
(setq ss2 (ssget "_C" ll-pt ur-pt))
)
(setq r ss2)
)
Try with this simple mod...I think he wants to have a selection (SS2) even if there are no objects to explode...Quote(defun c:test ( / ll-pt ss ss1 ss2 ur-pt )
(initget 1)
(setq ll-pt (getpoint "\nLOWER LEFT point :"))
(initget 32)
(setq ur-pt (getcorner ll-pt "\nUPPER RIGHT point :"))
(setq ss1 (ssget "_C" ll-pt ur-pt))
(if (:VLA-EXPLODE-SS ss1)
(setq ss2 (ssget "_C" ll-pt ur-pt))
)
(setq r ss2)
)
(eq '() nil) => T
(null '()) => T
(not '()) => T
(not nil) => T
(null nil) => T
(type '()) => nil
(type nil) => nil
(defun :SS>OBJECT-LIST (ss / ind r)
(setq ind 0)
(repeat (sslength ss)
(setq r (cons (vlax-ename->vla-object (ssname ss ind) ) r) ) (setq ind (+ 1 ind) )
)
(reverse r)
)
(defun :VLA-EXPLODE-SS (ss / new-obj-lst ss-obj-lst)
(setq ss-obj-lst (:SS>OBJECT-LIST ss) )
(mapcar '(lambda (x-obj)
(if(vlax-method-applicable-p x-obj 'explode)
(progn
(setq new-obj-lst (append (vlax-invoke x-obj 'explode) new-obj-lst ) )
(vla-delete x-obj)
)
)
)
ss-obj-lst
)
new-obj-lst
)
(defun c:test ( / ll-pt ss1 ss2 ur-pt)
(setq ll-pt (getpoint "\nLOWER LEFT point :"))
(initget 32)
(setq ur-pt (getcorner ll-pt "\nUPPER RIGHT point :"))
(setq ss1 (ssget "_C" ll-pt ur-pt) )
(:VLA-EXPLODE-SS ss1)
(setq ss2 (ssget "_C" ll-pt ur-pt) )
)
I think he wants to have a selection (SS2) even if there are no objects to explode...
I have tried several times without the DELAY and always I get a selection.
(eq '() nil) => T
(null '()) => T
(not '()) => T
(not nil) => T
(null nil) => T
(type '()) => nil
(type nil) => nil
locals are always nil or '() >>> (eq '() nil) => TQuote(eq '() nil) => T
(null '()) => T
(not '()) => T
(not nil) => T
(null nil) => T
(type '()) => nil
(type nil) => nil
Why do you post this ?
A2020:QuoteI have tried several times without the DELAY and always I get a selection.
in acad 2020 ?
without the DELAY, I NEVER get a selection !
locals are always nil or '() >>> (eq '() nil) => T
(setq r '())
(setq new-obj-lst '() )
A2020:
Command: TEST
LOWER LEFT point :
UPPER RIGHT point :<Selection set: 19>
Command:
Command: TEST
LOWER LEFT point :
UPPER RIGHT point :<Selection set: 20>
Command:
Command: TEST
LOWER LEFT point :
UPPER RIGHT point :<Selection set: 27>
Command:
Command: TEST
LOWER LEFT point :
UPPER RIGHT point :<Selection set: 2e>
Command:
Command: TEST
LOWER LEFT point :
UPPER RIGHT point :<Selection set: 35>
only if the selection does not contain explodable objects.
Playing with words...Quoteonly if the selection does not contain explodable objects.
only if the selection does contain not explodable objects.
(defun c:test ( / ll-pt ss1 ss2 ur-pt )
(initget 1)
(setq ll-pt (getpoint "\nLOWER LEFT point :"))
(initget 33)
(setq ur-pt (getcorner ll-pt "\nUPPER RIGHT point :"))
(setq ss1 (ssget "_C" ll-pt ur-pt))
(if (:VLA-EXPLODE-SS ss1)
(setq ss2 (ssget "_C" ll-pt ur-pt))
(setq ss2 (ssget "_C" ll-pt ur-pt))
)
(setq r ss2)
)
Draw 4 or 5 polylines.Yes it is correct… What do you want to achieve in the end? a list of VlaObj or a Selset?
Copy them 4-5 times.
And repeat the test . . .
When they are exploded, (ss1 contains only polylines)
ss2 is NIL
If there is no polyline to explode,
ss2 is a selection set.
QuoteDraw 4 or 5 polylines.Yes it is correct… What do you want to achieve in the end? a list of VlaObj or a Selset?
Copy them 4-5 times.
And repeat the test . . .
When they are exploded, (ss1 contains only polylines)
ss2 is NIL
If there is no polyline to explode,
ss2 is a selection set.
You want everything to be written for you...
Have you tried :Code: [Select](defun c:test ( / ll-pt ss1 ss2 ur-pt )
(initget 1)
(setq ll-pt (getpoint "\nLOWER LEFT point :"))
(initget 33)
(setq ur-pt (getcorner ll-pt "\nUPPER RIGHT point :"))
(setq ss1 (ssget "_C" ll-pt ur-pt))
(if (:VLA-EXPLODE-SS ss1)
(setq ss2 (ssget "_C" ll-pt ur-pt))
(setq ss2 (ssget "_C" ll-pt ur-pt))
)
(setq r ss2)
)
The question is :
(setq ss1 (ssget "_C" ll-pt ur-pt))
if SS1 is not NIL,
why
(setq ss2 (ssget "_C" ll-pt ur-pt))
sometimes returns NIL ?
ONLY THIS !
and what is the difference between this :
(if (:VLA-EXPLODE-SS ss1)
(setq ss2 (ssget "_C" ll-pt ur-pt))
(setq ss2 (ssget "_C" ll-pt ur-pt))
)
and this :
(:VLA-EXPLODE-SS ss1)
(setq ss2 (ssget "_C" ll-pt ur-pt))
?
if entities are not explodable, routine tries explosion,originals are deleted only if are explodable and exploded
but unsucessful and originals are deleted
if not, (vla-explode) is useless and originals are removed, so ss2 is nil...originals are deleted only if are explodable and exploded
(if (eq (vla-get-explodable (vlax-ename->vla-object ename)) :vlax-true)is it not the same of :
The difference is just what you know : ss2 must wait until :VLA-EXPLODE finishes...... and I am trying to understand WHY this happens ?
(if (:VLA-EXPLODE-SS ss1)
(setq ss2 (ssget "_C" ll-pt ur-pt))
(setq ss2 (ssget "_C" ll-pt ur-pt))
)
(if (:VLA-EXPLODE-SS ss1)
(setq ss2 (ssget "_C" ll-pt ur-pt))
(setq ss2 (ssget "_C" ll-pt ur-pt))
)
Comando: TEST
LOWER LEFT point :
UPPER RIGHT point :
10 ss1 Length
45 new-obj-lst Length
1 ss2 Length
Comando: TESTMR
LOWER LEFT point :
UPPER RIGHT point :
10 ss1 Length
1 ss2 Length
45 new-obj-lst Length
ONLY POLYLINES:(defun c:test ( / ll-pt ss1 ss2 ur-pt)
(setq ll-pt (getpoint "\nLOWER LEFT point :"))
(initget 32)
(setq ur-pt (getcorner ll-pt "\nUPPER RIGHT point :"))
(print (sslength (setq ss1 (ssget "_C" ll-pt ur-pt) ))) (princ " ss1 Length ")
(print (length (:VLA-EXPLODE-SS ss1))) (princ " new-obj-lst Length")
(print (sslength (setq ss2 (ssget "_C" ll-pt ur-pt) ))) (princ " ss2 Length ")
(princ)
)
(defun c:testMR ( / ll-pt ss1 ss2 ur-pt ObjLst)
(initget 1)
(setq ll-pt (getpoint "\nLOWER LEFT point :"))
(initget 33)
(setq ur-pt (getcorner ll-pt "\nUPPER RIGHT point :"))
(print (sslength (setq ss1 (ssget "_C" ll-pt ur-pt) ))) (princ " ss1 Length ")
(if (setq ObjLst (:VLA-EXPLODE-SS ss1))
(progn (print (sslength (setq ss2 (ssget "_C" ll-pt ur-pt)))) (princ " ss2 Length "))
(progn (print (sslength (setq ss2 (ssget "_C" ll-pt ur-pt)))) (princ " ss2 Length "))
)
(print (length ObjLst)) (princ " new-obj-lst Length")
(princ)
)
Domenico: What do you want to achieve in the end? a list of VlaObj or a Selset?
Try (vla-Update (vlax-get-acad-object))
When you use ssget selection methods ("C" "W" etc. which detect objects on the screen) the objects selected are the objects visible in the drawing area at the time of evaluation of the graphical selection, newly generated objects are not recognized by ssget until the drawing area is updated.RIGHT !
If you want to avoid updating the display list you have to merge the list new-obj-lst with the selection set ss2 as I suggested with my question:When you use ssget selection methods ("C" "W" etc. which detect objects on the screen) the objects selected are the objects visible in the drawing area at the time of evaluation of the graphical selection, newly generated objects are not recognized by ssget until the drawing area is updated.RIGHT !
What do you want to achieve in the end? a list of VlaObj or a Selset?