<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic How to Open Block in Block Editor in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/how-to-open-block-in-block-editor/m-p/2860804#M62589</link>
    <description>&lt;P&gt;I was wondering if there is&amp;nbsp; a way to programatically force a block to open in the block editor?&amp;nbsp; I haven't had much success with my trials thus far.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am looping through the blocks in the drawing, I want to open them in the block editor, take a screenshot, and close.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Unfortunately I am stuck at step two currently, any help would be greatly appreciated!&lt;/P&gt;</description>
    <pubDate>Mon, 20 Dec 2010 19:08:34 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2010-12-20T19:08:34Z</dc:date>
    <item>
      <title>How to Open Block in Block Editor</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-open-block-in-block-editor/m-p/2860804#M62589</link>
      <description>&lt;P&gt;I was wondering if there is&amp;nbsp; a way to programatically force a block to open in the block editor?&amp;nbsp; I haven't had much success with my trials thus far.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am looping through the blocks in the drawing, I want to open them in the block editor, take a screenshot, and close.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Unfortunately I am stuck at step two currently, any help would be greatly appreciated!&lt;/P&gt;</description>
      <pubDate>Mon, 20 Dec 2010 19:08:34 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-open-block-in-block-editor/m-p/2860804#M62589</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2010-12-20T19:08:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to Open Block in Block Editor</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-open-block-in-block-editor/m-p/2860894#M62590</link>
      <description>&lt;P&gt;send command to the command line: "-bedit " &amp;amp; strBlockName&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;jvj&lt;/P&gt;</description>
      <pubDate>Mon, 20 Dec 2010 21:13:15 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-open-block-in-block-editor/m-p/2860894#M62590</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2010-12-20T21:13:15Z</dc:date>
    </item>
    <item>
      <title>Re: How to Open Block in Block Editor</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-open-block-in-block-editor/m-p/2860906#M62591</link>
      <description>&lt;P&gt;I have tried that previously and when you put the space in it treats the space as an enter button key press.&amp;nbsp; I went ahead and tried it again just to be sure with the following code.&amp;nbsp; Instead of trying to open the bedit on each block I tried having it run on just the last one that it finds.&amp;nbsp; What occurs is my command executes and when it finishes it tries to execute the -bedit command which ends up prompting me to provide a block name.&amp;nbsp; I tried spoofing another "enter" keypress by putting a space after the block name which also did not work.&amp;nbsp; This also crashes AutoCAD for some reason...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Document doc = Application.DocumentManager.MdiActiveDocument;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Database db = doc.Database;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Editor ed = doc.Editor;&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Transaction tr = db.TransactionManager.StartTransaction();&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; BlockTable bt = (BlockTable)tr.GetObject(db.BlockTableId, OpenMode.ForRead);&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; string blkname = "";&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; foreach (ObjectId btrid in bt)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; BlockTableRecord btr = (BlockTableRecord)tr.GetObject(btrid, OpenMode.ForRead);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; foreach (ObjectId id in btr)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; try&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; BlockReference br = (BlockReference)tr.GetObject(id, OpenMode.ForRead, false);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ed.WriteMessage("\nBlock Name: \"{0}\"&amp;nbsp; Object ID: \"{1}\"", br.Name, br.ObjectId);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; blkname = br.Name;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //doc.SendStringToExecute("-bedit ", true, false, false);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //doc.SendStringToExecute(br.Name + " ", true, false, false);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //doc.SendStringToExecute("bclose ", true, false, false);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; catch { }&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; doc.SendStringToExecute("-bedit " + blkname,true, false, false);&lt;/P&gt;</description>
      <pubDate>Mon, 20 Dec 2010 21:22:03 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-open-block-in-block-editor/m-p/2860906#M62591</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2010-12-20T21:22:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to Open Block in Block Editor</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-open-block-in-block-editor/m-p/2861006#M62592</link>
      <description>&lt;P&gt;First, stop the crash, wrap ALL of it in a (vb.net)&lt;/P&gt;&lt;P&gt;Try&lt;/P&gt;&lt;P&gt;&amp;nbsp; 'all your code&lt;/P&gt;&lt;P&gt;Catch ex as SYSTEM.Exception&lt;/P&gt;&lt;P&gt;&amp;nbsp; MsgBox(ex.tostring)&lt;/P&gt;&lt;P&gt;End Try&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I don't get this line:&lt;/P&gt;&lt;P&gt;ed.WriteMessage(""&amp;amp; vbLf&amp;amp;"Block Name: \""{0}\""&amp;nbsp; Object ID: \""{1}\""", br.Name, br.ObjectId)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;the command line editor will also support lisp command strings, so you can change:&lt;/P&gt;&lt;P&gt;doc.SendStringToExecute(("-bedit " + blkname), true, false, false)&lt;/P&gt;&lt;P&gt;to:&lt;/P&gt;&lt;P&gt;doc.SendStringToExecute("(command """-bedit"""&amp;nbsp;""" &amp;amp;&amp;nbsp;blkname &amp;amp; """ """""")",true ,false ,false)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;example final string value:&amp;nbsp;(command "-bedit" "CL" "")&lt;/P&gt;&lt;P&gt;or something like that.&lt;/P&gt;</description>
      <pubDate>Mon, 20 Dec 2010 22:52:47 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-open-block-in-block-editor/m-p/2861006#M62592</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2010-12-20T22:52:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to Open Block in Block Editor</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-open-block-in-block-editor/m-p/2861054#M62593</link>
      <description>&lt;P&gt;I did something similar but did not use the block editor.&amp;nbsp; Insert&amp;nbsp;each block in&amp;nbsp;an empty drawing, zoom extents,&amp;nbsp;and export to wmf.&amp;nbsp; WMFs were used as screen shots in word documents.&lt;/P&gt;</description>
      <pubDate>Mon, 20 Dec 2010 23:36:28 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-open-block-in-block-editor/m-p/2861054#M62593</guid>
      <dc:creator>fieldguy</dc:creator>
      <dc:date>2010-12-20T23:36:28Z</dc:date>
    </item>
    <item>
      <title>Re: How to Open Block in Block Editor</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-open-block-in-block-editor/m-p/2861062#M62594</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;@Anonymous wrote:&lt;BR /&gt;&lt;P&gt;First, stop the crash, wrap ALL of it in a (vb.net)&lt;/P&gt;&lt;P&gt;Try&lt;/P&gt;&lt;P&gt;&amp;nbsp; 'all your code&lt;/P&gt;&lt;P&gt;Catch ex as SYSTEM.Exception&lt;/P&gt;&lt;P&gt;&amp;nbsp; MsgBox(ex.tostring)&lt;/P&gt;&lt;P&gt;End Try&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I don't get this line:&lt;/P&gt;&lt;P&gt;ed.WriteMessage(""&amp;amp; vbLf&amp;amp;"Block Name: \""{0}\""&amp;nbsp; Object ID: \""{1}\""", br.Name, br.ObjectId)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;the command line editor will also support lisp command strings, so you can change:&lt;/P&gt;&lt;P&gt;doc.SendStringToExecute(("-bedit " + blkname), true, false, false)&lt;/P&gt;&lt;P&gt;to:&lt;/P&gt;&lt;P&gt;doc.SendStringToExecute("(command """-bedit"""&amp;nbsp;""" &amp;amp;&amp;nbsp;blkname &amp;amp; """ """""")",true ,false ,false)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;example final string value:&amp;nbsp;(command "-bedit" "CL" "")&lt;/P&gt;&lt;P&gt;or something like that.&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;BLOCKQUOTE&gt;While the command typed into AutoCAD works great for some reason after I execute the command I write in AutoCAD and it finishes I have to press enter in order to get the bedit to open the block in the editor.&amp;nbsp; Then after I did hit enter and it opened the block editor AutoCAD completely crashed even after I slapped the try catch around everything.&lt;BR /&gt;&lt;/BLOCKQUOTE&gt;&lt;BLOCKQUOTE&gt;&lt;BR /&gt;&lt;/BLOCKQUOTE&gt;</description>
      <pubDate>Mon, 20 Dec 2010 23:55:51 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-open-block-in-block-editor/m-p/2861062#M62594</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2010-12-20T23:55:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to Open Block in Block Editor</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-open-block-in-block-editor/m-p/2861072#M62595</link>
      <description>&lt;P&gt;which block are you trying to open some of them may be banned from opening.&amp;nbsp;&lt;/P&gt;&lt;P&gt;What is the name of the block?&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is the block in an open&amp;nbsp;transaction still?&amp;nbsp; Close all transactions before opening bedit.&amp;nbsp; (yep that means your going to have to collect your own object names and loop through them sepearately.)&amp;nbsp; Get the idea?&amp;nbsp; Transaction manager kills autocad.&amp;nbsp; When autoCAD crashes, it usually develops a crash report.&amp;nbsp; Open that zip file, and look at the xml based report file.&amp;nbsp; then hunt for the section that states APP data.&amp;nbsp; That will usually give out an actual explaination of why autocad crashed.&amp;nbsp; If you get 'check top transaction'&amp;nbsp; then all i said above applies.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;jvj&lt;/P&gt;</description>
      <pubDate>Tue, 21 Dec 2010 00:08:51 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-open-block-in-block-editor/m-p/2861072#M62595</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2010-12-21T00:08:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to Open Block in Block Editor</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-open-block-in-block-editor/m-p/2861074#M62596</link>
      <description>&lt;P&gt;That sounds like a great plan.&amp;nbsp; You could also choose to print dwf.&amp;nbsp; (standard viewer file used in Vault).&lt;/P&gt;</description>
      <pubDate>Tue, 21 Dec 2010 00:10:27 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-open-block-in-block-editor/m-p/2861074#M62596</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2010-12-21T00:10:27Z</dc:date>
    </item>
    <item>
      <title>Re: How to Open Block in Block Editor</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-open-block-in-block-editor/m-p/2862332#M62597</link>
      <description>&lt;P&gt;Thank you for your posts and recommendations. &amp;nbsp;I have switched my code to open the a separate drawing and copy the blocks over. &amp;nbsp;From there I was doing to load a block at a time into model space from the new drawing, take my screenshot, clear the modelspace block table and then move onto the next block. &amp;nbsp;Does this even sound feasible?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am currently hitting an error with my code...&lt;/P&gt;&lt;P&gt;"Operation is not valid due to the current state of the object."&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the latest revision of my code thus far.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; DocumentCollection dm = Application.DocumentManager;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Database sourceDB = dm.MdiActiveDocument.Database;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;try&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;// Collect the objectID's to be copied&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ObjectIdCollection blockIds = new ObjectIdCollection();&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Autodesk.AutoCAD.DatabaseServices.TransactionManager tm = sourceDB.TransactionManager;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;using (Transaction tran = tm.StartTransaction())&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;BlockTable bt = (BlockTable)tm.GetObject(sourceDB.BlockTableId, OpenMode.ForRead, false);&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;foreach (ObjectId btrId in bt)&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;BlockTableRecord btr = (BlockTableRecord)tm.GetObject(btrId, OpenMode.ForRead, false);&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;if (!btr.IsAnonymous &amp;amp;&amp;amp; !btr.IsLayout)&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;blockIds.Add(btrId);&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;btr.Dispose();&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;// Create the new Drawing to put the objects in&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Document acTempDoc = dm.Add("acad.dwt");&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;acTempDoc.LockDocument();&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Database destDB = acTempDoc.Database;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;// Put the objects in the new drawing&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;IdMapping mapping = new IdMapping();&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;sourceDB.WblockCloneObjects(blockIds, destDB.BlockTableId, mapping, DuplicateRecordCloning.Replace, false);&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;// Draw the a block on the new drawing&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Autodesk.AutoCAD.DatabaseServices.TransactionManager tmDest = destDB.TransactionManager;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;using (Transaction tranDest = tmDest.StartTransaction())&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;BlockTable bt = (BlockTable)tranDest.GetObject(destDB.BlockTableId, OpenMode.ForRead);&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;foreach (ObjectId btrid in bt)&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;BlockTableRecord btr = (BlockTableRecord)tranDest.GetObject(btrid, OpenMode.ForRead);&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;foreach (ObjectId id in btr)&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;BlockReference brMS = new BlockReference(Point3d.Origin, id);&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;BlockTableRecord ms = (BlockTableRecord)tranDest.GetObject(bt[BlockTableRecord.ModelSpace], OpenMode.ForWrite);&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ms.AppendEntity(brMS);&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;tranDest.AddNewlyCreatedDBObject(brMS, true);&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;tranDest.Commit();&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;catch (System.Exception ex)&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Application.ShowAlertDialog(ex.Message);&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 21 Dec 2010 23:16:38 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-open-block-in-block-editor/m-p/2862332#M62597</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2010-12-21T23:16:38Z</dc:date>
    </item>
  </channel>
</rss>

