eNoClassId error

eNoClassId error

Anonymous
Not applicable
2,420 Views
8 Replies
Message 1 of 9

eNoClassId error

Anonymous
Not applicable
Hi all, I'm trying to append my own entity derived from AcDbEntity to database, but I'm receiving 409 error code (eNoClassId) in appendAcDbEntity. When I append e.g. new AcDbLine instead, everything works ok. I am using ObjectARX 2010.

It should be a slightly modified Line (I derive it from AcDbEntity, but AcDbLine produces the same problem), this is how I create it:

{code}
CProtLine *protLine = new CProtLine(); //calls CProtLine(): AcDbEntity() {}
protLine->startPoint = AcGePoint3d(pt1,pt1,pt1); //startPoint and endPoint are my attributes
protLine->endPoint = AcGePoint3d(pt2,pt2,pt2);
...
AcDbObjectId retId = AcDbObjectId::kNull;
Acad::ErrorStatus es = pBlockTableRecord->appendAcDbEntity(retId, protLine); //here 409 error code is produced
{code}

(all access to database and record tables is ok).

Can anybody help me, please ? What's wrong and how should I fix it ? I can provide more code, if necessary...
Thanks. David Edited by: [email protected] on Apr 12, 2010 2:16 PM
0 Likes
2,421 Views
8 Replies
Replies (8)
Message 2 of 9

Anonymous
Not applicable
Have you called rxInit() on your custom class so that it is added to the
AcRx class tree?

wrote in message
news:[email protected]...
Hi all, I'm trying to append my own entity derived from AcDbEntity to
database, but I'm receiving 409 error code (eNoClassId) in appendAcDbEntity.
When I append e.g. new AcDbLine instead, everything works ok. I am using
ObjectARX 2010.

It should be a slightly modified Line (I derive it from AcDbEntity, but
AcDbLine produces the same problem), this is how I create it:

{code}
CProtLine *protLine = new CProtLine(); //calls CProtLine():
AcDbEntity() {}
protLine->startPoint = AcGePoint3d(pt1,pt1,pt1); //startPoint
and endPoint are my attributes
protLine->endPoint = AcGePoint3d(pt2,pt2,pt2);
...
AcDbObjectId retId = AcDbObjectId::kNull;
Acad::ErrorStatus es = pBlockTableRecord->appendAcDbEntity(retId, protLine);
//here 409 error code is produced
{code}

(all access to database and record tables is ok).

Can anybody help me, please ? What's wrong and how should I fix it ? I can
provide more code, if necessary...
Thanks. David

Edited by: [email protected] on Apr 12, 2010 2:16 PM
0 Likes
Message 3 of 9

Anonymous
Not applicable
BIG THANK YOU, Art !
I didn't notice the need for this call at any example source code, but it definitely solved my problem.
Once again, thanks a lot, you saved my day ! 😉
0 Likes
Message 4 of 9

Anonymous
Not applicable
ersild1,

Can you post your code for your entity , because I can not find examples for it. Edited by: k0s3rA on May 4, 2010 2:37 PM
0 Likes
Message 5 of 9

Anonymous
Not applicable

This seems to be the solution to my problem... i just CANNOT get the classID back from my custom polyline! the only thing is I'm using SimpleSquare as my template as I need a manged wrapper and it seems the easiest implimentation however it NEVER mentions this at all!!! If fact I'm annoy that it works. How?!? The only thing it does differently that I can see is it passes it's custom entity through EntityJig. Surely that isn't necessary...

So anyway, the question I have is:

 

1 - where do I call MyClass1::rxInit();?

2 - where to I call acrxBuildClassHierarchy();

 

   my DBX is linked through a managed wrapper to a vb.net file.... I have no ARX file, just a vb file linked to a DBX file,  and the DBX entry point is set up with

 

RegisterManagedWrapperLink(); // Setup the managed-unmanaged connection.

RegisterDbxApp(); // Setup demand-loading for this object enabler module.

 

and so on instead of calling acrxBuildClassHierarchy(); anywhere at all.

 

nor can I find rxInit() in documentation anywhere (I've been searching)...any input is highly valued!!!

0 Likes
Message 6 of 9

Balaji_Ram
Alumni
Alumni

Hi,

 

The "PolySamp" example in the ObjectARX SDK may be a better sample for you to use as a template. The dbx and managed wrapper are separate projects and you can also find the use of "rxInit" and "acrxBuildClassHierarchy" in Poly.cpp.

 

In case of a SimpleSquare, the custom entity also has a pointer to the manged wrapper which makes it accessible only from managed applications. Note this comment in the "AsdkSimpleSquare.h" 

<<<

// Note - a straightforward custom entity which only defines a red-square with grip points at each corner.
// Note here that AsdkSimpleSquare cannot be exported with DLLIMPEXP or __declspec(dllexport) because
// it has managed components. This is ok for the enabler since AutoCAD receives a pointer from the
// pseudo constructor in ACRX_DEFINE_DXF_MEMBERS. However for UI components, this limits us to managed
// applications that can access the class.

>>>

 

Regards,

 



Balaji
Developer Technical Services
Autodesk Developer Network

0 Likes
Message 7 of 9

Anonymous
Not applicable

First, thanks SO much for you time!

 

Correct me if I'm wrong (really, correct me. I WANT to be wront on this), but using the PolySamp case seemed to mean using COM as well! frankly I'm not a COM expert and I've had to learn c++, ObjectARX and .net for AutoCAD in a month for a 6 month programming contract, I haven't slept in a month and have written no code - then I get to COM - that's a topic for a degree in itself! I wan't sure if the managed/unmanged thing in PolySamp could run without the COM component the way Simple Squre does - and the "installers" needed to build it were REMOVED from Visual Studio 2012 so I've never seen it built!

 

Having said that if I can use the PolySamp implementation I will, but I can live without Full COM compatibility for my DLL, if they want that they can extend the contract down the line....are the managed / unmanged sections of the sample independent, or do I really have to write,

 

custom class

managed interface

massive com wrapper of the lot

then the actual vb.net project (which is huge in it's own right)?

 

I just wan't to write the mixed manged code level in simple square...

 

Cheers,

Carl

0 Likes
Message 8 of 9

Balaji_Ram
Alumni
Alumni

Most welcome.

 

The COM wrapper is only required for the custom entity properties to be displayed by the property palette in AutoCAD. It is possible to use the custom entity (dbx), its managed wrapper and the arx/managed project that creates the custom entity to be used without the COM wrapper.

 

The "SimpleSquare" sample should be good enough if you are only using the custom entity in a managed application. Is that what you are trying ? If so, we can try and resolve that error.

Is it possible to provide a minimal sample project similar to the "SimpleSquare" that shows the error you are facing ?



Balaji
Developer Technical Services
Autodesk Developer Network

0 Likes
Message 9 of 9

Anonymous
Not applicable

"The COM wrapper is only required for the custom entity properties to be displayed by the property palette in AutoCAD. "

 

Ok, very interesting! but I can revist that if they extend the contract in 6 month! Great to know though.

 

"The "SimpleSquare" sample should be good enough if you are only using the custom entity in a managed application. Is that what you are trying ? If so, we can try and resolve that error."

 

I KINDA solved it. I got my classID!!!! and  crashed autocad. but I'll return to that...oh and yes, that's the kind of app we need! 

 

My error was an rxinit() thing, in the sense i put it in the dbx entrypoint file with build heirchy right before the manged wrapper call, then it stepped through, got the classid! (yaya!!!!) and appended the entity, then created, then trans.close etc then.... unhandled memory exception! to be honest, it's the end of the day and I was so happy with my classID I was going to leave it till the morning... 🙂 Unless how I added rxinit() did that (and it may have, darned if I can see it in SimpleSquare :/) I'm hoping I can find it by debugging (I'm getting better at using vs 2012 to it's fullest doing this project). 

 

Having said that if I'm wrong about rxinit() in dbx files or where it sits in the managed wrapper I need to know! and very happy to upload stuff if you like - I'll get it ready after dinner 🙂

0 Likes