www.mxdraw.com
|
McDbAlignedDimension类用于表示标注空间中任意两点距离的标注类型。标注的法向矢量必须与两点之间的线垂直。两个选择的点也作为两个标注界线的开始的定义点
class McDbAlignedDimension : public McDbDimension;
McDbDimension.h
例如: 控件中绘对齐标注的代码
void CDrawCommand::DrawAlignedDimension() { 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; McDbAlignedDimension* pDim = new McDbAlignedDimension( xLine1Point, xLine2Point, dimLinePoint, NULL, Mx::mcdbHostApplicationServices()->workingDatabase()->dimstyle() ); // qjx test //pDim->setOblique(MxBase::kPI / 3.0); CDrawAlignedDimensionJig 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); } } }