<?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: Make a sample for read dictionary error in ObjectARX Forum</title>
    <link>https://forums.autodesk.com/t5/objectarx-forum/make-a-sample-for-read-dictionary-error/m-p/6864965#M8768</link>
    <description>&lt;P&gt;Delete line acutRelRb(sb) because you twice free the same memory.&lt;/P&gt;</description>
    <pubDate>Thu, 09 Feb 2017 05:32:09 GMT</pubDate>
    <dc:creator>Alexander.Rivilis</dc:creator>
    <dc:date>2017-02-09T05:32:09Z</dc:date>
    <item>
      <title>Make a sample for read dictionary error</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/make-a-sample-for-read-dictionary-error/m-p/6862685#M8765</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;i have make a sample for add xrecord to entity, but while i make the sample for read the xrecod, the problem stop at acutprintf, anyone can tell me where i made the mistake?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For add xrecord:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="add xrecord.jpg" style="width: 607px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/320510i7AA4F986CDA8BC51/image-size/large?v=v2&amp;amp;px=999" role="button" title="add xrecord.jpg" alt="add xrecord.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For read the xrecord, but programe stop at acutprintf:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="READ.jpg" style="width: 517px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/320514iC1ECE925C5867AEE/image-size/large?v=v2&amp;amp;px=999" role="button" title="READ.jpg" alt="READ.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Error information:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="error.jpg" style="width: 705px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/320513i61C8B73A1A5B08E2/image-size/large?v=v2&amp;amp;px=999" role="button" title="error.jpg" alt="error.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 08 Feb 2017 13:53:18 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/make-a-sample-for-read-dictionary-error/m-p/6862685#M8765</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-02-08T13:53:18Z</dc:date>
    </item>
    <item>
      <title>Re: Make a sample for read dictionary error</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/make-a-sample-for-read-dictionary-error/m-p/6862863#M8766</link>
      <description>&lt;P&gt;First of all, please post the code as text, not as picture. In the browser you can add code with forum button: &amp;lt;/&amp;gt;&lt;/P&gt;&lt;P&gt;With the code i can reproduce the problem.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Next is, i think AcDb::kDxfInt32 will be sb-&amp;gt;resval.rlong&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here an example that will work, notice, BeCAD_ItextData is an custom class from my application. It also checks if there is&lt;/P&gt;&lt;P&gt;always an Xrecord on the entity&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sets the Xrecord:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;void setItextXrecordData(AcDbText *pText, BeCAD_ItextData *pItextData)
{
	AcDbObjectId extDictId = pText-&amp;gt;extensionDictionary();

	if (extDictId == NULL)
	{
		pText-&amp;gt;createExtensionDictionary();

		extDictId = pText-&amp;gt;extensionDictionary();
	}

	AcDbDictionary *pDictionary;

	if (acdbOpenObject(pDictionary, extDictId, AcDb::kForWrite) != Acad::eOk)
	{
		return;
	}

	AcDbXrecord *pXrecord = NULL;

	if (!pDictionary-&amp;gt;has(_T("CCNC_Data")))
	{
		pXrecord = new AcDbXrecord();

		AcDbObjectId xRecordId;

		pDictionary-&amp;gt;setAt(_T("CCNC_Data"), pXrecord, xRecordId);

		pDictionary-&amp;gt;close();
	}
	else
	{
		AcDbObjectId xRecordId;

		pDictionary-&amp;gt;getAt(_T("CCNC_Data"), xRecordId);

		pDictionary-&amp;gt;close();

		if (acdbOpenObject(pXrecord, xRecordId, AcDb::kForWrite) != Acad::eOk)
		{
			return;
		}
	}

	if (pXrecord == NULL)
	{
		return;
	}

	struct resbuf *prbXtn;

	if (pItextData-&amp;gt;m_drawSpaceId == AcDbObjectId::kNull)
	{
		prbXtn = acutBuildList(
			AcDb::kDxfInt16, pItextData-&amp;gt;m_scale,
			AcDb::kDxfInt16, pItextData-&amp;gt;m_unit,
			AcDb::kDxfReal, pItextData-&amp;gt;m_height,
			RTNONE);
	}
	else
	{
		ads_name ename;

		acdbGetAdsName(ename, pItextData-&amp;gt;m_drawSpaceId);

		prbXtn = acutBuildList(
			AcDb::kDxfInt16, pItextData-&amp;gt;m_scale,
			AcDb::kDxfInt16, pItextData-&amp;gt;m_unit,
			AcDb::kDxfReal, pItextData-&amp;gt;m_height,
			AcDb::kDxfSoftPointerId, ename,
			RTNONE);
	}

	pXrecord-&amp;gt;setFromRbChain(*prbXtn);

	pXrecord-&amp;gt;close();

	ads_relrb(prbXtn);
}&lt;/PRE&gt;&lt;P&gt;Reads the Xrecord:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;bool getItextXrecordData(AcDbText *pText, BeCAD_ItextData *pItextData)
{
	AcDbObjectId extDictId = pText-&amp;gt;extensionDictionary();

	AcDbDictionary *pDictionary;

	if (acdbOpenObject(pDictionary, extDictId, AcDb::kForRead) != Acad::eOk)
	{
		return false;
	}

	AcDbObjectId xRecordId;

	pDictionary-&amp;gt;getAt(_T("CCNC_Data"), xRecordId);

	pDictionary-&amp;gt;close();

	AcDbXrecord *pXrecord;

	if (acdbOpenObject(pXrecord, xRecordId, AcDb::kForRead) != Acad::eOk)
	{
		return false;
	}

	struct resbuf *prbXtn;

	pXrecord-&amp;gt;rbChain(&amp;amp;prbXtn);

	pXrecord-&amp;gt;close();

	struct resbuf *pTemp;

	pTemp = prbXtn;

	pItextData-&amp;gt;m_scale = pTemp-&amp;gt;resval.rint;

	pTemp = pTemp-&amp;gt;rbnext;

	pItextData-&amp;gt;m_unit = pTemp-&amp;gt;resval.rint;

	pTemp = pTemp-&amp;gt;rbnext;

	pItextData-&amp;gt;m_height = pTemp-&amp;gt;resval.rreal;

	pTemp = pTemp-&amp;gt;rbnext;

	if (pTemp != NULL)
	{
		ads_name ename;

		memcpy(ename, pTemp-&amp;gt;resval.rlname, sizeof(ads_name));

		acdbGetObjectId(pItextData-&amp;gt;m_drawSpaceId, ename);
	}
	else
	{
		pItextData-&amp;gt;m_drawSpaceId = AcDbObjectId::kNull;
	}

	ads_relrb(prbXtn);

	return true;
}&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 08 Feb 2017 14:36:30 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/make-a-sample-for-read-dictionary-error/m-p/6862863#M8766</guid>
      <dc:creator>BerndCuder8196</dc:creator>
      <dc:date>2017-02-08T14:36:30Z</dc:date>
    </item>
    <item>
      <title>Re: Make a sample for read dictionary error</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/make-a-sample-for-read-dictionary-error/m-p/6864937#M8767</link>
      <description>&lt;P&gt;thank you! very appriciate, now i found a very strange things. if i not&amp;nbsp;use "sb=rb", and just "acutPrintf(_T("\n对象的属性为:%s"),rb-&amp;gt;resval.rstring)", the program is successful, if i used the temporary&amp;nbsp;resbuf "sb", the program error and stop.&lt;/P&gt;</description>
      <pubDate>Thu, 09 Feb 2017 05:05:03 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/make-a-sample-for-read-dictionary-error/m-p/6864937#M8767</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-02-09T05:05:03Z</dc:date>
    </item>
    <item>
      <title>Re: Make a sample for read dictionary error</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/make-a-sample-for-read-dictionary-error/m-p/6864965#M8768</link>
      <description>&lt;P&gt;Delete line acutRelRb(sb) because you twice free the same memory.&lt;/P&gt;</description>
      <pubDate>Thu, 09 Feb 2017 05:32:09 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/make-a-sample-for-read-dictionary-error/m-p/6864965#M8768</guid>
      <dc:creator>Alexander.Rivilis</dc:creator>
      <dc:date>2017-02-09T05:32:09Z</dc:date>
    </item>
    <item>
      <title>Re: Make a sample for read dictionary error</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/make-a-sample-for-read-dictionary-error/m-p/6865688#M8769</link>
      <description>Perfect! it was done like you said, thank you!</description>
      <pubDate>Thu, 09 Feb 2017 12:10:49 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/make-a-sample-for-read-dictionary-error/m-p/6865688#M8769</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-02-09T12:10:49Z</dc:date>
    </item>
    <item>
      <title>Re: Make a sample for read dictionary error</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/make-a-sample-for-read-dictionary-error/m-p/6865729#M8770</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;@Anonymous wrote:&lt;BR /&gt;Perfect! it was done like you said, thank you!&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I've reassign Solution as far as you mark your post, which does not contain Solution, instead of my or &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/792772"&gt;@BerndCuder8196&lt;/a&gt; post.&lt;/P&gt;</description>
      <pubDate>Thu, 09 Feb 2017 12:28:15 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/make-a-sample-for-read-dictionary-error/m-p/6865729#M8770</guid>
      <dc:creator>Alexander.Rivilis</dc:creator>
      <dc:date>2017-02-09T12:28:15Z</dc:date>
    </item>
  </channel>
</rss>

