Author Topic: LM:blockreferenceboundingbox  (Read 5791 times)

0 Members and 1 Guest are viewing this topic.

domenicomaria

  • Swamp Rat
  • Posts: 725
Re: LM:blockreferenceboundingbox
« Reply #15 on: March 01, 2021, 11:52:33 AM »
Marco
(vlax-invoke (vlax-ename->vla-object EntNam) "Explode")
does NOT return an OBJECTS LIST
as you suppose in your code . . .
. . .
However it is interesting . . .
. . .
It is like to SCAN an EXPLODED copy of the insert . . .
. . .
This will avoid the UNDO command, that is the less elegant item !

Soon I will test your idea.

Thank you.

Ciao

domenicomaria

  • Swamp Rat
  • Posts: 725
Re: LM:blockreferenceboundingbox
« Reply #16 on: March 01, 2021, 12:11:22 PM »
Code - Auto/Visual Lisp: [Select]
  1. (defun c:IBB ( / BB-LST DELTA-X DELTA-Y P1 P2 P3 P4 SS-XPL X-EN X-EN-LST X-ENTLAST X-OBJ)
  2.         (setq x-en (car (entsel "\nselect an INSERT :") ) )
  3.  
  4.         (setq x-entlast (LM:ENTLAST (entlast) ) )
  5.         (vlax-invoke (vlax-ename->vla-object x-en) "explode")
  6.         (setq x-en-lst (LM:ENTNEXTTOEND x-entlast) )
  7.  
  8.         (setq ss-xpl (ssadd) )
  9.  
  10.         (foreach x-en x-en-lst
  11.                 (setq x-obj (vlax-ename->vla-object x-en) )
  12.                 (cond
  13.                         (       (wcmatch (strcase (vla-get-ObjectName x-obj) )   "*LINE,*PLINE,*ELLIPSE")
  14.                                 (ssadd x-en ss-xpl)
  15.                         )
  16.                         (T (vla-delete x-obj) )
  17.                 )
  18.         )
  19.  
  20.         (setq bb-lst (LM:SSBOUNDINGBOX ss-xpl) )
  21.  
  22.         (vl-cmdf "erase" ss-xpl "" ) ;  ! ! !
  23.        
  24.         (setq p1        (nth 0 bb-lst)
  25.               p3        (nth 1 bb-lst)
  26.               delta-x   (abs (- (car  p3) (car  p1) ) )
  27.               delta-y   (abs (- (cadr p3) (cadr p1) ) )
  28.               p2        (polar p1 0.0  delta-x)
  29.               p4        (polar p1 (/ pi 2.0) delta-y)
  30.         )
  31.        
  32.         (vl-cmdf "pline" p1 p2 p3 p4 p1 "")
  33. )

This one, works
« Last Edit: March 01, 2021, 12:15:07 PM by domenicomaria »

Marc'Antonio Alessi

  • Swamp Rat
  • Posts: 1453
  • Marco
Re: LM:blockreferenceboundingbox
« Reply #17 on: March 01, 2021, 12:45:43 PM »
Marco
(vlax-invoke (vlax-ename->vla-object EntNam) "Explode")
does NOT return an OBJECTS LIST
as you suppose in your code . . .
<CLIP>
Code: [Select]
(setq SS_Out (ssadd))
(foreach ObjFor (vlax-invoke (vlax-ename->vla-object EntNam) "Explode")
  (cond
    ( (wcmatch (strcase (vla-get-ObjectName ObjFor)) "*LINE"))
      (ssadd (vlax-vla-object->ename ObjFor) SS_Out)
    )
    ( T (vla-delete ObjFor) )
  )
)
SS_Out IS the filtered object Selection Set...

domenicomaria

  • Swamp Rat
  • Posts: 725
Re: LM:blockreferenceboundingbox
« Reply #18 on: March 01, 2021, 02:22:09 PM »
Marco
I understand that
SS_Out IS the filtered object Selection Set...
. . .

But this is not the question.

The question is that
(foreach ObjFor (vlax-invoke (vlax-ename->vla-object EntNam) "Explode") . . .
supposes that (vlax-invoke (vlax-ename->vla-object EntNam) "Explode")
returns an object list.

And this is not true.

The second argument of FOREACH must be a list.

This one, works :
(foreach item '(1 2 3 4 5) (print item) )

While this doesn't work

(setq x-en (car (entsel) ) )
(setq obj-lst (vlax-invoke (vlax-ename->vla-object x-en) "Explode") )
(foreach x-obj obj-lst (print (vla-get-ObjectName x-obj) ) )

because obj-lst is not an objects list.

It is not a list.

It is NIL



« Last Edit: March 01, 2021, 02:25:21 PM by domenicomaria »

Marc'Antonio Alessi

  • Swamp Rat
  • Posts: 1453
  • Marco
Re: LM:blockreferenceboundingbox
« Reply #19 on: March 01, 2021, 03:01:25 PM »
Marco
<clip>
because obj-lst is not an objects list.
It is not a list.
It is NIL

Code: [Select]
comando: (setq x-en (car (entsel)))
Selezionare oggetto: <Nome entità: 7ff498414f70>

Comando: (print (entget x-en))
((-1 . <Nome entità: 7ff498414f70>) (0 . "INSERT") (330 . <Nome entità: 7ff498414820>) (5 . "77") (100 . "AcDbEntity")
(67 . 0) (410 . "Model") (8 . "0") (62 . 1) (100 . "AcDbBlockReference") (2 . "arrows8") (10 394.512 49.3879 0.0)
(41 . 0.5) (42 . 0.5) (43 . 0.5) (50 . 0.0) (70 . 0) (71 . 0) (44 . 0.0) (45 . 0.0) (210 0.0 0.0 1.0))
((-1 . <Nome entità: 7ff498414f70>) (0 . "INSERT") (330 . <Nome entità: 7ff498414820>) (5 . "77")
(100 . "AcDbEntity") (67 . 0) (410 . "Model") (8 . "0") (62 . 1) (100 . "AcDbBlockReference")
(2 . "arrows8") (10 394.512 49.3879 0.0) (41 . 0.5) (42 . 0.5) (43 . 0.5) (50 . 0.0) (70 . 0)
(71 . 0) (44 . 0.0) (45 . 0.0) (210 0.0 0.0 1.0))

Comando: (setq obj-lst (vlax-invoke (vlax-ename->vla-object x-en) "Explode"))
(#<VLA-OBJECT IAcadHatch 000000003852d818> #<VLA-OBJECT IAcadLWPolyline 000000003852d158>)

Comando: (progn (foreach x-obj obj-lst (print (vla-get-ObjectName x-obj))) (princ))
"AcDbHatch"
"AcDbPolyline"

domenicomaria

  • Swamp Rat
  • Posts: 725
Re: LM:blockreferenceboundingbox
« Reply #20 on: March 01, 2021, 03:25:58 PM »
Marco,
you are right !

Now i believe to you.

But on my PC it returns nil.

Tomorrow i will try to understand
what goes wrong.

But, now, i am sure that you are right.

Sorry.

Ciao


domenicomaria

  • Swamp Rat
  • Posts: 725
Re: LM:blockreferenceboundingbox
« Reply #21 on: March 01, 2021, 03:42:03 PM »
I don't understand !

do you understand ?
« Last Edit: March 01, 2021, 11:33:06 PM by domenicomaria »

Marc'Antonio Alessi

  • Swamp Rat
  • Posts: 1453
  • Marco
Re: LM:blockreferenceboundingbox
« Reply #22 on: March 02, 2021, 03:01:55 AM »
I don't understand !

do you understand ?
I don't understand why you switched to vlide...

domenicomaria

  • Swamp Rat
  • Posts: 725
Re: LM:blockreferenceboundingbox
« Reply #23 on: March 02, 2021, 07:11:07 AM »
I switched to vlide, just to copy and paste the code . . .

I don't believe that this is the problem.

domenicomaria

  • Swamp Rat
  • Posts: 725
Re: LM:blockreferenceboundingbox
« Reply #24 on: March 02, 2021, 07:20:52 AM »
Code - Auto/Visual Lisp: [Select]
  1.  
  2. (defun c:k ()
  3.         (vl-load-com)
  4.  
  5.         (setq x-en (car (entsel) ) )
  6.         (print x-en) (princ)
  7.  
  8.         (setq x-el (entget x-en) )
  9.         (print x-el) (princ)
  10.        
  11.         (setq obj-lst (vlax-invoke (vlax-ename->vla-object x-en) "Explode") )
  12.         (print obj-lst) (princ)
  13.  
  14.         (foreach x-obj obj-lst (print (vla-get-ObjectName x-obj) ) (princ) )
  15. )

roy_043

  • Water Moccasin
  • Posts: 1895
  • BricsCAD 18
Re: LM:blockreferenceboundingbox
« Reply #25 on: March 02, 2021, 08:29:37 AM »
Maybe check if the insert is in fact explodable?

Marc'Antonio Alessi

  • Swamp Rat
  • Posts: 1453
  • Marco
Re: LM:blockreferenceboundingbox
« Reply #26 on: March 02, 2021, 08:32:35 AM »

Boh... try without Vlide...
Code: [Select]
Comando: (defun c:k ()
(_>         (vl-load-com)
(_>         (setq x-en (car (entsel) ) )
(_>         (print x-en) (princ)
(_>         (setq x-el (entget x-en) )
(_>         (print x-el) (princ)
(_>         (setq obj-lst (vlax-invoke (vlax-ename->vla-object x-en) "Explode") )
(_>         (print obj-lst) (princ)
(_>         (foreach x-obj obj-lst (print (vla-get-ObjectName x-obj) ) (princ) )
(_> )
C:K
Comando: k
Selezionare oggetto:
<Nome entità: 7ff462103f70>
((-1 . <Nome entità: 7ff462103f70>) (0 . "INSERT") (330 . <Nome entità: 7ff462103820>) (5 . "77") (100 . "AcDbEntity") (67 . 0) (410 . "Model") (8 . "0") (62 . 1) (100 . "AcDbBlockReference") (2 . "arrows8") (10 394.512 49.3879 0.0) (41 . 0.5) (42 . 0.5) (43 . 0.5) (50 . 0.0) (70 . 0) (71 . 0) (44 . 0.0) (45 . 0.0) (210 0.0 0.0 1.0))
(#<VLA-OBJECT IAcadHatch 0000000035673c98> #<VLA-OBJECT IAcadLWPolyline 0000000035673b18>)
"AcDbHatch"
"AcDbPolyline"


domenicomaria

  • Swamp Rat
  • Posts: 725
Re: LM:blockreferenceboundingbox
« Reply #28 on: March 02, 2021, 09:37:31 AM »
The block is NOT UNIFORMLY SCALED and ROTATED

IS EXPLODABLE

and

(setq obj-lst (vlax-invoke (vlax-ename->vla-object x-en) "Explode") )
works and explodes (a copy of) it

but

obj-lst is NOT a list of objects,
but it is NIL !

I don't understand why !



domenicomaria

  • Swamp Rat
  • Posts: 725
Re: LM:blockreferenceboundingbox
« Reply #29 on: March 02, 2021, 09:42:59 AM »
without Vlide, it is the same