<?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 A couple basic net questions in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/a-couple-basic-net-questions/m-p/1634366#M81771</link>
    <description>One of the first things I learned doing Arx programming was that the Acad&lt;BR /&gt;
block table could not be modified. Only the records it contains can be&lt;BR /&gt;
(modelspace, paperspace). Thus, I never even attempted to open the block&lt;BR /&gt;
table in write mode, dont know if you can (in Arx). However, most of the .Net&lt;BR /&gt;
examples I have seen so far do exactly this. They dont attemp to modify the&lt;BR /&gt;
block table, but they do open it in write mode, then go on to open the block&lt;BR /&gt;
table records. In fact they pretty much open every table/record in write mode.&lt;BR /&gt;
Is this the new (.Net) way of dealing with this?&lt;BR /&gt;
Is there any harm in just opening everything for write, regardless if your&lt;BR /&gt;
going to modify it or not?&lt;BR /&gt;
In the same vein, I have to say I do feel kinda weird opening all these objects&lt;BR /&gt;
(like when Im iterating through the blocktable) and then just leaving them and&lt;BR /&gt;
waiting for the system to close them. Keep expecting some horrendous crash.&lt;BR /&gt;
I do dispose() all my databases &amp;amp; transactions in which the table operations reside.&lt;BR /&gt;
&lt;BR /&gt;
Another question, when starting a transaction against a database, whats the difference&lt;BR /&gt;
between this code:&lt;BR /&gt;
Database db = HostApplicationServices.WorkingDatabase;&lt;BR /&gt;
using (Transaction t = db.TransactionManager.StartTransaction())&lt;BR /&gt;
&lt;BR /&gt;
and this code?&lt;BR /&gt;
Document doc = Application.DocumentManager.MdiActiveDocument;&lt;BR /&gt;
using (Transaction t = doc.TransactionManager.StartTransaction())&lt;BR /&gt;
&lt;BR /&gt;
The both appear to be using the current database.&lt;BR /&gt;
&lt;BR /&gt;
Thanks for any insights&lt;BR /&gt;
Perry</description>
    <pubDate>Thu, 04 May 2006 21:40:56 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2006-05-04T21:40:56Z</dc:date>
    <item>
      <title>A couple basic net questions</title>
      <link>https://forums.autodesk.com/t5/net-forum/a-couple-basic-net-questions/m-p/1634366#M81771</link>
      <description>One of the first things I learned doing Arx programming was that the Acad&lt;BR /&gt;
block table could not be modified. Only the records it contains can be&lt;BR /&gt;
(modelspace, paperspace). Thus, I never even attempted to open the block&lt;BR /&gt;
table in write mode, dont know if you can (in Arx). However, most of the .Net&lt;BR /&gt;
examples I have seen so far do exactly this. They dont attemp to modify the&lt;BR /&gt;
block table, but they do open it in write mode, then go on to open the block&lt;BR /&gt;
table records. In fact they pretty much open every table/record in write mode.&lt;BR /&gt;
Is this the new (.Net) way of dealing with this?&lt;BR /&gt;
Is there any harm in just opening everything for write, regardless if your&lt;BR /&gt;
going to modify it or not?&lt;BR /&gt;
In the same vein, I have to say I do feel kinda weird opening all these objects&lt;BR /&gt;
(like when Im iterating through the blocktable) and then just leaving them and&lt;BR /&gt;
waiting for the system to close them. Keep expecting some horrendous crash.&lt;BR /&gt;
I do dispose() all my databases &amp;amp; transactions in which the table operations reside.&lt;BR /&gt;
&lt;BR /&gt;
Another question, when starting a transaction against a database, whats the difference&lt;BR /&gt;
between this code:&lt;BR /&gt;
Database db = HostApplicationServices.WorkingDatabase;&lt;BR /&gt;
using (Transaction t = db.TransactionManager.StartTransaction())&lt;BR /&gt;
&lt;BR /&gt;
and this code?&lt;BR /&gt;
Document doc = Application.DocumentManager.MdiActiveDocument;&lt;BR /&gt;
using (Transaction t = doc.TransactionManager.StartTransaction())&lt;BR /&gt;
&lt;BR /&gt;
The both appear to be using the current database.&lt;BR /&gt;
&lt;BR /&gt;
Thanks for any insights&lt;BR /&gt;
Perry</description>
      <pubDate>Thu, 04 May 2006 21:40:56 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/a-couple-basic-net-questions/m-p/1634366#M81771</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2006-05-04T21:40:56Z</dc:date>
    </item>
    <item>
      <title>Re: A couple basic net questions</title>
      <link>https://forums.autodesk.com/t5/net-forum/a-couple-basic-net-questions/m-p/1634367#M81772</link>
      <description>No one's talking about opening the block table, you&lt;BR /&gt;
have to open each block reference for write.&lt;BR /&gt;
&lt;BR /&gt;
-- &lt;BR /&gt;
http://www.caddzone.com&lt;BR /&gt;
&lt;BR /&gt;
AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006/2007&lt;BR /&gt;
http://www.acadxtabs.com&lt;BR /&gt;
&lt;BR /&gt;
"perry" &lt;PERRY_LEETS&gt; wrote in message news:5164605@discussion.autodesk.com...&lt;BR /&gt;
One of the first things I learned doing Arx programming was that the Acad&lt;BR /&gt;
block table could not be modified. Only the records it contains can be&lt;BR /&gt;
(modelspace, paperspace). Thus, I never even attempted to open the block&lt;BR /&gt;
table in write mode, dont know if you can (in Arx). However, most of the .Net&lt;BR /&gt;
examples I have seen so far do exactly this. They dont attemp to modify the&lt;BR /&gt;
block table, but they do open it in write mode, then go on to open the block&lt;BR /&gt;
table records. In fact they pretty much open every table/record in write mode.&lt;BR /&gt;
Is this the new (.Net) way of dealing with this?&lt;BR /&gt;
Is there any harm in just opening everything for write, regardless if your&lt;BR /&gt;
going to modify it or not?&lt;BR /&gt;
In the same vein, I have to say I do feel kinda weird opening all these objects&lt;BR /&gt;
(like when Im iterating through the blocktable) and then just leaving them and&lt;BR /&gt;
waiting for the system to close them. Keep expecting some horrendous crash.&lt;BR /&gt;
I do dispose() all my databases &amp;amp; transactions in which the table operations reside.&lt;BR /&gt;
&lt;BR /&gt;
Another question, when starting a transaction against a database, whats the difference&lt;BR /&gt;
between this code:&lt;BR /&gt;
Database db = HostApplicationServices.WorkingDatabase;&lt;BR /&gt;
using (Transaction t = db.TransactionManager.StartTransaction())&lt;BR /&gt;
&lt;BR /&gt;
and this code?&lt;BR /&gt;
Document doc = Application.DocumentManager.MdiActiveDocument;&lt;BR /&gt;
using (Transaction t = doc.TransactionManager.StartTransaction())&lt;BR /&gt;
&lt;BR /&gt;
The both appear to be using the current database.&lt;BR /&gt;
&lt;BR /&gt;
Thanks for any insights&lt;BR /&gt;
Perry&lt;/PERRY_LEETS&gt;</description>
      <pubDate>Fri, 05 May 2006 00:53:06 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/a-couple-basic-net-questions/m-p/1634367#M81772</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2006-05-05T00:53:06Z</dc:date>
    </item>
    <item>
      <title>Re: A couple basic net questions</title>
      <link>https://forums.autodesk.com/t5/net-forum/a-couple-basic-net-questions/m-p/1634368#M81773</link>
      <description>Wouldn't you need to have the BlockTable open for write if you wanted to add a new block?</description>
      <pubDate>Fri, 05 May 2006 02:13:33 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/a-couple-basic-net-questions/m-p/1634368#M81773</guid>
      <dc:creator>RonnieWilkins</dc:creator>
      <dc:date>2006-05-05T02:13:33Z</dc:date>
    </item>
    <item>
      <title>Re: A couple basic net questions</title>
      <link>https://forums.autodesk.com/t5/net-forum/a-couple-basic-net-questions/m-p/1634369#M81774</link>
      <description>Tony Tanzillo wrote:&lt;BR /&gt;
&amp;gt; No one's talking about opening the block table, you&lt;BR /&gt;
&amp;gt; have to open each block reference for write.&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
Perhaps I did not phrase the question(s) correctly.&lt;BR /&gt;
I know that you must open a reference for write if you&lt;BR /&gt;
intend to modify it.&lt;BR /&gt;
However, does not the following line (from Arx .net labs)&lt;BR /&gt;
open the block table for write?&lt;BR /&gt;
&lt;BR /&gt;
//Now, drill into the database and obtain a reference to the BlockTable&lt;BR /&gt;
BlockTable bt = (BlockTable)trans.GetObject(db.BlockTableId, OpenMode.ForWrite);</description>
      <pubDate>Fri, 05 May 2006 14:52:59 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/a-couple-basic-net-questions/m-p/1634369#M81774</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2006-05-05T14:52:59Z</dc:date>
    </item>
    <item>
      <title>Re: A couple basic net questions</title>
      <link>https://forums.autodesk.com/t5/net-forum/a-couple-basic-net-questions/m-p/1634370#M81775</link>
      <description>rwilkins wrote:&lt;BR /&gt;
&amp;gt; Wouldn't you need to have the BlockTable open for write if you wanted to add a new block?&lt;BR /&gt;
  But you cannot add/modify the block table. You must work with the block table&lt;BR /&gt;
records, ie modelspace/paperspace.</description>
      <pubDate>Fri, 05 May 2006 14:54:05 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/a-couple-basic-net-questions/m-p/1634370#M81775</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2006-05-05T14:54:05Z</dc:date>
    </item>
    <item>
      <title>Re: A couple basic net questions</title>
      <link>https://forums.autodesk.com/t5/net-forum/a-couple-basic-net-questions/m-p/1634371#M81776</link>
      <description>Apparently Alzheimers is setting in.&lt;BR /&gt;
My apologies for weird questions.&lt;BR /&gt;
I could have sworn that the BLOCKTABLE was not&lt;BR /&gt;
modifyable, that ALL entities belonged to either&lt;BR /&gt;
modelspace or paperspace. But I just ran the following&lt;BR /&gt;
code snippet:&lt;BR /&gt;
  BlockTable bt = (BlockTable)t.GetObject(db.BlockTableId, OpenMode.ForWrite);&lt;BR /&gt;
  foreach (ObjectId btrId in bt)&lt;BR /&gt;
  {&lt;BR /&gt;
      BlockTableRecord btr = (BlockTableRecord)t.GetObject(btrId, OpenMode.ForRead);&lt;BR /&gt;
      Utilities.prompt("\nBlocktable record name is: " + btr.Name.ToString());&lt;BR /&gt;
  }&lt;BR /&gt;
and, as I expected, it returned *modelspace and *paperspace, but it also&lt;BR /&gt;
returned every other block in the drawing as well.&lt;BR /&gt;
Guess I'm half right. ALL block defs belong to block table, of which *modelspace&lt;BR /&gt;
and *paperspace are special cases, and can be listed therein. ALL entities belong to either *modelspace&lt;BR /&gt;
or *paperspace.&lt;BR /&gt;
&lt;BR /&gt;
Dont know if I should get a lot more coffee, or just get started on the beer&lt;BR /&gt;
(Its almost noon here!)&lt;BR /&gt;
Perry</description>
      <pubDate>Fri, 05 May 2006 18:15:58 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/a-couple-basic-net-questions/m-p/1634371#M81776</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2006-05-05T18:15:58Z</dc:date>
    </item>
    <item>
      <title>Re: A couple basic net questions</title>
      <link>https://forums.autodesk.com/t5/net-forum/a-couple-basic-net-questions/m-p/1634372#M81777</link>
      <description>Still curious about the transaction question though!</description>
      <pubDate>Fri, 05 May 2006 18:47:55 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/a-couple-basic-net-questions/m-p/1634372#M81777</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2006-05-05T18:47:55Z</dc:date>
    </item>
  </channel>
</rss>

