void adeskfirst() { // TODO: Implement the command ads_name ent; ads_point pnt; int ret = acedEntSel("\nSelect A Entity:",ent,pnt); if(RTNORM == ret) { AcDbObjectId id; Acad::ErrorStatus es = acdbGetObjectId(id,ent); assert(Acad::eOk == es); AcDbEntity *pEnt; es = acdbOpenAcDbEntity(pEnt,id,AcDb::kForRead); if(Acad::eOk == es) { AcDbPolyline *pPl = AcDbPolyline::cast(pEnt); assert(pPl); AcGePoint3d startpnt,endpnt; pPl->getStartPoint(startpnt); pPl->getEndPoint(endpnt); pPl->close(); AcGeVector3d vec = endpnt - startpnt; AcGeVector3d xAxis(1.0,0.0,0.0); double angle; angle = vec.angleTo(xAxis,AcGeVector3d(0,0,-1)); angle = angle*180/3.1415926; } }
}
这只是对plinetype=2,而且pline只有一节的情况下适用! |