.NET

Reply
*Expert Elite*
Alfred.NESWADBA
Posts: 9,368
Registered: ‎06-29-2007
Message 11 of 13 (87 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 (82 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: 9,368
Registered: ‎06-29-2007
Message 13 of 13 (74 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
-------------------------------------------------------------------------
Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Are You Going To Be @ AU 2014? Feel free to drop by our AU topic post and share your plans, plug a class that you're teaching, or simply check out who else from the community might be in attendance. Ohh and don't forgot to stop by the Autodesk Help | Learn | Collaborate booths in the Exhibit Hall and meet our community team if you get a chance!