<?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: Custom entity? in ObjectARX Forum</title>
    <link>https://forums.autodesk.com/t5/objectarx-forum/custom-entity/m-p/1980348#M21127</link>
    <description>Mike:&lt;BR /&gt;
&lt;BR /&gt;
  Recent versions of the wizard can create custom objects in an ARX project, &lt;BR /&gt;
so just use the wizard and be done with it. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;BR /&gt;
-- &lt;BR /&gt;
Owen Wengerd&lt;BR /&gt;
President, ManuSoft ==&amp;gt; http://www.manusoft.com&lt;BR /&gt;
VP Americas, CADLock, Inc. ==&amp;gt; http://www.cadlock.com</description>
    <pubDate>Thu, 31 May 2007 01:58:26 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2007-05-31T01:58:26Z</dc:date>
    <item>
      <title>Custom entity?</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/custom-entity/m-p/1980341#M21120</link>
      <description>I have developed several entities before but all of them in a dbx project. This time I just want to create an AcDbEntity derived class for a title block in the arx application, not a stand-alone dbx.&lt;BR /&gt;
&lt;BR /&gt;
Is there a minimum of work that needs to be done? Below is what I have so far, but when I try to append an object of this class to the database, I get an exception error. The debug window shows the following line:&lt;BR /&gt;
&lt;BR /&gt;
[code]&lt;BR /&gt;
First-chance exception at 0x7c812a5b in acad.exe: Microsoft C++ exception: CInvalidArgException at memory location 0x0012f64c..&lt;BR /&gt;
[/code]&lt;BR /&gt;
&lt;BR /&gt;
Any suggestions?&lt;BR /&gt;
&lt;BR /&gt;
[code]&lt;BR /&gt;
#pragma once&lt;BR /&gt;
&lt;BR /&gt;
class TitleBlock : public AcDbEntity&lt;BR /&gt;
{&lt;BR /&gt;
private:&lt;BR /&gt;
	AcDbExtents _page;&lt;BR /&gt;
	AcDbExtents _dwgArea;&lt;BR /&gt;
	&lt;BR /&gt;
public:&lt;BR /&gt;
	TitleBlock(void);&lt;BR /&gt;
	~TitleBlock(void);&lt;BR /&gt;
&lt;BR /&gt;
	virtual Adesk::Boolean worldDraw(AcGiWorldDraw* mode);&lt;BR /&gt;
	virtual Acad::ErrorStatus dwgInFields(AcDbDwgFiler* pFiler);&lt;BR /&gt;
	virtual Acad::ErrorStatus dwgOutFields(AcDbDwgFiler* pFiler) const;&lt;BR /&gt;
};&lt;BR /&gt;
&lt;BR /&gt;
#include "StdAfx.h"&lt;BR /&gt;
#include "TitleBlock.h"&lt;BR /&gt;
&lt;BR /&gt;
TitleBlock::TitleBlock(void)&lt;BR /&gt;
: AcDbEntity()&lt;BR /&gt;
, _page(AcDbExtents(AcGePoint3d(0,0,0), AcGePoint3d(8.5,11,0)))&lt;BR /&gt;
, _dwgArea(AcDbExtents(AcGePoint3d(2.0,3.75,0), AcGePoint3d(9.0,6.25,0)))&lt;BR /&gt;
{&lt;BR /&gt;
}&lt;BR /&gt;
&lt;BR /&gt;
TitleBlock::~TitleBlock(void)&lt;BR /&gt;
{&lt;BR /&gt;
}&lt;BR /&gt;
&lt;BR /&gt;
Adesk::Boolean TitleBlock::worldDraw(AcGiWorldDraw* mode)&lt;BR /&gt;
{&lt;BR /&gt;
	assertReadEnabled();&lt;BR /&gt;
&lt;BR /&gt;
	AcGeVector3d x(_page.maxPoint().x - _page.minPoint().x, 0, 0);&lt;BR /&gt;
	AcGeVector3d y(0, _page.maxPoint().y - _page.minPoint().y, 0);&lt;BR /&gt;
&lt;BR /&gt;
	AcGePoint3d pts[5];&lt;BR /&gt;
	pts[0] = _page.minPoint();&lt;BR /&gt;
	pts[1] = pts[0] + x;&lt;BR /&gt;
	pts[2] = pts[0] + x + y;&lt;BR /&gt;
	pts[3] = pts[0] + y;&lt;BR /&gt;
	pts[4] = pts[0];&lt;BR /&gt;
&lt;BR /&gt;
	mode-&amp;gt;geometry().polyline(5, pts);&lt;BR /&gt;
&lt;BR /&gt;
	x.set(_dwgArea.maxPoint().x - _dwgArea.minPoint().x, 0, 0);&lt;BR /&gt;
	y.set(0, _dwgArea.maxPoint().y - _dwgArea.minPoint().y, 0);&lt;BR /&gt;
&lt;BR /&gt;
	pts[0] = _dwgArea.minPoint();&lt;BR /&gt;
	pts[1] = pts[0] + x;&lt;BR /&gt;
	pts[2] = pts[0] + x + y;&lt;BR /&gt;
	pts[3] = pts[0] + y;&lt;BR /&gt;
	pts[4] = pts[0];&lt;BR /&gt;
&lt;BR /&gt;
	mode-&amp;gt;geometry().polyline(5, pts);&lt;BR /&gt;
&lt;BR /&gt;
	return Adesk::kTrue;&lt;BR /&gt;
}&lt;BR /&gt;
&lt;BR /&gt;
Acad::ErrorStatus TitleBlock::dwgInFields(AcDbDwgFiler* pFiler)&lt;BR /&gt;
{&lt;BR /&gt;
	assertWriteEnabled();&lt;BR /&gt;
	Acad::ErrorStatus es = AcDbEntity::dwgInFields(pFiler);&lt;BR /&gt;
	if(es != Acad::eOk)&lt;BR /&gt;
		return es;&lt;BR /&gt;
&lt;BR /&gt;
	AcGePoint3d min, max;&lt;BR /&gt;
	pFiler-&amp;gt;readPoint3d(&amp;amp;min);&lt;BR /&gt;
	pFiler-&amp;gt;readPoint3d(&amp;amp;max);&lt;BR /&gt;
	_page.set(min, max);&lt;BR /&gt;
&lt;BR /&gt;
	pFiler-&amp;gt;readPoint3d(&amp;amp;min);&lt;BR /&gt;
	pFiler-&amp;gt;readPoint3d(&amp;amp;max);&lt;BR /&gt;
	_dwgArea.set(min, max);&lt;BR /&gt;
&lt;BR /&gt;
	return pFiler-&amp;gt;filerStatus();&lt;BR /&gt;
}&lt;BR /&gt;
&lt;BR /&gt;
Acad::ErrorStatus TitleBlock::dwgOutFields(AcDbDwgFiler* pFiler) const&lt;BR /&gt;
{&lt;BR /&gt;
	assertReadEnabled();&lt;BR /&gt;
	Acad::ErrorStatus es = AcDbEntity::dwgOutFields(pFiler);&lt;BR /&gt;
	if(es != Acad::eOk)&lt;BR /&gt;
		return es;&lt;BR /&gt;
	&lt;BR /&gt;
	pFiler-&amp;gt;writePoint3d(_page.minPoint());&lt;BR /&gt;
	pFiler-&amp;gt;writePoint3d(_page.maxPoint());&lt;BR /&gt;
	pFiler-&amp;gt;writePoint3d(_dwgArea.minPoint());&lt;BR /&gt;
	pFiler-&amp;gt;writePoint3d(_dwgArea.maxPoint());&lt;BR /&gt;
&lt;BR /&gt;
	return pFiler-&amp;gt;filerStatus();&lt;BR /&gt;
} &lt;BR /&gt;
&lt;BR /&gt;
Acad::ErrorStatus AddEntity(AcDbObjectId&amp;amp; objId, AcDbEntity* pEnt)&lt;BR /&gt;
{&lt;BR /&gt;
	AcDbDatabase* pDb = acdbHostApplicationServices()-&amp;gt;workingDatabase();&lt;BR /&gt;
	if(!pDb)&lt;BR /&gt;
		return Acad::eInvalidBlockName;&lt;BR /&gt;
&lt;BR /&gt;
	AcDbBlockTable* pBt = NULL;&lt;BR /&gt;
	Acad::ErrorStatus es = pDb-&amp;gt;getBlockTable(pBt, AcDb::kForRead);&lt;BR /&gt;
	if(es == Acad::eOk)&lt;BR /&gt;
	{&lt;BR /&gt;
		AcDbBlockTableRecord* pBtr = NULL;&lt;BR /&gt;
		es = pBt-&amp;gt;getAt(ACDB_MODEL_SPACE, pBtr, AcDb::kForWrite);&lt;BR /&gt;
		if(es == Acad::eOk)&lt;BR /&gt;
		{&lt;BR /&gt;
			es = pBtr-&amp;gt;appendAcDbEntity(objId, pEnt);&lt;BR /&gt;
			pBtr-&amp;gt;close();&lt;BR /&gt;
		}&lt;BR /&gt;
		pBt-&amp;gt;close();&lt;BR /&gt;
	}&lt;BR /&gt;
&lt;BR /&gt;
	return es;&lt;BR /&gt;
}&lt;BR /&gt;
[/code]&lt;BR /&gt;
&lt;BR /&gt;
Mike B</description>
      <pubDate>Tue, 29 May 2007 14:01:17 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/custom-entity/m-p/1980341#M21120</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2007-05-29T14:01:17Z</dc:date>
    </item>
    <item>
      <title>Re: Custom entity?</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/custom-entity/m-p/1980342#M21121</link>
      <description>Ok, after reviewing some notes, it seems that this should not be done like this. It should be created in a DBX dll if it is to have its own worldDraw(...). Is that a correct statement? &lt;BR /&gt;
&lt;BR /&gt;
If done otherwise, then worldDraw(...) is not overriden and the object should be drawn using primative objects?&lt;BR /&gt;
&lt;BR /&gt;
Mike B</description>
      <pubDate>Tue, 29 May 2007 14:15:56 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/custom-entity/m-p/1980342#M21121</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2007-05-29T14:15:56Z</dc:date>
    </item>
    <item>
      <title>Re: Custom entity?</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/custom-entity/m-p/1980343#M21122</link>
      <description>No, that's not a correct statement. You don't need to put custom entity &lt;BR /&gt;
stuff into a dbx unless you intend for that dbx to be able to be loaded into &lt;BR /&gt;
non-Acad based host applications.  If you only intend to work with AutoCAD &lt;BR /&gt;
or AutoCAD based host applications, then there's no reason not to just put &lt;BR /&gt;
it all into an arx module.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;MIKEB_2K4&gt; wrote in message news:5609623@discussion.autodesk.com...&lt;BR /&gt;
Ok, after reviewing some notes, it seems that this should not be done like &lt;BR /&gt;
this. It should be created in a DBX dll if it is to have its own &lt;BR /&gt;
worldDraw(...). Is that a correct statement?&lt;BR /&gt;
&lt;BR /&gt;
If done otherwise, then worldDraw(...) is not overriden and the object &lt;BR /&gt;
should be drawn using primative objects?&lt;BR /&gt;
&lt;BR /&gt;
Mike B&lt;/MIKEB_2K4&gt;</description>
      <pubDate>Tue, 29 May 2007 17:38:48 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/custom-entity/m-p/1980343#M21122</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2007-05-29T17:38:48Z</dc:date>
    </item>
    <item>
      <title>Re: Custom entity?</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/custom-entity/m-p/1980344#M21123</link>
      <description>The object does not have to be defined in a DBX.  You can put custom objects &lt;BR /&gt;
into an ARX if you wish.  However, i would suggest you go ahead and use the &lt;BR /&gt;
wizard to create your custom object.  Otherwise, you may end up forgetting &lt;BR /&gt;
to put in macros like ACRX_DECLARE_MEMBERS, and &lt;BR /&gt;
ACDB_REGISTER_OBJECT_ENTRY_AUTO, etc.  Once you're more acquainted with &lt;BR /&gt;
custom objects, you can probably skip the wizard part and do it manually (or &lt;BR /&gt;
copy from another example you have).&lt;BR /&gt;
&lt;BR /&gt;
Once the custom object has been created, you should be able to just copy it &lt;BR /&gt;
over to your ARX.&lt;BR /&gt;
&lt;BR /&gt;
I'm not sure what your last question means.  All objects in AutoCAD are &lt;BR /&gt;
drawn using primitive objects.&lt;BR /&gt;
&lt;BR /&gt;
-Rich&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;MIKEB_2K4&gt; wrote in message news:5609623@discussion.autodesk.com...&lt;BR /&gt;
Ok, after reviewing some notes, it seems that this should not be done like &lt;BR /&gt;
this. It should be created in a DBX dll if it is to have its own &lt;BR /&gt;
worldDraw(...). Is that a correct statement?&lt;BR /&gt;
&lt;BR /&gt;
If done otherwise, then worldDraw(...) is not overriden and the object &lt;BR /&gt;
should be drawn using primative objects?&lt;BR /&gt;
&lt;BR /&gt;
Mike B&lt;/MIKEB_2K4&gt;</description>
      <pubDate>Tue, 29 May 2007 17:40:51 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/custom-entity/m-p/1980344#M21123</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2007-05-29T17:40:51Z</dc:date>
    </item>
    <item>
      <title>Re: Custom entity?</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/custom-entity/m-p/1980345#M21124</link>
      <description>Art, thanks for your response. I am wondering however, if you disagreed with my statements (which I am agreeing with you on some points), why didn't you answer my first post where I asked "Is there a minimum of work that needs to be done?"?&lt;BR /&gt;
&lt;BR /&gt;
The only thing I disagree with your post on is that "there's no readon not to just put it all into an arx module".&lt;BR /&gt;
&lt;BR /&gt;
I would think it is better to create most custom objects in a dbx since this supports reuse and if the object is to be used in more than one arx application, it would be better for maintenance as well.&lt;BR /&gt;
&lt;BR /&gt;
Mike B</description>
      <pubDate>Wed, 30 May 2007 20:00:49 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/custom-entity/m-p/1980345#M21124</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2007-05-30T20:00:49Z</dc:date>
    </item>
    <item>
      <title>Re: Custom entity?</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/custom-entity/m-p/1980346#M21125</link>
      <description>All I was trying to say is that there's no technical requirement to put a &lt;BR /&gt;
custom object's code into a dbx unless you want it to be able to be loaded &lt;BR /&gt;
into non-acad based host applications.  Sure, they may be other reasons why &lt;BR /&gt;
you might want to use a dbx.&lt;BR /&gt;
&lt;BR /&gt;
I didn't answer your question about a minimum of work because I don't have &lt;BR /&gt;
time to properly answer that - just saying "yes there is a minimum" doesn't &lt;BR /&gt;
seem to me to be a proper answer.&lt;BR /&gt;
&lt;BR /&gt;
&lt;MIKEB_2K4&gt; wrote in message news:5611600@discussion.autodesk.com...&lt;BR /&gt;
Art, thanks for your response. I am wondering however, if you disagreed with &lt;BR /&gt;
my statements (which I am agreeing with you on some points), why didn't you &lt;BR /&gt;
answer my first post where I asked "Is there a minimum of work that needs to &lt;BR /&gt;
be done?"?&lt;BR /&gt;
&lt;BR /&gt;
The only thing I disagree with your post on is that "there's no readon not &lt;BR /&gt;
to just put it all into an arx module".&lt;BR /&gt;
&lt;BR /&gt;
I would think it is better to create most custom objects in a dbx since this &lt;BR /&gt;
supports reuse and if the object is to be used in more than one arx &lt;BR /&gt;
application, it would be better for maintenance as well.&lt;BR /&gt;
&lt;BR /&gt;
Mike B&lt;/MIKEB_2K4&gt;</description>
      <pubDate>Wed, 30 May 2007 20:45:45 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/custom-entity/m-p/1980346#M21125</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2007-05-30T20:45:45Z</dc:date>
    </item>
    <item>
      <title>Re: Custom entity?</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/custom-entity/m-p/1980347#M21126</link>
      <description>Understood, thanks for replying. I guess I could create a custom object using the wizard and look at the basic setup. Not sure if this would help though, may just confuse the issue because some things the wizard creates may be only required because it is a dbx project. Not sure, but....&lt;BR /&gt;
&lt;BR /&gt;
Mike B</description>
      <pubDate>Wed, 30 May 2007 23:51:35 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/custom-entity/m-p/1980347#M21126</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2007-05-30T23:51:35Z</dc:date>
    </item>
    <item>
      <title>Re: Custom entity?</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/custom-entity/m-p/1980348#M21127</link>
      <description>Mike:&lt;BR /&gt;
&lt;BR /&gt;
  Recent versions of the wizard can create custom objects in an ARX project, &lt;BR /&gt;
so just use the wizard and be done with it. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;BR /&gt;
-- &lt;BR /&gt;
Owen Wengerd&lt;BR /&gt;
President, ManuSoft ==&amp;gt; http://www.manusoft.com&lt;BR /&gt;
VP Americas, CADLock, Inc. ==&amp;gt; http://www.cadlock.com</description>
      <pubDate>Thu, 31 May 2007 01:58:26 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/custom-entity/m-p/1980348#M21127</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2007-05-31T01:58:26Z</dc:date>
    </item>
    <item>
      <title>Re: Custom entity?</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/custom-entity/m-p/1980349#M21128</link>
      <description>Mike;&lt;BR /&gt;
&lt;BR /&gt;
I do not have to much experience with custom objects, but was able to use &lt;BR /&gt;
them in some of my commands, here is a link to a follow up of the very basic &lt;BR /&gt;
requirements:&lt;BR /&gt;
&lt;BR /&gt;
http://www.theswamp.org/index.php?topic=8563.0&lt;BR /&gt;
&lt;BR /&gt;
It is a project of a simple custom line, just to expose what is needed, and &lt;BR /&gt;
all as normal ARX project and no wizard was used.&lt;BR /&gt;
&lt;BR /&gt;
HTH.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;MIKEB_2K4&gt; wrote in message news:5611865@discussion.autodesk.com...&lt;BR /&gt;
Understood, thanks for replying. I guess I could create a custom object &lt;BR /&gt;
using the wizard and look at the basic setup. Not sure if this would help &lt;BR /&gt;
though, may just confuse the issue because some things the wizard creates &lt;BR /&gt;
may be only required because it is a dbx project. Not sure, but....&lt;BR /&gt;
&lt;BR /&gt;
Mike B&lt;/MIKEB_2K4&gt;</description>
      <pubDate>Thu, 31 May 2007 15:02:55 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/custom-entity/m-p/1980349#M21128</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2007-05-31T15:02:55Z</dc:date>
    </item>
  </channel>
</rss>

