Author Topic: Exploding objects inside blocks  (Read 1313 times)

0 Members and 1 Guest are viewing this topic.

dwaschnia

  • Mosquito
  • Posts: 13
Exploding objects inside blocks
« on: November 07, 2023, 07:49:03 AM »
I occasionally get arc drawings with 3d solids that I need to flatten. For top level objects that's not a problem, but sometimes they are inside blocks.
Is it possible to explode 3d solids and regions that are inside blocks via lisp?

BIGAL

  • Swamp Rat
  • Posts: 1408
  • 40 + years of using Autocad
Re: Exploding objects inside blocks
« Reply #1 on: November 07, 2023, 05:41:52 PM »
You may be able to BEDIT the block and resave. This will update all blocks of that name.
A man who never made a mistake never made anything

kozmos

  • Newt
  • Posts: 114
Re: Exploding objects inside blocks
« Reply #2 on: November 08, 2023, 07:38:35 AM »
I occasionally get arc drawings with 3d solids that I need to flatten. For top level objects that's not a problem, but sometimes they are inside blocks.
Is it possible to explode 3d solids and regions that are inside blocks via lisp?
You can "vla-copyobjects" those 3d solids and regions into ModelSpace, delete them from block definition, then explode the copied 3d solids and regions in ModelSpace to get lines, after that, "vla-copyobjects" the lines back into block definition.

Also calling BEDIT and explode them in block editor will also do the job, as BIGAL mentioned.
KozMos Inc.

dwaschnia

  • Mosquito
  • Posts: 13
Re: Exploding objects inside blocks
« Reply #3 on: November 08, 2023, 09:18:16 AM »
Never used vla-copyobjects, so might give it a try.
Not a fan of BEDIT or using commands in general, since they just behave too unpredictable.
I think in the end it's propably easiest to just explode the blocks which contain the solids and be done with it.

Appreciate the input guys!

Lee Mac

  • Seagull
  • Posts: 12912
  • London, England
Re: Exploding objects inside blocks
« Reply #4 on: November 08, 2023, 10:22:46 AM »
Unfortunately the ActiveX explode method is not applicable to 3D Solids, otherwise this task would be simple.

dwaschnia

  • Mosquito
  • Posts: 13
Re: Exploding objects inside blocks
« Reply #5 on: November 09, 2023, 02:24:33 AM »
Unfortunately the ActiveX explode method is not applicable to 3D Solids, otherwise this task would be simple.

What do you mean? Played around a bit and this seems to work just fine:

Code - Auto/Visual Lisp: [Select]
  1. (defun c:foo ()
  2.   (setq blc (vla-get-blocks doc))
  3.   (vlax-for x blc
  4.     (vlax-for y x
  5.       (if (eq (vla-get-entityname y) "AcDb3dSolid")
  6.         (progn
  7.           (vlax-invoke y 'explode)
  8.           (vla-delete y)
  9.         )
  10.       )
  11.     )
  12.   )
  13. )

Lee Mac

  • Seagull
  • Posts: 12912
  • London, England
Re: Exploding objects inside blocks
« Reply #6 on: November 09, 2023, 03:31:06 AM »
I happily stand corrected - neither the documentation nor an interrogation of the object would indicate that this method is applicable to objects of the AcDb3dSolid class - what platform are you using?

Happy to have helped! :)
« Last Edit: November 09, 2023, 03:34:41 AM by Lee Mac »

dwaschnia

  • Mosquito
  • Posts: 13
Re: Exploding objects inside blocks
« Reply #7 on: November 09, 2023, 04:30:39 AM »
I happily stand corrected - neither the documentation nor an interrogation of the object would indicate that this method is applicable to objects of the AcDb3dSolid class - what platform are you using?

Happy to have helped! :)

Yeah great idea, thanks! Somehow I couldn't think of it :)
I'm using bricscad, not sure it would work in autocad.

@Daniel No idea what you're talking about, sry :)

Marc'Antonio Alessi

  • Swamp Rat
  • Posts: 1451
  • Marco
Re: Exploding objects inside blocks
« Reply #8 on: November 09, 2023, 09:04:30 AM »
I happily stand corrected - neither the documentation nor an interrogation of the object would indicate that this method is applicable to objects of the AcDb3dSolid class - what platform are you using?

Happy to have helped! :)
Tested on AutoCAD 2013 Vs. BricsCAD V24 > Explode exists!
Code: [Select]
; IAcad3DSolid: Interfaccia AutoCAD 3dSolid (Solido 3D)   IAcad3DSolid 92af18e0 : TeighaX Interface of a solid object with free-form surface
; valori della proprietà: ; Property values :
;   Application (RO) = #<VLA-OBJECT IAcadApplication 00007ff7afd23318> ;   Application (RO) = #<VLA-OBJECT IAcadApplication 000000003A12B6A0>
;   Centroid (RO) = (177974.0 -3565.98 915.0) ;   Centroid (RO) = (-1047.0988300642 3702.28515033697 965.0)
;   Document (RO) = #<VLA-OBJECT IAcadDocument 000000003c74d828> ;   Color = 256
;   EntityTransparency = "DaLayer" ;   Database (RO) = #<VLA-OBJECT IAcadDatabase 00000000431FEAD8>
;   Handle (RO) = "16070" ;   Document (RO) = #<VLA-OBJECT IAcadDocument 000000005CC2FB38>
;   HasExtensionDictionary (RO) = 0 ;   EntityName (RO) = "AcDb3dSolid"
;   History = 0 ;   EntityTransparency = "ByLayer"
;   Hyperlinks (RO) = #<VLA-OBJECT IAcadHyperlinks 000000003c38fbe8> ;   EntityType (RO) = NIL
;   Layer = "$ZET_NORM" ;   Handle (RO) = "6777"
;   Linetype = "BYLAYER" ;   HasExtensionDictionary (RO) = 0
;   LinetypeScale = 1.0 ;   History = 0
;   Lineweight = -1 ;   Hyperlinks (RO) = #<VLA-OBJECT IAcadHyperlinks 00000000937EDC18>
;   Material = "ByLayer" ;   Layer = "$ZET_NORM"
;   MomentOfInertia (RO) = (5.04914e+014 1.17597e+018 1.17641e+018) ;   Linetype = "BYLAYER"
;   ObjectID (RO) = 297 ;   LinetypeScale = 1.0
;   ObjectID32 (RO) = 297 ;   Lineweight = -1
;   ObjectName (RO) = "AcDb3dSolid" ;   Material = "ByLayer"
;   OwnerID (RO) = 296 ;   MomentOfInertia (RO) = (743580203449558.0 131147874063622.0 780391078028175.0)
;   OwnerID32 (RO) = 296 ;   ObjectID (RO) = 2460340896
;   PlotStyleName = "ByLayer" ;   ObjectID32 (RO) = -1834626400
;   Position = Eccezione ;   ObjectName (RO) = "AcDb3dSolid"
;   PrincipalDirections (RO) = (1.0 0.0 0.0 0.0 1.0 0.0 ... ) ;   OwnerID (RO) = 1568264016
;   PrincipalMoments (RO) = (1.74302e+012 8.42552e+012 1.0163e+013) ;   OwnerID32 (RO) = 1568264016
;   ProductOfInertia (RO) = (-2.35615e+016 -1.21134e+014 6.04568e+015) ;   PlotStyleName = "ByLayer"
;   RadiiOfGyration (RO) = (3687.87 177977.0 178011.0) ;   Position = (-1110.5727163618 3702.28515033696 950.0)
;   ShowHistory = 0 ;   PrincipalDirections (RO) = (1.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0 1.0)
;   SolidType (RO) = Eccezione ;   PrincipalMoments (RO) = (2187399203745.91 28451876967133.7 30631678968086.4)
;   TrueColor = #<VLA-OBJECT IAcadAcCmColor 000000003c38e740> ;   ProductOfInertia (RO) = (-196345069339800.0 180950437984245.0 -51177309207439.7)
;   Visible = -1 ;   RadiiOfGyration (RO) = (3831.62218684173 1609.16062586838 3925.31864980958)
;   Volume (RO) = 3.7125e+007 ;   ShowHistory = 0
;   SolidType (RO) = NIL
;   TrueColor = #<VLA-OBJECT IAcadAcCmColor 000000005F590838>
;   Visible = -1
;   Volume (RO) = 50648018.6218216
; metodi supportati: ; Methods supported :
;   ArrayPolar (3) ;   ArrayPolar (3)
;   ArrayRectangular (6) ;   ArrayRectangular (6)
;   Boolean (2) ;   Boolean (2)
;   CheckInterference (3) ;   CheckInterference (2)
;   Copy () ;   Copy ()
;   Delete () ;   Delete ()
;   GetBoundingBox (2) ;   Erase ()
;   GetExtensionDictionary () ;   Explode ()
;   GetXData (3) ;   GetBoundingBox (2)
;   Highlight (1) ;   GetExtensionDictionary ()
;   IntersectWith (2) ;   GetXData (3)
;   Mirror (2) ;   Highlight (1)
;   Mirror3D (3) ;   IntersectWith (2)
;   Move (2) ;   Mirror (2)
;   Rotate (2) ;   Mirror3D (3)
;   Rotate3D (3) ;   Move (2)
;   ScaleEntity (2) ;   Rotate (2)
;   SectionSolid (3) ;   Rotate3D (3)
;   SetXData (2)                                  ;   ScaleEntity (2)
;   SliceSolid (4) ;   SectionSolid (3)
;   TransformBy (1) ;   SetXData (2)
;   Update () ;   SliceSolid (4)
;   TransformBy (1)
;   Update ()