.NET

Reply
*Expert Elite*
Alfred.NESWADBA
Posts: 8,994
Registered: ‎06-29-2007
Message 11 of 13 (81 Views)

Re: Getting Fatal Error in Explode method

11-25-2013 01:52 AM in reply to: aliensinearth

Hi,

 

well, got it to run (and learned something :smileywink: ):

 

When you look to that object:

   tr.GetObject(id, OpenMode.ForWrite)

AutoCAD returns a BlockTableRecord, not a BlockReference!

 

So I tried then to get the Blockreferences for that BlockTableRecord and exploded them ... and that worked:

   For Each id As ObjectId In oidc1
      Dim btr2 As BlockTableRecord = TryCast(tr.GetObject(id, OpenMode.ForWrite), BlockTableRecord)
      For Each id2 As ObjectId In btr2.GetBlockReferenceIds(True, False)
         Dim br2 As BlockReference = TryCast(tr.GetObject(id2, OpenMode.ForWrite), BlockReference)
         br2.ExplodeToOwnerSpace()
      Next
   Next
(no cast checking, no error handling, no disposes, just shows the workflow!)

 

HTH, - alfred -

-------------------------------------------------------------------------
Alfred NESWADBA
Ingenieur Studio HOLLAUS ... www.hollaus.at
-------------------------------------------------------------------------
Active Contributor
aliensinearth
Posts: 31
Registered: ‎09-02-2013
Message 12 of 13 (76 Views)

Re: Getting Fatal Error in Explode method

11-25-2013 02:12 AM in reply to: Alfred.NESWADBA
oh.....Great Alfred. Fantastic.
It works fine.

Thanks a lot. Thank you for spending your time and gave response.
*Expert Elite*
Alfred.NESWADBA
Posts: 8,994
Registered: ‎06-29-2007
Message 13 of 13 (68 Views)

Re: Getting Fatal Error in Explode method

11-25-2013 02:16 AM in reply to: aliensinearth

glad I could help, you are welcome, - alfred -

-------------------------------------------------------------------------
Alfred NESWADBA
Ingenieur Studio HOLLAUS ... www.hollaus.at
-------------------------------------------------------------------------
Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.
Need installation help?

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