2- Set the rotation to 0.0. . .
3- Get the Bounding box of the block.
(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))
)
)
Marco,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)."
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...
...
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 . .
(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) )
)
)
Marco
(vlax-invoke (vlax-ename->vla-object EntNam) "Explode")
does NOT return an OBJECTS LIST
as you suppose in your code . . .
<CLIP>
(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...
Marco
<clip>
because obj-lst is not an objects list.
It is not a list.
It is NIL
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"
I don't understand !I don't understand why you switched to vlide...
do you understand ?
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"
Maybe check if the insert is in fact explodable?:yes: :)
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 ?
I sent the defun K:yes: tested in BricsCAD V14 and 20:
to a friend of mine, that uses BricsCAD.
(I don't know what version)
and obj-lst is a list of objects !
(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"
but not in Acad2020I do not know, "initcommandversion" is only for commands...
. . .
is there no system variable
or something such as "initcommandversion"
that could change this behaviour ?
Or it is a bug ?