I never did find a manged -> un-manged direct solution, but if anyone else is ever in this boat, here was my solution:
I created a c++ function inside my custom object called ConstructPoly - I pass it the ObjectID of the polyline I've created though TraceBoundary through the managed wrapper like so:
Acad::ErrorStatusBCHF::LotObjectWrap::mgLotObject::ConstructPoly(Autodesk::AutoCAD::DatabaseServices::ObjectIdvalue)
{
Autodesk::AutoCAD::Runtime::Interop::Check(GetImpObj()->ConstructPoly(GETOBJECTID(value)));
returnAcad::eOk;
}
And then here is the actual unmanaged function that recieves it:
Acad::ErrorStatusBCHF_LotObject::ConstructPoly(AcDbObjectIdvalue)
{
//make sure objectID not null
if(value==NULL)
returnAcad::eNullObjectId;//<-if is drop out
//declare an entity
AcDbEntity*ent=NULL;
//for debugging
acutPrintf(_T("\nEntering Vertex Constructor: ObjectID = %d"),value);
//open entity for read
if(acdbOpenAcDbEntity(ent,value,AcDb::kForRead)!=Acad::eOk)
returnAcad::eNotOpenForRead;//<-drop out if fail
//confirm entity is open for read
if(ent==NULL)
returnAcad::eNullEntityPointer;//<- it isn't drop out
//its all good, check type
if(ent->isKindOf(AcDbPolyline::desc()))
{
AcDbPolyline*pickPoly;
pickPoly=AcDbPolyline::cast(ent);
acutPrintf(_T("\nPassed Test, Entity IS a AcDbPolyline"));
// Use a for loop to get each vertex, one by one
intvx=pickPoly->numVerts();
for(inti=0;i<=vx-1;i++)
{
AcGePoint2dpt;
pickPoly->getPointAt(i,pt);
doublebulgeNow;
pickPoly->getBulgeAt(i,bulgeNow);
doubleSwidth;
doubleEwidth;
pickPoly->getWidthsAt(i,Swidth,Ewidth);
this->addVertexAt(i,pt,bulgeNow,Swidth,Ewidth,0);
}
this->setClosed(pickPoly->isClosed());
pickPoly->upgradeOpen();
pickPoly->erase();
pickPoly->close();
}
else
{
acutPrintf(_T("\nFailed Test, Entity is NOT an AcDbPolyline"));
returnAcad::eNotAnEntity;
}
if(ent!=NULL)
ent->close();
returnAcad::eOk;
}
and then you can do this:
myCustomObjectName.ConstructPoly(polyID)
in vb.net and it creates the drived polyline object and deletes the polyline handed it.
Hope that helps someone 🙂