TheSwamp
Code Red => .NET => Topic started by: ahlzl on September 21, 2008, 04:21:40 AM
-
Entity -> AcDbEntity:
AcDbEntity *pEnt = (AcDbEntity*)ent.UnmanagedObject.ToPointer(); // ent is Entity
but how ObjectId change to AcDbObjectId? thanks for your help.
-
you can try something like
ObjectId idb;
AcDbObjectId ida;
ida.setFromOldId(idb.OldId);
idb = ObjectId(ida.asOldId());
//or
ObjectId idc((long)(AcDbStub*)ida);
AcDbObjectId idd(reinterpret_cast<AcDbStub*>(idc.OldId));
-
another way
Editor^ ed = Application::DocumentManager->MdiActiveDocument->Editor;
Database ^pDb = Application::DocumentManager->MdiActiveDocument->Database;
AcDbObjectId ide = *reinterpret_cast<AcDbObjectId*>(&(pDb->CurrentSpaceId));
ed->WriteMessage(pDb->CurrentSpaceId.ToString());
acutPrintf(_T("\n%ld"), ide.asOldId());
-
you can try something like
ObjectId idb;
AcDbObjectId ida;
ida.setFromOldId(idb.OldId);
idb = ObjectId(ida.asOldId());
//or
ObjectId idc((long)(AcDbStub*)ida);
AcDbObjectId idd(reinterpret_cast<AcDbStub*>(idc.OldId));
Daniel is god !
ObjectId idb;
AcDbObjectId ida;
ida.setFromOldId(idb->OldId);
idb = ObjectId(ida.asOldId());
-
Entity -> AcDbEntity:
AcDbEntity *pEnt = (AcDbEntity*)ent.UnmanagedObject.ToPointer(); // ent is Entity
but how ObjectId change to AcDbObjectId? thanks for your help.
from mgdinterop.h:
#define GETOBJECTID(id) (*reinterpret_cast<AcDbObjectId*>(&(id)))
inline Autodesk::AutoCAD::DatabaseServices::ObjectId ToObjectId(const AcDbObjectId& pt)
{
Autodesk::AutoCAD::DatabaseServices::ObjectId ret;
GETOBJECTID(ret) = pt;
return ret;
}