www.mxdraw.com
|
二维的角度标注实体
class McDb2LineAngularDimension : public McDbDimension;
McDbDimension.h
例如: 控件中绘制角度标注的代码
void CDrawCommand::Draw2LineAngularDimension() { MrxDbgRbList spFilter = Mx::mcutBuildList(RTDXF0,_T("LINE"),0); McDbObjectId objId1; McGePoint3d ptPick1; if(MrxDbgUtils::selectEnt(_T("选择直线段1:"),spFilter.data(),objId1,ptPick1) != RTNORM) { return; } McDbObjectId objId2; McGePoint3d ptPick2; if(MrxDbgUtils::selectEnt(_T("选择直线段2:"),spFilter.data(),objId2,ptPick2) != RTNORM) { return; } if(objId1 == objId2) { Mx::mcutPrintf(_T("不能选择同一个直线")); return; } McDbObjectPointer<McDbCurve> spCurve1(objId1,McDb::kForRead); if(spCurve1.openStatus() != Mcad::eOk ) { MXASSERT(0); return; } McDbObjectPointer<McDbCurve> spCurve2(objId2,McDb::kForRead); if(spCurve2.openStatus() != Mcad::eOk ) { MXASSERT(0); return; } McGePoint3d pt11,pt12,pt21,pt22; spCurve1->getStartPoint(pt11); spCurve1->getEndPoint(pt12); spCurve2->getStartPoint(pt21); spCurve2->getEndPoint(pt22); McGeVector3d vec1 = pt12 - pt11; McGeVector3d vec2 = pt22 - pt21; if(vec1.isParallelTo(vec2) == Mdesk::kTrue) { Mx::mcutPrintf(_T("两个直线不能平行")); return; } McDb2LineAngularDimension* pDim = new McDb2LineAngularDimension(pt11, pt12, pt21, pt22, ptPick2, NULL, Mx::mcdbHostApplicationServices()->workingDatabase()->dimstyle() ); CDraw2LineAngularDimensionJig jig(pDim); if(jig.DoIt() ) { MrxDbgUtils::addToCurrentSpaceAndClose(pDim); } else { delete pDim; } }