AcDbObjectId CLjDwg::GetMirrorEntity(const AcDbObjectId Id, AcGePoint3d ptMirAxisStart, AcGePoint3d ptMirAxisEnd) { AcDbObjectId idMirror=AcDbObjectId::kNull; AcGeMatrix3d xform1; //xform1.setToMirroring(AcGeLine3d(ptMirAxisStart,ptMirAxisEnd)); AcGePlane Plan(ptMirAxisStart,AcGePoint3d(ptMirAxisEnd.x,ptMirAxisEnd.y,-100),ptMirAxisEnd); xform1.setToMirroring(Plan); AcDbEntity* pEnt=NULL; acdbOpenObject(pEnt,Id,AcDb::kForRead); if(pEnt) { AcDbEntity* pEnt0=(AcDbEntity*)pEnt->clone(); pEnt->close(); pEnt0->transformBy(xform1); idMirror=AddEntity(pEnt0); pEnt0->close(); } return idMirror; }
void CLjDwg::RotateEntity(const AcDbObjectId Id, const AcGePoint3d ptCenter, const double dAngle) { AcDbObjectId idMirror=AcDbObjectId::kNull; AcGeMatrix3d xform1; xform1.setToRotation(dAngle,AcGeVector3d(0,0,1),ptCenter); AcDbEntity* pEnt=NULL; acdbOpenObject(pEnt,Id,AcDb::kForWrite); if(pEnt) { pEnt->transformBy(xform1); pEnt->close(); } } |