Author Topic: vla-explode and delay  (Read 4257 times)

0 Members and 1 Guest are viewing this topic.

domenicomaria

  • Swamp Rat
  • Posts: 724
vla-explode and delay
« on: May 09, 2021, 02:41:14 AM »
Code - Auto/Visual Lisp: [Select]
  1. (defun :SS>OBJECT-LIST (ss / ind r)
  2.    (setq ind 0 r '())
  3.    (repeat (sslength ss)
  4.       (setq r (cons (vlax-ename->vla-object (ssname ss ind) ) r) )      (setq ind (+ 1 ind) )
  5.    )
  6.    (reverse r)
  7. )
  8.  
  9.  
  10. (defun :VLA-EXPLODE-SS (ss /  new-obj-lst ss-obj-lst x-obj)
  11.    (setq ss-obj-lst (:SS>OBJECT-LIST ss) )
  12.    
  13.    (setq new-obj-lst '() )
  14.    (mapcar '(lambda    (x-obj)
  15.                      (if(vlax-method-applicable-p x-obj 'explode)
  16.                         (progn
  17.                            (setq new-obj-lst (append (vlax-invoke x-obj 'explode) new-obj-lst ) )
  18.                            (vla-delete x-obj)
  19.                         )
  20.                      )
  21.             )
  22.               ss-obj-lst
  23.    )
  24.    new-obj-lst
  25. )
  26.  
  27.  
  28. ;   TEST    asks 2 POINTS
  29. ;         selects with the CROSSING option using these 2 POINTS
  30. ;         and gets the selection 2 TIMES :
  31. ;         BEFORE and AFTER the SELECION has been EXPLODED
  32. (defun c:test ( / ll-pt ss ss1 ss2 ur-pt)
  33.    (setq ll-pt (getpoint "\nLOWER LEFT point :"))
  34.    (initget 32)
  35.    (setq ur-pt (getcorner ll-pt "\nUPPER RIGHT point :"))
  36.    (setq ss1 (ssget "_C" ll-pt ur-pt) )
  37.    
  38.    (:VLA-EXPLODE-SS ss1)
  39.    ;   (command "delay" 10)  
  40.    (setq ss2 (ssget "_C" ll-pt ur-pt) )
  41.    
  42.    (setq r ss2)
  43. )
  44.  
  45.  

select some polylines, using the TEST function

If (command "delay" 10)   is commented
ss2 is NIL

IF NOT it is a VALID SELECTION SET !

WHY ?
« Last Edit: May 09, 2021, 02:45:11 AM by domenicomaria »

ribarm

  • Gator
  • Posts: 3245
  • Marko Ribar, architect
Re: vla-explode and delay
« Reply #1 on: May 09, 2021, 03:56:46 AM »
Try with this simple mod...

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)
)
Marko Ribar, d.i.a. (graduated engineer of architecture)

:)

M.R. on Youtube

Marc'Antonio Alessi

  • Swamp Rat
  • Posts: 1451
  • Marco
Re: vla-explode and delay
« Reply #2 on: May 09, 2021, 04:15:26 AM »
Try with this simple mod...

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)
)
I think he wants to have a selection (SS2) even if there are no objects to explode...

Marc'Antonio Alessi

  • Swamp Rat
  • Posts: 1451
  • Marco
Re: vla-explode and delay
« Reply #3 on: May 09, 2021, 04:19:23 AM »
I removed some local variables and more...
I have tried several times without the DELAY and always I get a selection.
Code: [Select]
(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) )
)

domenicomaria

  • Swamp Rat
  • Posts: 724
Re: vla-explode and delay
« Reply #4 on: May 09, 2021, 04:40:25 AM »
Quote
I think he wants to have a selection (SS2) even if there are no objects to explode...

yes

domenicomaria

  • Swamp Rat
  • Posts: 724
Re: vla-explode and delay
« Reply #5 on: May 09, 2021, 04:42:16 AM »
Quote
I have tried several times without the DELAY and always I get a selection.

in acad 2020 ?

without the DELAY, I NEVER get a selection !

domenicomaria

  • Swamp Rat
  • Posts: 724
Re: vla-explode and delay
« Reply #6 on: May 09, 2021, 04:43:38 AM »
Quote
(eq '() nil) => T
(null '())   => T
(not '())    => T
(not nil)    => T
(null nil)   => T
(type '()) => nil
(type nil) => nil

Why do you post this ?

Marc'Antonio Alessi

  • Swamp Rat
  • Posts: 1451
  • Marco
Re: vla-explode and delay
« Reply #7 on: May 09, 2021, 05:14:56 AM »
Quote
(eq '() nil) => T
(null '())   => T
(not '())    => T
(not nil)    => T
(null nil)   => T
(type '()) => nil
(type nil) => nil

Why do you post this ?
locals are always nil or '()   >>>   (eq '() nil) => T

(setq r '())
(setq new-obj-lst '() )

Marc'Antonio Alessi

  • Swamp Rat
  • Posts: 1451
  • Marco
Re: vla-explode and delay
« Reply #8 on: May 09, 2021, 05:19:42 AM »
Quote
I have tried several times without the DELAY and always I get a selection.

in acad 2020 ?

without the DELAY, I NEVER get a selection !
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>

Command:
Command:  TEST

LOWER LEFT point :
UPPER RIGHT point :<Selection set: 3c>

Command:
Command:  TEST

LOWER LEFT point :
UPPER RIGHT point :<Selection set: 43>

Command:
Command:  TEST

LOWER LEFT point :
UPPER RIGHT point :<Selection set: 4a>

domenicomaria

  • Swamp Rat
  • Posts: 724
Re: vla-explode and delay
« Reply #9 on: May 09, 2021, 06:03:24 AM »
Quote
locals are always nil or '()   >>>   (eq '() nil) => T

(setq r '())
(setq new-obj-lst '() )

I know that local vars are always NIL.

I write (setq r '()) or (setq new-obj-lst '() )

just to show to myself, that I initializing a new var to nil . . .

But It has no sense ! . . .


domenicomaria

  • Swamp Rat
  • Posts: 724
Re: vla-explode and delay
« Reply #10 on: May 09, 2021, 06:26:01 AM »
Quote
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>

Draw 4 or 5 polylines.

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.

The problem
(I believe)
is the SEQUENCE
that is NOT RESPECTED.

(setq ss2 (ssget "_C" ll-pt ur-pt) )
does NOT WAIT that
(:VLA-EXPLODE-SS ss1) has finished !

If ss1 does not contain EXPLODABLE objects,
(:VLA-EXPLODE-SS ss1)
needs less time to finish.

And this time is enough.

And
(setq ss2 (ssget "_C" ll-pt ur-pt) )
gets the selection set !

It is very strange !
If I enable the DELAY

I get ALWAYS a selection set.

If NOT,
i get a selection set,
only if the selection does not contain explodable objects.

« Last Edit: May 09, 2021, 06:32:39 AM by domenicomaria »

ribarm

  • Gator
  • Posts: 3245
  • Marko Ribar, architect
Re: vla-explode and delay
« Reply #11 on: May 09, 2021, 07:02:21 AM »
Playing with words...

Quote
only if the selection does not contain explodable objects.

only if the selection does contain not explodable objects.
Marko Ribar, d.i.a. (graduated engineer of architecture)

:)

M.R. on Youtube

domenicomaria

  • Swamp Rat
  • Posts: 724
Re: vla-explode and delay
« Reply #12 on: May 09, 2021, 07:13:37 AM »
Playing with words...

Quote
only if the selection does not contain explodable objects.

only if the selection does contain not explodable objects.

If you want change the text
you have to write :
only if the selection does contains not explodable objects.

But this is not the main question.

ribarm

  • Gator
  • Posts: 3245
  • Marko Ribar, architect
Re: vla-explode and delay
« Reply #13 on: May 09, 2021, 07:32:50 AM »
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)
)
Marko Ribar, d.i.a. (graduated engineer of architecture)

:)

M.R. on Youtube

domenicomaria

  • Swamp Rat
  • Posts: 724
Re: vla-explode and delay
« Reply #14 on: May 09, 2021, 10:18:06 AM »
only this :
(setq ss2 (ssget "_C" ll-pt ur-pt))

no need of "if"

as in the original code
...

Marc'Antonio Alessi

  • Swamp Rat
  • Posts: 1451
  • Marco
Re: vla-explode and delay
« Reply #15 on: May 09, 2021, 10:27:21 AM »
Quote
Draw 4 or 5 polylines.
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.
Yes it is correct… What do you want to achieve in the end? a list of VlaObj or a Selset?

ribarm

  • Gator
  • Posts: 3245
  • Marko Ribar, architect
Re: vla-explode and delay
« Reply #16 on: May 09, 2021, 10:47:34 AM »
If you want to get rid of : delay, and achieve the same result as with delay, I am afraid, you'll have to go with (if), just like in example I showed...
Marko Ribar, d.i.a. (graduated engineer of architecture)

:)

M.R. on Youtube

domenicomaria

  • Swamp Rat
  • Posts: 724
Re: vla-explode and delay
« Reply #17 on: May 09, 2021, 11:26:06 AM »
Quote
Draw 4 or 5 polylines.
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.
Yes it is correct… What do you want to achieve in the end? a list of VlaObj or a Selset?

1 - I select with "crossing" ll-pt ur-pt the first time, and get ss1
2 - I try to explode ss1
3 - I do the same previous selection ... "crossing" ll-pt ur-pt and I have to get ss2
     ... ss2 could contain or the same objects before they are exploded
      or the new objects after they are exploded or a mix ...

...anyway I have to get a selecion set...
... but sometimes it is NIL
... SS1 is a selection set
... SS2 is NIL
... with the same selection ... "crossing" ...

When they are exploded, (ss1 contains only polylines) ss2 is NIL
this is NON CORRECT

SS2 must get anyway something with the same selection  ... "crossing" ...

The question is NOT : what VLA-EXPLODE-SS returns.

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 !
« Last Edit: May 09, 2021, 11:37:42 AM by domenicomaria »

domenicomaria

  • Swamp Rat
  • Posts: 724
Re: vla-explode and delay
« Reply #18 on: May 09, 2021, 11:30:32 AM »
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)
)

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))

?

domenicomaria

  • Swamp Rat
  • Posts: 724
Re: vla-explode and delay
« Reply #19 on: May 09, 2021, 11:41:28 AM »
Quote
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  I believe that
this is because
(setq ss2 (ssget "_C" ll-pt ur-pt))
does not wait long enough
that (:VLA-EXPLODE-SS ss1)
finishes his work . . .
. . .
so if I ask to WAIT (DELAY)
it WORKS !
« Last Edit: May 09, 2021, 11:44:46 AM by domenicomaria »

ribarm

  • Gator
  • Posts: 3245
  • Marko Ribar, architect
Re: vla-explode and delay
« Reply #20 on: May 09, 2021, 12:16:11 PM »
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))

?

The difference is just what you know : ss2 must wait until :VLA-EXPLODE finishes... The trick is that with just your second example, ss2 don't wait for checking return values of execution of :VLA-EXPLODE and so ss2 gets selection set as soon as there is nothing left behind after explode - if entities are not explodable, routine tries explosion, but unsucessful and originals are deleted and there are no checking for existance of leftovers. With first example (if) is checking for things left in collected list of new enitities, and if something is founded, ss2 gets both leftovers and what it finds beside it, else if there are no leftovers it gets just what it finds beside like there were no checking... So first exampe is somewhat more reliable than second, but all in all, in fact both should return something if first ss1 contains explodable entities, if not, (vla-explode) is useless and originals are removed, so ss2 is nil... You should be aware of what :VLA-EXPLODE do : in fact you should edit it so that only if entities are explodable (if (eq (vla-get-explodeble (vlax-ename->vla-object ename)) :vlax-true), it deletes originals, else it shouldn't do anything, neither explodeing, nor deleting them...
Marko Ribar, d.i.a. (graduated engineer of architecture)

:)

M.R. on Youtube

domenicomaria

  • Swamp Rat
  • Posts: 724
Re: vla-explode and delay
« Reply #21 on: May 09, 2021, 12:32:49 PM »
Quote
if entities are not explodable, routine tries explosion,
but unsucessful and originals are deleted
originals are deleted only if are explodable and exploded

Code - Auto/Visual Lisp: [Select]
  1. (if(vlax-method-applicable-p x-obj 'explode)
  2.    (progn
  3.       (setq new-obj-lst (append (vlax-invoke x-obj 'explode) new-obj-lst ) )
  4.       (vla-delete x-obj)
  5.    )
  6.  )

...

Quote
if not, (vla-explode) is useless and originals are removed, so ss2 is nil...
originals are deleted only if are explodable and exploded
...

Quote
(if (eq (vla-get-explodable (vlax-ename->vla-object ename)) :vlax-true)
is it not the same of :
(if(vlax-method-applicable-p x-obj 'explode) ?
...

Quote
The difference is just what you know : ss2 must wait until :VLA-EXPLODE finishes...
... and I am trying to understand WHY this happens ?

Quote
(if (:VLA-EXPLODE-SS ss1)
   (setq ss2 (ssget "_C" ll-pt ur-pt))
   (setq ss2 (ssget "_C" ll-pt ur-pt))
)

Any way, this one could be a good workaround . . .
I will give it a try.
...
But the main question is : WHY this happens ?

domenicomaria

  • Swamp Rat
  • Posts: 724
Re: vla-explode and delay
« Reply #22 on: May 09, 2021, 12:45:19 PM »
Quote
(if (:VLA-EXPLODE-SS ss1)
   (setq ss2 (ssget "_C" ll-pt ur-pt))
   (setq ss2 (ssget "_C" ll-pt ur-pt))
)

anyway it doesn't work

it is not useful

(setq ss2 (ssget "_C" ll-pt ur-pt))

doesn't wait :VLA-EXPLODE-SS

Marc'Antonio Alessi

  • Swamp Rat
  • Posts: 1451
  • Marco
Re: vla-explode and delay
« Reply #23 on: May 09, 2021, 01:02:39 PM »
Domenico: What do you want to achieve in the end? a list of VlaObj or a Selset?
Code: [Select]
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:
LOWER LEFT point :
UPPER RIGHT point :
9   ss1 Length
45   new-obj-lst Length; errore: tipo di argomento errato: lselsetp nil
Code: [Select]
(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)
)

Marc'Antonio Alessi

  • Swamp Rat
  • Posts: 1451
  • Marco
Re: vla-explode and delay
« Reply #24 on: May 09, 2021, 01:20:30 PM »
Try (vla-Update (vlax-get-acad-object)) instead of DELAY...

domenicomaria

  • Swamp Rat
  • Posts: 724
Re: vla-explode and delay
« Reply #25 on: May 09, 2021, 01:43:23 PM »
Quote
Domenico: What do you want to achieve in the end? a list of VlaObj or a Selset?

I don't want achieve  anything.

I get a selection SS1 using "crossing", ll,  ur, ...

If SS1 is a selection set
after exploding or not exploding SS1
if I do the SAME SELECTION with the same method : ssget... crossing, ll, ur...

I have to get in anycase something.
SS2 MUST be a selection set and NOT NIL

SS2 HAS NO RELATION with what :VLA-EXPLODE-SS returns.

SS2 is the result of ssget, crossing . . .
But SOMETIMES, only sometimes, it is NIL.

If, after all, you execute
(setq ss2 (ssget "_"C" . . .))
using the same points
if SS1 was NOT NIL,
you wil get a selection set and NOT NIL ...
 . . .
I want achieve to KNOW, WHY I have to WAIT, to obtain that
(setq ss2 (ssget "_C" ll-pt ur-pt))
works correctly after (:VLA-EXPLODE-SS ss1)


errore: tipo di argomento errato: lselsetp nil
means that SS2 is NIL
because there is no SSLENGTH for NIL !

domenicomaria

  • Swamp Rat
  • Posts: 724
Re: vla-explode and delay
« Reply #26 on: May 09, 2021, 01:52:46 PM »
Quote
Try (vla-Update (vlax-get-acad-object))
Code - Auto/Visual Lisp: [Select]
  1. (defun c:TEST ( / ll-pt ss ss1 ss2 ur-pt)
  2.    (setq ll-pt (getpoint "\nLOWER LEFT point :"))
  3.    (setq ur-pt (getcorner ll-pt "\nUPPER RIGHT point :"))
  4.    (setq ss1 (ssget "_C" ll-pt ur-pt) )
  5.    
  6.    (:VLA-EXPLODE-SS ss1)
  7.  
  8.    (setq ss2 (ssget "_C" ll-pt ur-pt) )
  9. )
  10.  
YES

It works ! ! !

But now,
the question is : why it works also with DELAY ?

Maybe DELAY, UPDATES the ACAD-OBJECT ?

It would be STRANGE !

Does the  ACAD-OBJECT  need time, to UPDATE itself AUTOMATICALLY ?

« Last Edit: May 09, 2021, 01:56:57 PM by domenicomaria »

domenicomaria

  • Swamp Rat
  • Posts: 724
Re: vla-explode and delay
« Reply #27 on: May 09, 2021, 02:41:28 PM »
Code - Auto/Visual Lisp: [Select]
  1. (defun c:TEST ( / ll-pt ss ss1 ss2 ur-pt)
  2.    (setq ll-pt (getpoint "\nLOWER LEFT point :"))
  3.    (setq ur-pt (getcorner ll-pt "\nUPPER RIGHT point :"))
  4.    (setq ss1 (ssget "_C" ll-pt ur-pt) )
  5.    
  6.    (:VLA-EXPLODE-SS ss1)
  7.    (command "redraw")
  8.    ; (vla-Update (vlax-get-acad-object))
  9.    (setq ss2 (ssget "_C" ll-pt ur-pt) )
  10. )

(command "redraw")

Anyway, it seems that any call to a COMMAND,
produces the same effect .

Just to conclude :

when we use the "vla-xxxxx" functions,
mainly when new entities are created, modified or deleted,
we must not forget to update the drawing immediately afterwards.

If VLA-UPDATE exists, there is a good reason !
« Last Edit: May 10, 2021, 12:27:23 AM by domenicomaria »

Marc'Antonio Alessi

  • Swamp Rat
  • Posts: 1451
  • Marco
Re: vla-explode and delay
« Reply #28 on: May 10, 2021, 03:59:33 AM »
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.

domenicomaria

  • Swamp Rat
  • Posts: 724
Re: vla-explode and delay
« Reply #29 on: May 10, 2021, 04:48:42 AM »
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 !

Marc'Antonio Alessi

  • Swamp Rat
  • Posts: 1451
  • Marco
Re: vla-explode and delay
« Reply #30 on: May 10, 2021, 08:12:43 AM »
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:
[What do you want to achieve in the end? a list of VlaObj or a Selset?]


domenicomaria

  • Swamp Rat
  • Posts: 724
Re: vla-explode and delay
« Reply #31 on: May 10, 2021, 11:13:05 AM »
Quote
What do you want to achieve in the end? a list of VlaObj or a Selset?

I wanted only UNDERSTAND what was happening.

Only this.