OK, I have an arx .net project, a dbx project, and a dbx.net wrapper project. This is all working fine except the way I have to open my custom objects in the same manner that I can open native objects. Basically, if I wanted to open a line (native) object, I can get the .net wrapped object from the object id.
[code]
using (Transaction tr = curDb.TransactionManager.StartTransaction())
{
Line line = tr.OpenObject(lineId, OpenMode.ForRead) as Line;
... Do something with line here.
}
[/code]
For my custom object, I have to open the custom as an RXObject first then create the .net object passing in the unmanaged object as a parameter.
[code]
using (Transaction tr = curDb.TransactionManager.StartTransaction())
{
RXObject rxObj = tr.OpenObject(lineId, OpenMode.ForRead) as RXObject;
if(rxObj != null)
{
CustObjNet custObj = new CustObjNet(rxObj.UnamanagedObject, true);
.... Do something with custObj
}
... Do something with line here.
}
[/code]
Is the above code correct for custom objects? Is there something that can be done in the .net Wrapper to make it behave like the native entity wrappers?
Any advice would be appreciated.
Mike B
OK, WRT to the original post, I have found that I needed to implement the AcMgObjectFactoryBase in my dbx .net project. I have done this by adding a main.cpp similar to the Polysamps example and implemented the acrxEntryPoint. I believe this will solve the original problem, but the entry point is not being called. I don't need to "NETLOAD" the dbx .net dll but it must need to be loaded somewhere in order for the entry point to be called no? Any thoughts?
Mike B
I have it working. But, I wish Autodesk would update their examples provide better documentation. The polysamps application shows:
[code]
static AcMgObjectFactoryBase __nogc * __nogc * g_pEs = NULL;
[/code]
I have changed it to:
[code]
static AcMgObjectFactoryBase** g_pES = NULL;
[/code]
And it worked. As for loading the .net DBX I have used DynamicLinker.LoadModule() in the arx application Initialize() method.
I am just posting this for reference purposes.
Mike B