Try this code:
[code]
static void SetECSasUCS(void)
{
Acad::ErrorStatus es;
ads_name en; ads_point p;
if (acedEntSel("\nSelect entity: ",en,p) == RTNORM) {
AcDbObjectId eId; acdbGetObjectId(eId,en);
AcDbObjectPointer
pEnt(eId,AcDb::kForRead);
if ((es = pEnt.openStatus()) == Acad::eOk) {
if (pEnt->isPlanar()) {
AcGePlane plane;
AcDb::Planarity planetype;
if ((es = pEnt->getPlane(plane,planetype)) == Acad::eOk) {
AcGeMatrix3d ucs; ucs = AcGeMatrix3d::planeToWorld(plane);
AcGePoint3d org;
AcGeVector3d xdir,ydir,zdir;
ucs.getCoordSystem(org,xdir,ydir,zdir);
acutPrintf("\nUCSORG=%g,%g,%g\nUCSXDIR=%g,%g,%g\nUCSYDIR=%g,%g,%g\nUCSZDIR=%g,%g,%g",
org.x,org.y,org.z,xdir.x,xdir.y,xdir.z,ydir.x,ydir.y,ydir.z,zdir.x,zdir.y,zdir.z);
// Setting ECS coordinat system as UCS
acedSetCurrentUCS(ucs);
} else {
acutPrintf("\npEnt->getPlane(plane,planetype)=%s", acadErrorStatusText(es));
}
} else {
acutPrintf("\nEntity is not planar!");
}
} else {
acutPrintf("\npEnt.openStatus()=%s", acadErrorStatusText(es));
}
}
}
[/code]