|
const TCHAR* prompt[2] = {_T("\n选择需要Z轴归0的实体<退出>:"), _T("")};
ads_name ssname;
if (RTNORM != acedSSGet(_T(":$"), prompt, NULL, NULL, ssname))
return;
AcDbObjectIdArray ids = CBaseDwg::GetObjectids(ssname);
if (ids.isEmpty())
return;
AcGePoint3d ptTop(0, 0, 1e99);
AcGePoint3d ptBelow(0, 0, -1e99);
AcGeVector3d vec1 = ptTop.asVector();
AcGeVector3d vec2 = ptBelow - ptTop;
AcGeVector3d vec3 = AcGePoint3d::kOrigin - ptBelow;
AcGeMatrix3d mat1, mat2, mat3;
mat1.setToTranslation(vec1);
mat2.setToTranslation(vec2);
mat3.setToTranslation(vec3);
for (int i = 0; i < ids.length(); i++)
{
AcDbEntityPointer pEnt(ids[i], AcDb::kForWrite);
if (Acad::eOk != pEnt.openStatus())
continue;
pEnt->transformBy(mat1);
pEnt->transformBy(mat2);
pEnt->transformBy(mat3);
}
acedSSFree(ssname);
|
|