Author Topic: LM:blockreferenceboundingbox  (Read 5798 times)

0 Members and 1 Guest are viewing this topic.

domenicomaria

  • Swamp Rat
  • Posts: 725
LM:blockreferenceboundingbox
« on: February 26, 2021, 05:05:10 PM »
I am using the
(for me impossible to understand)
LM:blockreferenceboundingbox
routine of the great LEE MAC.

But
if the INSERT is ROTATED
it returns the YELLOW bounding box . . .
. . .
Is there a way
to obtain the GREEN RESULT ?

Tharwat

  • Swamp Rat
  • Posts: 710
  • Hypersensitive
Re: LM:blockreferenceboundingbox
« Reply #1 on: February 26, 2021, 06:53:23 PM »
You can do it with the following steps:

1- Get the current rotation value of the selected block.
2- Set the rotation to 0.0
3- Get the Bounding box of the block.
4- Reset the rotation value back.

domenicomaria

  • Swamp Rat
  • Posts: 725
Re: LM:blockreferenceboundingbox
« Reply #2 on: February 27, 2021, 01:05:01 AM »
2- Set the rotation to 0.0
3- Get the Bounding box of the block.
. . .
if I do so,
I will get the yellow rectangle shown in the image on the right side,
which has nothing to do
with the green rectangle of the image on the left side . . .

I will get exactly what is shown on the right side !

domenicomaria

  • Swamp Rat
  • Posts: 725
Re: LM:blockreferenceboundingbox
« Reply #3 on: February 27, 2021, 01:15:43 AM »
The LEFT YELLOW rectangle,
is the SAME RIGTH YELLOW rectangle

the ONLY DIFFERENCE is that it is ROTATED !

While the GREEN LEFT rectangle,
is the TRUE BOUNDING BOX of the ROTATED BLOCK REFERENCE.


Marc'Antonio Alessi

  • Swamp Rat
  • Posts: 1453
  • Marco
Re: LM:blockreferenceboundingbox
« Reply #4 on: February 27, 2021, 03:57:55 AM »
What's the result with this?
Code: [Select]
(defun ALE_Utl_GetBoundingBox (VlaObj / LowLft UppRgt)
  (vl-catch-all-apply
    'vla-GetBoundingBox (list VlaObj 'LowLft 'UppRgt)
  )
  (if LowLft
    (mapcar 'vlax-safearray->list (list LowLft UppRgt))
  )
)

domenicomaria

  • Swamp Rat
  • Posts: 725
Re: LM:blockreferenceboundingbox
« Reply #5 on: February 27, 2021, 08:19:19 AM »
Marco,
don't you think that maybe there is good reason
to explain the difference between
your code
and LM:blockreferenceboundingbox of Lee Mac ?

I suppose that the Lee Mac code, works also for rotated and not uniformly scaled inserts . . .

Code - Auto/Visual Lisp: [Select]
  1. ;; Block Reference Bounding Box  -  Lee Mac
  2. ;; Returns a WCS point list describing a rectangular frame bounding all geometry of a supplied block reference.
  3. ;; Excludes Text, MText & Attribute Definitions.
  4. ;; ref - [vla] Block Reference Object
  5.  
  6. (defun LM:blockreferenceboundingbox ( ref )
  7.     (
  8.         (lambda ( lst )
  9.             (apply
  10.                 (function
  11.                     (lambda ( m v )
  12.                         (mapcar (function (lambda ( p ) (mapcar '+ (mxv m p) v))) lst)
  13.                     )
  14.                 )
  15.                 (refgeom (vlax-vla-object->ename ref))
  16.             )
  17.         )
  18.         (LM:blockdefinitionboundingbox
  19.             (vla-item
  20.                 (vla-get-blocks (vla-get-document ref))
  21.                 (vla-get-name ref)
  22.             )
  23.         )
  24.     )
  25. )
  26.  
  27. ;; Block Definition Bounding Box  -  Lee Mac
  28. ;; Returns a WCS point list describing a rectangular frame bounding all geometry of a supplied block definition.
  29. ;; Excludes Text, MText & Attribute Definitions.
  30. ;; def - [vla] Block Definition Object
  31.  
  32. (defun LM:blockdefinitionboundingbox ( def / llp lst urp )
  33.     (vlax-for obj def
  34.         (cond
  35.             (   (= :vlax-false (vla-get-visible obj)))
  36.             (   (= "AcDbBlockReference" (vla-get-objectname obj))
  37.                 (setq lst (append lst (LM:blockreferenceboundingbox obj)))
  38.             )
  39.             (   (and (not (wcmatch (vla-get-objectname obj) "AcDbAttributeDefinition,AcDb*Text"))
  40.                      (vlax-method-applicable-p obj 'getboundingbox)
  41.                      (not (vl-catch-all-error-p (vl-catch-all-apply 'vla-getboundingbox (list obj 'llp 'urp))))
  42.                 )
  43.                 (setq lst (vl-list* (vlax-safearray->list llp) (vlax-safearray->list urp) lst))
  44.             )
  45.         )
  46.     )
  47.     (LM:points->boundingbox lst)
  48. )
  49.  
  50. ;; Point to Bounding Box  -  Lee Mac
  51. ;; Returns the rectangular extents of a supplied point list
  52.  
  53. (defun LM:points->boundingbox ( lst )
  54.     (   (lambda ( l )
  55.             (mapcar '(lambda ( a ) (mapcar '(lambda ( b ) ((eval b) l)) a))
  56.                '(
  57.                     (caar   cadar)
  58.                     (caadr  cadar)
  59.                     (caadr cadadr)
  60.                     (caar  cadadr)
  61.                 )
  62.             )
  63.         )
  64.         (mapcar '(lambda ( f ) (apply 'mapcar (cons f lst))) '(min max))
  65.     )
  66. )
  67.  
  68. ;; RefGeom (gile)
  69. ;; Returns a list which first item is a 3x3 transformation matrix (rotation, scales, normal)
  70. ;; and second item the object insertion point in its parent (xref, block or space)
  71. ;; Argument : an ename
  72.  
  73. (defun refgeom ( ent / ang ang mat ocs )
  74.     (setq enx (entget ent)
  75.           ang (cdr (assoc 050 enx))
  76.           ocs (cdr (assoc 210 enx))
  77.     )
  78.     (list
  79.         (setq mat
  80.             (mxm
  81.                 (mapcar '(lambda ( v ) (trans v 0 ocs t))
  82.                    '(
  83.                         (1.0 0.0 0.0)
  84.                         (0.0 1.0 0.0)
  85.                         (0.0 0.0 1.0)
  86.                     )
  87.                 )
  88.                 (mxm
  89.                     (list
  90.                         (list (cos ang) (- (sin ang)) 0.0)
  91.                         (list (sin ang) (cos ang)     0.0)
  92.                        '(0.0 0.0 1.0)
  93.                     )
  94.                     (list
  95.                         (list (cdr (assoc 41 enx)) 0.0 0.0)
  96.                         (list 0.0 (cdr (assoc 42 enx)) 0.0)
  97.                         (list 0.0 0.0 (cdr (assoc 43 enx)))
  98.                     )
  99.                 )
  100.             )
  101.         )
  102.         (mapcar '- (trans (cdr (assoc 10 enx)) ocs 0)
  103.             (mxv mat (cdr (assoc 10 (tblsearch "block" (cdr (assoc 2 enx))))))
  104.         )
  105.     )
  106. )
  107.  
  108. ;; Matrix x Vector - Vladimir Nesterovsky
  109. ;; Args: m - nxn matrix, v - vector in R^n
  110.  
  111. (defun mxv ( m v )
  112.     (mapcar '(lambda ( r ) (apply '+ (mapcar '* r v))) m)
  113. )
  114.  
  115. ;; Matrix Transpose - Doug Wilson
  116. ;; Args: m - nxn matrix
  117.  
  118. (defun trp ( m )
  119.     (apply 'mapcar (cons 'list m))
  120. )
  121.  
  122. ;; Matrix x Matrix - Vladimir Nesterovsky
  123. ;; Args: m,n - nxn matrices
  124.  
  125. (defun mxm ( m n )
  126.     ((lambda ( a ) (mapcar '(lambda ( r ) (mxv a r)) m)) (trp n))
  127. )

domenicomaria

  • Swamp Rat
  • Posts: 725
Re: LM:blockreferenceboundingbox
« Reply #6 on: February 27, 2021, 08:26:46 AM »
Marc'Antonio, your code produces the RED RECTANGLE . . .
 . . .
It is NOT SO EASY as it could seem
« Last Edit: March 01, 2021, 03:42:52 AM by domenicomaria »

domenicomaria

  • Swamp Rat
  • Posts: 725
Re: LM:blockreferenceboundingbox
« Reply #7 on: February 27, 2021, 08:32:39 AM »
while, if i EXPLODE the INSERT,

easily I get the RIGHT BOUNDING BOX (the GREEN RECTANGLE) !

domenicomaria

  • Swamp Rat
  • Posts: 725
Re: LM:blockreferenceboundingbox
« Reply #8 on: February 27, 2021, 11:00:25 AM »
Re: LM:blockreferenceboundingbox works
obviously (but this does't mean it is easy !)
also with NOT UNIFORMLY SCALED insert . . .
. . .
If the insert is ROTATED
it returns the same bounding box (rotated)
of the not rotated insert.

The Lee Mac solution is YELLOW.

While I hope in a GREEN SOLUTION !

Marc'Antonio Alessi

  • Swamp Rat
  • Posts: 1453
  • Marco
Re: LM:blockreferenceboundingbox
« Reply #9 on: February 27, 2021, 12:26:06 PM »
Marco,
don't you think that maybe there is good reason to explain the difference between your code
and LM:blockreferenceboundingbox of Lee Mac?
I suppose that the Lee Mac code, works also for rotated and not uniformly scaled inserts...
...
Lee Mac: "I would note that the ActiveX getboundingbox method doesn't work too well where dynamic block references are concerned, since the method doesn't seem to account for invisible objects within the block definition. Hence, you will receive unexpected results when calculating the extents of a modelspace block containing dynamic block references, or if you are processing a block definition containing nested dynamic block references (unlikely, but you never know)."

Original post: http://www.theswamp.org/index.php?topic=48405.msg534887#msg534887

can you attach a file with your block inserted as you wish?

domenicomaria

  • Swamp Rat
  • Posts: 725
Re: LM:blockreferenceboundingbox
« Reply #10 on: February 27, 2021, 01:30:27 PM »
Marco, it is not a dynamic block ...

Lee Mac

  • Seagull
  • Posts: 12914
  • London, England
Re: LM:blockreferenceboundingbox
« Reply #11 on: February 27, 2021, 01:45:56 PM »
don't you think that maybe there is good reason
to explain the difference between
your code
and LM:blockreferenceboundingbox of Lee Mac ?

I suppose that the Lee Mac code, works also for rotated and not uniformly scaled inserts . .

If you were to analyse my code, you will notice that my function uses the getboundingbox method to calculate the bounding box of all visible non-text objects found within the block definition (including within the definition of any nested blocks found within the block definition), and then transforms such bounding box relative to the position, scale, rotation & orientation of the block reference.

domenicomaria

  • Swamp Rat
  • Posts: 725
Re: LM:blockreferenceboundingbox
« Reply #12 on: February 27, 2021, 03:39:27 PM »
Lee, thanks for your reply.

I had already carefully read all of your code,
and I understand what it does
. . . and a little, I understand how he does it . . .
. . .because it is not an easy code for everyone to understand . . .

. . . and anyway,
can you suggest us how to do
to get the green "bounding box" ?  8-)

domenicomaria

  • Swamp Rat
  • Posts: 725
Re: LM:blockreferenceboundingbox
« Reply #13 on: March 01, 2021, 03:39:13 AM »
I have found, a very simple solution
to obtain the true bounding box
of a simple insert that doesn't contain nested inserts.

The insert is not uniformly scaled, and rotated.

I explode it, calculate the Bounding Box avoiding hatches (and other "bad" objects)
then UNDO 1 time , and the result is correct . . .

It is not a matematical and elegant solution.

The solution is very limited by certain requirements that the block must have

However, at least, it works.

On the left side there is the result of LM:blockreferenceboundingbox
while on the right side there is the correct result that I get exploding it.

Ciao
« Last Edit: March 01, 2021, 06:12:35 AM by domenicomaria »

Marc'Antonio Alessi

  • Swamp Rat
  • Posts: 1453
  • Marco
Re: LM:blockreferenceboundingbox
« Reply #14 on: March 01, 2021, 07:51:39 AM »
Without Explode & Undo try this (it is only an example!):
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) )
  )
)

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

Marc'Antonio Alessi

  • Swamp Rat
  • Posts: 1453
  • Marco
Re: LM:blockreferenceboundingbox
« Reply #30 on: March 02, 2021, 10:42:44 AM »
try with vlax-method-applicable-p      (?)

domenicomaria

  • Swamp Rat
  • Posts: 725
Re: LM:blockreferenceboundingbox
« Reply #31 on: March 02, 2021, 11:16:22 AM »
Code - Auto/Visual Lisp: [Select]
  1. (defun c:k ()
  2.         (vl-load-com)
  3.  
  4.         (setq x-en (car (entsel) ) )
  5.         (print x-en) (princ)
  6.  
  7.         (setq x-el (entget x-en) )
  8.         (print x-el) (princ)
  9.  
  10.         (setq x-obj (vlax-ename->vla-object x-en) )
  11.  
  12.         (setq v-m-a-p (vlax-method-applicable-p x-obj 'explode) )
  13.         (print v-m-a-p) (princ)
  14.        
  15.    ;    (setq v-c-a-e-p (vl-catch-all-error-p (vl-catch-all-apply 'vlax-invoke (list x-obj "Explode") ) ) )
  16.        
  17.         (setq obj-lst (vlax-invoke x-obj "Explode") )
  18.         (print obj-lst) (princ)
  19.  
  20.         (foreach x-obj obj-lst (print (vla-get-ObjectName x-obj) ) (princ) )
  21. )

. . . however it works !
It explodes a copy of the insert !
. . .

Maybe it depends from the Acad version.

Where I work, they installed an Acad 2020 version.
« Last Edit: March 02, 2021, 11:26:30 AM by domenicomaria »

Marc'Antonio Alessi

  • Swamp Rat
  • Posts: 1453
  • Marco
Re: LM:blockreferenceboundingbox
« Reply #32 on: March 02, 2021, 04:23:16 PM »
Tested also in 2020 > if the block is not uniform scaled  the result of explode is nil ...

domenicomaria

  • Swamp Rat
  • Posts: 725
Re: LM:blockreferenceboundingbox
« Reply #33 on: March 02, 2021, 10:32:37 PM »
Tested also in 2020 > if the block is not uniform scaled  the result of explode is nil ...
while in a precedent version, is the result of explode is an object list ?
yes !

and is there something such as INITCOMMANDVERSION  that could change this behaviour ?

domenicomaria

  • Swamp Rat
  • Posts: 725
Re: LM:blockreferenceboundingbox
« Reply #34 on: March 02, 2021, 11:53:31 PM »
I sent the defun K
to a friend of mine, that uses BricsCAD.
(I don't know what version)

and obj-lst is a list of objects !

Marc'Antonio Alessi

  • Swamp Rat
  • Posts: 1453
  • Marco
Re: LM:blockreferenceboundingbox
« Reply #35 on: March 04, 2021, 03:33:18 AM »
I sent the defun K
to a friend of mine, that uses BricsCAD.
(I don't know what version)

and obj-lst is a list of objects !
:yes: tested in BricsCAD V14 and 20:
Code: [Select]
(defun c:kkkk ()
  (print (setq x-en (car (entsel))))
  (print (setq x-el (entget x-en)))
  (setq x-obj (vlax-ename->vla-object x-en))
  (print (setq v-m-a-p (vlax-method-applicable-p x-obj 'explode)))
  (print (setq obj-lst (vlax-invoke x-obj "Explode")))
  (foreach x-obj obj-lst (print (vla-get-ObjectName x-obj)))
  (princ)
)
: KKKK
Select entity:
<Entity name: 3a719520>
((-1 . <Entity name: 3a719520>) (0 . "INSERT") (5 . "87") (330 . <Entity name: 6ce56170>) (100 . "AcDbEntity") (67 . 0) (410 . "Model") (8 . "0") (62 . 1) (370 . -1) (100 . "AcDbBlockReference") (2 . "arrows8") (10 394.622585423474 58.8644608776229 0.0) (41 . 1.0) (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))
T
(#<VLA-OBJECT IAcadHatch2 000000006CE57C00> #<VLA-OBJECT IAcadLine 000000006CE58780> #<VLA-OBJECT IAcadLine 000000006CE58200> #<VLA-OBJECT IAcadLine 000000006CE58C00> #<VLA-OBJECT IAcadLine 000000006CE57D80> #<VLA-OBJECT IAcadEllipse 000000006CE56F80> #<VLA-OBJECT IAcadLine 000000006CE58500> #<VLA-OBJECT IAcadEllipse 000000006CE57300>)
"AcDbHatch"
"AcDbLine"
"AcDbLine"
"AcDbLine"
"AcDbLine"
"AcDbEllipse"
"AcDbLine"
"AcDbEllipse"
:
: KKKK
Select entity:
<Entity name: 3a7195a0>
((-1 . <Entity name: 3a7195a0>) (0 . "INSERT") (5 . "84") (330 . <Entity name: 6ce56170>) (100 . "AcDbEntity") (67 . 0) (410 . "Model") (8 . "0") (62 . 1) (370 . -1) (100 . "AcDbBlockReference") (2 . "arrows8") (10 390.534090981255 55.2902371436784 0.0) (41 . 0.5) (42 . 0.5) (43 . 0.5) (50 . 5.14332144945154) (70 . 0) (71 . 0) (44 . 0.0) (45 . 0.0) (210 0.0 0.0 1.0))
T
(#<VLA-OBJECT IAcadHatch2 000000006CE57E80> #<VLA-OBJECT IAcadLWPolyline 000000006CE58A80>)
"AcDbHatch"
"AcDbPolyline"
:
: KKKK
Select entity:
<Entity name: 3a7198e0>
((-1 . <Entity name: 3a7198e0>) (0 . "LWPOLYLINE") (5 . "7F") (102 . "{ACAD_REACTORS") (330 . <Entity name: 3a7198a0>) (102 . "}") (330 . <Entity name: 6ce56170>) (100 . "AcDbEntity") (67 . 0) (410 . "Model") (8 . "0") (6 . "ACAD_ISO03W100") (62 . 253) (48 . 0.007069650490151) (370 . 25) (100 . "AcDbPolyline") (90 . 7) (70 . 1) (43 . 0.030574411664588) (38 . 0.0) (39 . 0.0) (10 390.884399234151 50.8307665167475) (40 . 0.030574411664588) (41 . 0.030574411664588) (42 . 0.0) (91 . 0) (10 390.897503827103 51.1304801628225) (40 . 0.030574411664588) (41 . 0.030574411664588) (42 . 0.0) (91 . 0) (10 390.270910292456 50.3143909469705) (40 . 0.030574411664588) (41 . 0.030574411664588) (42 . 0.0) (91 . 0) (10 390.831980862344 49.6319119324476) (40 . 0.030574411664588) (41 . 0.030574411664588) (42 . 0.0) (91 . 0) (10 390.845085455296 49.9316255785226) (40 . 0.030574411664588) (41 . 0.030574411664588) (42 . -0.198303615254713) (91 . 0) (10 391.743449272824 49.3689487916544) (40 . 0.030574411664588) (41 . 0.030574411664588) (42 . 0.0) (91 . 0) (10 392.614490304417 50.194350222039) (40 . 0.030574411664588) (41 . 0.030574411664588) (42 . 0.195791166312802) (91 . 0) (210 0.0 0.0 1.0))
T
(#<VLA-OBJECT IAcadLine 000000006CE54B50> #<VLA-OBJECT IAcadLine 000000006CE54CD0> #<VLA-OBJECT IAcadLine 000000006CE54E50> #<VLA-OBJECT IAcadLine 000000006CE53F50> #<VLA-OBJECT IAcadArc 000000006CE54250> #<VLA-OBJECT IAcadLine 000000006CE548D0> #<VLA-OBJECT IAcadArc 000000006CE54150>)
"AcDbLine"
"AcDbLine"
"AcDbLine"
"AcDbLine"
"AcDbArc"
"AcDbLine"
"AcDbArc"

domenicomaria

  • Swamp Rat
  • Posts: 725
Re: LM:blockreferenceboundingbox
« Reply #36 on: March 04, 2021, 09:16:55 AM »
but not in Acad2020
. . .
is there no system variable
or something such as "initcommandversion"
that could change this behaviour ?

Or it is a bug ?

Marc'Antonio Alessi

  • Swamp Rat
  • Posts: 1453
  • Marco
Re: LM:blockreferenceboundingbox
« Reply #37 on: March 04, 2021, 09:53:58 AM »
but not in Acad2020
. . .
is there no system variable
or something such as "initcommandversion"
that could change this behaviour ?

Or it is a bug ?
I do not know, "initcommandversion" is only for commands...