<?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 Re: Open and close database in ObjectARX Forum</title>
    <link>https://forums.autodesk.com/t5/objectarx-forum/open-and-close-database/m-p/8099759#M6397</link>
    <description>&lt;P&gt;Hi;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Try to Open&amp;nbsp;block table for write, not for read.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;B&lt;SPAN&gt;ecause you do not use pBlockTable only to access the model space, but later you add GenerativeLinePrototype4Id to pBlockTable .&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 29 Jun 2018 06:52:48 GMT</pubDate>
    <dc:creator>zrobert</dc:creator>
    <dc:date>2018-06-29T06:52:48Z</dc:date>
    <item>
      <title>Open and close database</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/open-and-close-database/m-p/8098851#M6396</link>
      <description>&lt;P&gt;Dear all,&lt;/P&gt;&lt;P&gt;I have a problem with opening and closing the database in order to create my custom object to it. The .arx loads successfully,&amp;nbsp; but when i invoke my command i am invite to debug or close the program. AuToCAD 2017 update 1.2 was installed with administrator right.&lt;/P&gt;&lt;P&gt;ARXDbg build fine in VS 2015 community with update 1. No problem at loading in AutoCAD 2017&lt;/P&gt;&lt;P&gt;Can anyone help me with these line of codes?&lt;/P&gt;&lt;P&gt;should i use a void function instead of a AcDbObject createGenerativeLinePrototype function?&lt;/P&gt;&lt;P&gt;What am i missing?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you!!!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt; cDbDatabase * pGenerativeDb;&lt;BR /&gt; AcGePoint3d GenerativeStartPoint(5.0, 5.0, 5.0);&lt;BR /&gt; AcGePoint3d GenerativeEndPoint(36.0, 36, 36.0);&lt;BR /&gt;&lt;BR /&gt; //GenerativeLinePrototype4 * pGLine04 = new GenerativeLinePrototype4(GenerativeStartPoint, GenerativeEndPoint);&lt;BR /&gt;&lt;BR /&gt; AcDbEntity* pGLine04 = new GenerativeLinePrototype4(GenerativeStartPoint, GenerativeEndPoint);&lt;BR /&gt;&lt;BR /&gt; &lt;BR /&gt; AcDbBlockTable* pBlockTable;&lt;BR /&gt; acdbHostApplicationServices()-&amp;gt;workingDatabase()-&amp;gt;getSymbolTable(pBlockTable, AcDb::kForRead);&lt;BR /&gt; &lt;BR /&gt; AcDbBlockTableRecord *pBlockTableRecord;&lt;BR /&gt; pBlockTable-&amp;gt;getAt(ACDB_MODEL_SPACE, pBlockTableRecord, AcDb::kForWrite);&lt;BR /&gt; &lt;BR /&gt;&lt;BR /&gt; AcDbObjectId GenerativeLinePrototype4Id;&lt;BR /&gt; pBlockTable-&amp;gt;add(GenerativeLinePrototype4Id, pBlockTableRecord);&lt;BR /&gt; pBlockTableRecord-&amp;gt;appendAcDbEntity(GenerativeLinePrototype4Id, pGLine04);&lt;BR /&gt; pBlockTable-&amp;gt;close();&lt;BR /&gt; pBlockTableRecord-&amp;gt;close();&lt;BR /&gt; pGLine04-&amp;gt;close();&lt;BR /&gt; &lt;BR /&gt; //pGLine04-&amp;gt;objectClosed(GenerativeLinePrototype4Id);&lt;/PRE&gt;</description>
      <pubDate>Thu, 28 Jun 2018 19:45:18 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/open-and-close-database/m-p/8098851#M6396</guid>
      <dc:creator>nggarnaud</dc:creator>
      <dc:date>2018-06-28T19:45:18Z</dc:date>
    </item>
    <item>
      <title>Re: Open and close database</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/open-and-close-database/m-p/8099759#M6397</link>
      <description>&lt;P&gt;Hi;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Try to Open&amp;nbsp;block table for write, not for read.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;B&lt;SPAN&gt;ecause you do not use pBlockTable only to access the model space, but later you add GenerativeLinePrototype4Id to pBlockTable .&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 29 Jun 2018 06:52:48 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/open-and-close-database/m-p/8099759#M6397</guid>
      <dc:creator>zrobert</dc:creator>
      <dc:date>2018-06-29T06:52:48Z</dc:date>
    </item>
    <item>
      <title>Re: Open and close database</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/open-and-close-database/m-p/8099893#M6398</link>
      <description>&lt;P&gt;Basically your code contains exactly one disastrous wrong line&lt;/P&gt;
&lt;PRE&gt;pBlockTable-&amp;gt;add(GenerativeLinePrototype4Id, pBlockTableRecord); &lt;/PRE&gt;
&lt;P&gt;I think your code should look like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;AcDbDatabase * pGenerativeDb; // &amp;lt;-- What are you doing with this?
AcGePoint3d GenerativeStartPoint(5.0, 5.0, 5.0);
AcGePoint3d GenerativeEndPoint(36.0, 36, 36.0);

AcDbEntity* pGLine04 = new GenerativeLinePrototype4(GenerativeStartPoint, GenerativeEndPoint);

AcDbBlockTable* pBlockTable;
Acad::ErrorStatus es;
es = acdbHostApplicationServices()-&amp;gt;workingDatabase()-&amp;gt;getSymbolTable(pBlockTable, AcDb::kForRead);
if (es==Acad::eOk)
{ 
	AcDbBlockTableRecord *pBlockTableRecord;
	es = pBlockTable-&amp;gt;getAt(ACDB_MODEL_SPACE, pBlockTableRecord, AcDb::kForWrite);
	if (es==Acad::eOk)
	{
		 AcDbObjectId GenerativeLinePrototype4Id;
		 //NO!!! You don't want to add to the block table!
		 //pBlockTable-&amp;gt;add(GenerativeLinePrototype4Id, pBlockTableRecord); 
		 pBlockTableRecord-&amp;gt;appendAcDbEntity(GenerativeLinePrototype4Id, pGLine04);
		 pBlockTableRecord-&amp;gt;close();
		 pGLine04-&amp;gt;close();
	}
	pBlockTable-&amp;gt;close();
}&lt;/PRE&gt;
&lt;P&gt;It is perfectly right to open the block table for read only, because you only use it to open the model space blocktable record.&amp;nbsp; I only added some error checking.&lt;/P&gt;</description>
      <pubDate>Fri, 29 Jun 2018 08:06:10 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/open-and-close-database/m-p/8099893#M6398</guid>
      <dc:creator>tbrammer</dc:creator>
      <dc:date>2018-06-29T08:06:10Z</dc:date>
    </item>
    <item>
      <title>Re: Open and close database</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/open-and-close-database/m-p/8100973#M6399</link>
      <description>&lt;P&gt;Thank you all, i will give it a try and come back at you pretty soon.&lt;/P&gt;</description>
      <pubDate>Fri, 29 Jun 2018 15:14:48 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/open-and-close-database/m-p/8100973#M6399</guid>
      <dc:creator>nggarnaud</dc:creator>
      <dc:date>2018-06-29T15:14:48Z</dc:date>
    </item>
  </channel>
</rss>

