ObjectARX
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to get an UCS of entity

3 REPLIES 3
Reply
Message 1 of 4
kimi
310 Views, 3 Replies

How to get an UCS of entity

Hi all,

How to get an UCS in which entity is drawn ?
OR
How to set UCS to the ucs in which selected entities are drawn ?

Thanks in advance.

Regards,
KIMI
3 REPLIES 3
Message 2 of 4
Anonymous
in reply to: kimi

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]
Message 3 of 4
Anonymous
in reply to: kimi

Kimi,

Look at me Kimi try getting the object normal!
pEnt->normal();

If you can't get the normal then it is a 3d object that does not
need the UCS.


Regards Gary
www.drcauto.com

wrote in message news:5100165@discussion.autodesk.com...
Hi all,

How to get an UCS in which entity is drawn ?
OR
How to set UCS to the ucs in which selected entities are drawn ?

Thanks in advance.

Regards,
KIMI
Message 4 of 4
kimi
in reply to: kimi

Thanks a lot Gary and Alexander !!!

Alexander,
I will try your suggestion and let you know the result soon..

Regards,
KIMI

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost