.NET

Reply
*Expert Elite*
mathewk
Posts: 2,756
Registered: ‎07-09-2003
Message 1 of 4 (832 Views)
Accepted Solution

Exploding Blocks

832 Views, 3 Replies
09-01-2010 01:23 PM

Below is my existing code.  ss is a selection set which has been populated by SelectAll which limits the selection to blocks and tables.

The For Next loop iterates through this collection and attempts to explode each object (ent.Explode(acDBObjColl)
).  They do not actually explode and the code does not generate any errors.  I can replace the block selection with polylines which do explode.  This leads me to believe my code is correct in that it's exploding objects.  It just doesn't seem to work with blocks.

 

How might I get this code to explode blocks?

 

Thanks.

 

        'explode them
        If SelectResult.Status = PromptStatus.OK Then
            ss = SelectResult.Value
            count = ss.Count
            For i = 1 To count
                id = ss.Item(count - 1).ObjectId
                ent = id.GetObject(OpenMode.ForWrite, True, True)
                Dim acDBObjColl As DBObjectCollection = New DBObjectCollection()
                ent.Explode(acDBObjColl)
                For Each acEnt As Entity In acDBObjColl
                    btrModelSpace.AppendEntity(acEnt)
                    trans.AddNewlyCreatedDBObject(acEnt, True)
                Next
                trans.Commit()
            Next
            ss.Dispose()
        End If

 

 

Matt Kolberg
Cansel - Autodesk Division
http://www.cansel.ca/

You need to erase the original object

 and you say blocks do you mean BlockReferences or show full code

 

Valued Mentor
Jeffrey_H
Posts: 372
Registered: ‎01-20-2010
Message 2 of 4 (834 Views)

Re: Exploding Blocks

09-01-2010 01:41 PM in reply to: mathewk

You need to erase the original object

 and you say blocks do you mean BlockReferences or show full code

 

You can also find your answers @ TheSwamp
*Expert Elite*
mathewk
Posts: 2,756
Registered: ‎07-09-2003
Message 3 of 4 (824 Views)

Re: Exploding Blocks

09-01-2010 02:21 PM in reply to: Jeffrey_H

Correct, I mean BlockReferences.  So after I erase the original object, all the objects from the explode will just appear?

Matt Kolberg
Cansel - Autodesk Division
http://www.cansel.ca/
*Expert Elite*
mathewk
Posts: 2,756
Registered: ‎07-09-2003
Message 4 of 4 (816 Views)

Re: Exploding Blocks

09-01-2010 04:14 PM in reply to: Jeffrey_H

Thanks.  I got it working.

Matt Kolberg
Cansel - Autodesk Division
http://www.cansel.ca/
Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.