www.mxdraw.com
|
McDbRotatedDimension类表示在空间中两点在它们以一个特定角度(旋转角)投影至标注平面中的一条直线上时,标注这两点的距离的标注类型 一个是“水平”的标注,一个是“垂直”的标注
class McDbRotatedDimension : public McDbDimension;
McDbDimension.h
例如: 控件中绘线型标注代码
void CDrawCommand::DrawRotatedDimension() { mds_point pt1; if(Mx::mcedGetPoint(NULL,_T("n 指定第一条尺寸界线原点:"),pt1) != RTNORM) { return; } mds_point pt2; if(Mx::mcedGetPoint(pt1,_T("n 指定第二条尺寸界线原点:"),pt2) != RTNORM) { return; } Mx::mcutPrintf(_T("指定尺寸线位置:")); McGePoint3d xLine1Point = asPnt3d(pt1); McGePoint3d xLine2Point = asPnt3d(pt2); McGePoint3d dimLinePoint = xLine2Point; McDbRotatedDimension* pDim = new McDbRotatedDimension(0.0, xLine1Point, xLine2Point, dimLinePoint, NULL, Mx::mcdbHostApplicationServices()->workingDatabase()->dimstyle() ); CDrawRotatedDimensionJig jig(pDim); if(jig.DoIt() ) { MrxDbgUtils::addToCurrentSpaceAndClose(pDim); } else { delete pDim; } }
例如: 倾斜的尺寸标注的代码
void CDrawCommand::ObliqueDimension() { MrxDbgRbList spFilter = Mx::mcutBuildList(RTDXF0,_T("ROTATEDDIMENSION,ALIGNEDDIMENSION"),0); McDbObjectId objId1; McGePoint3d ptPick1; if(MrxDbgUtils::selectEnt(_T("选择需要倾斜的尺寸标注:"),spFilter.data(),objId1,ptPick1) != RTNORM) { return; } McDbObjectPointer<McDbDimension> spDim(objId1,McDb::kForRead); if(spDim.openStatus() != Mcad::eOk) return; double dAng = 0.0; if(McDbAlignedDimension::cast(spDim.object() ) != NULL) { McDbAlignedDimension* pAlignedDim = McDbAlignedDimension::cast(spDim.object() ); dAng = pAlignedDim->oblique(); } else if(McDbRotatedDimension::cast(spDim.object() ) != NULL) { McDbRotatedDimension* pRotatedDim = McDbRotatedDimension::cast(spDim.object() ); dAng = pRotatedDim->oblique(); } else { MXASSERT(0); return; } double dRetAng = dAng; if(!GetNewAngObliqueDimension(dAng,dRetAng) ) return; if(!MxT::IsEqual(dRetAng,dAng,0.001)) { if(!MxT::IsZero(dRetAng)) { if(dRetAng < MxBase::kPI / 4.0 || dRetAng > MxBase::kPI * 3 / 4.0 ) { AfxMessageBox(_T("角度不合理..")); return; } } spDim->upgradeOpen(); if(McDbAlignedDimension::cast(spDim.object() ) != NULL) { McDbAlignedDimension* pAlignedDim = McDbAlignedDimension::cast(spDim.object() ); pAlignedDim->setOblique(dRetAng); } else if(McDbRotatedDimension::cast(spDim.object() ) != NULL) { McDbRotatedDimension* pRotatedDim = McDbRotatedDimension::cast(spDim.object() ); pRotatedDim->setOblique(dRetAng); } } }