/// <summary> /// 绘制主部件在Y向的螺钉标注; /// </summary> private void DrawMainPartBoltDimY() { PointList pointList = new PointList(); CCylinderTopViewSetting cylinderTopViewSetting = CCylinderDimSetting.GetInstance().mTopViewSetting; //1.判断主梁的螺栓是否需要标注; bool bNeedMainBeamBoltDim = cylinderTopViewSetting.FindDimValueByName(CCylinderTopViewSetting.mstrBolt); if (bNeedMainBeamBoltDim) { CMrDimSet mrDimSet = GetMainPartBoltRightDimY(); foreach (Point pt in mrDimSet.GetDimPointList()) { pointList.Add(pt); } if (pointList.Count == 0) { return; } Point minYPoint = mMainBeam.GetMinYMaxXPoint(); Point maxYPoint = mMainBeam.GetMaxYMaxXPoint(); pointList.Add(minYPoint); pointList.Add(maxYPoint); Vector rightDimVector = new Vector(1, 0, 0); mRightDimDistance = GetRightDimDistance(pointList[0]); CDimTools.GetInstance().DrawDimensionSet(mViewBase, pointList, rightDimVector, mRightDimDistance, CCommonPara.mSizeDimPath); } }
/// <summary> /// 绘制主梁左侧工作点与工作点之间的标注; /// </summary> private void DrawWorkPointToWorkPointDimY() { CCylinderTopViewSetting cylinderTopViewSetting = CCylinderDimSetting.GetInstance().mTopViewSetting; PointList pointList = new PointList(); bool bMarkValue = cylinderTopViewSetting.FindMarkValueByName(CCylinderTopViewSetting.mstrWorkPointToWorkPoint); mMainBeam.SetNeedAddMarkFlag(bMarkValue); //1.判断工作点与工作点之间是否需要标注,需要标注的话是一道单尺寸; bool bNeedDimWpToWp = cylinderTopViewSetting.FindDimValueByName(CCylinderTopViewSetting.mstrWorkPointToWorkPoint); if (bNeedDimWpToWp) { Point leftWorkPoint = CMrMainBeam.GetInstance().mLeftWorkPoint; Point rightWorkPoint = CMrMainBeam.GetInstance().mRightWorkPoint; pointList.Add(leftWorkPoint); pointList.Add(rightWorkPoint); Vector leftDimVector = new Vector(-1, 0, 0); mLeftDimDistance = GetLeftDimDistance(leftWorkPoint); CDimTools.GetInstance().DrawDimensionSet(mViewBase, pointList, leftDimVector, mLeftDimDistance, CCommonPara.mMainSizeDimPath); } }
/// <summary> /// 获得支撑板中间的连接板的标注; /// </summary> /// <returns></returns> public CMrDimSet GetSupportPlateMiddleConnectPlateDimSet(CMrPart mrSupportPlate) { if (!CDimTools.GetInstance().IsTwoVectorParallel(mrSupportPlate.mNormal, new Vector(0, 0, 1)) || CDimTools.GetInstance().IsPartTheAngleSteel(mrSupportPlate) || IsOutsidePlate(mrSupportPlate)) { return(null); } CCylinderTopViewSetting cylinderTopViewSetting = CCylinderDimSetting.GetInstance().mTopViewSetting; List <CMrPart> mrConnectPlates = GetSupportPlateMiddleConnectPlates(mrSupportPlate); if (mrConnectPlates == null || mrConnectPlates.Count == 0) { return(null); } CMrDimSet mrDimSet = new CMrDimSet(); foreach (CMrPart mrPart in mrConnectPlates) { mrDimSet.AddPoint(mrPart.GetMinYMinXPoint()); bool bValue = cylinderTopViewSetting.FindMarkValueByName(CCylinderTopViewSetting.mstrConnentPlateOnSupport); mrPart.SetNeedAddMarkFlag(bValue); } if (mrDimSet.Count > 0) { mrDimSet.AddPoint(new Point(0, mrDimSet.GetDimPointList()[0].Y, 0)); } return(mrDimSet); }
/// <summary> /// 绘制支撑板上及牛腿上的螺钉以及上面的连接板在X方向的标注; /// </summary> private void DrawSupportPlateBoltAndConnectPlateDimX() { CCylinderTopViewSetting cylinderTopViewSetting = CCylinderDimSetting.GetInstance().mTopViewSetting; mMrPartList.Remove(mMainBeam); foreach (CMrPart mrPart in mMrPartList) { CMrDimSet mrBoltDimSet = mrPart.GetCylinderTopViewInfo().GetSupportPlateBoltXDimSet(); CMrDimSet mrConnectPlateDimSet = GetSupportPlateMiddleConnectPlateDimSet(mrPart); PointList pointList = new PointList(); //1.支撑板或连接板是否需要标注; if (cylinderTopViewSetting.FindDimValueByName(CCylinderTopViewSetting.mstrSupportPlate)) { if (mrBoltDimSet != null) { foreach (Point point in mrBoltDimSet.GetDimPointList()) { pointList.Add(point); } } } //2.支撑板与连接板中间的加筋板是否需要标注; if (cylinderTopViewSetting.FindDimValueByName(CCylinderTopViewSetting.mstrConnentPlateOnSupport)) { if (mrConnectPlateDimSet != null) { foreach (Point point in mrConnectPlateDimSet.GetDimPointList()) { pointList.Add(point); } } } if (pointList.Count > 0) { if (mrBoltDimSet != null && mrBoltDimSet.Count > 0) { double dimDistance = mrBoltDimSet.mDimDistance; Vector dimVector = mrBoltDimSet.mDimVector; CDimTools.GetInstance().DrawDimensionSet(mViewBase, pointList, dimVector, dimDistance, CCommonPara.mSizeDimPath); } else { double dimDistance = Math.Abs(mrPart.GetMinYPoint().Y - pointList[0].Y) + CCommonPara.mDefaultDimDistance; Vector dimVector = new Vector(0, -1, 0); CDimTools.GetInstance().DrawDimensionSet(mViewBase, pointList, dimVector, dimDistance, CCommonPara.mSizeDimPath); } } } mMrPartList.Add(mMainBeam); }
/// <summary> /// 绘制工作点到主梁的距离; /// </summary> private void DrawWorkPointToMainPartDimY() { CCylinderTopViewSetting cylinderTopViewSetting = CCylinderDimSetting.GetInstance().mTopViewSetting; bool bMarkValue = cylinderTopViewSetting.FindMarkValueByName(CCylinderTopViewSetting.mstrWorkPointToMainPart); mMainBeam.SetNeedAddMarkFlag(bMarkValue); //1.判断是否需要标注主梁与工作点之间的距离,采用一道尺寸来进行标注; bool bNeedDimWpToMainPart = cylinderTopViewSetting.FindDimValueByName(CCylinderTopViewSetting.mstrWorkPointToMainPart); if (!bNeedDimWpToMainPart) { return; } Point mainBeamMinY = CMrMainBeam.GetInstance().GetMinYMinXPoint(); Point mainBeamMaxY = CMrMainBeam.GetInstance().GetMaxYMinXPoint(); Point leftWorkPoint = CMrMainBeam.GetInstance().mLeftWorkPoint; Point rightWorkPoint = CMrMainBeam.GetInstance().mRightWorkPoint; bMarkValue = cylinderTopViewSetting.FindMarkValueByName(CCylinderTopViewSetting.mstrWorkPointToWorkPoint); mMainBeam.SetNeedAddMarkFlag(bMarkValue); //2.如果工作点到工作点需要进行标注,而主部件左右侧与工作点的左右侧的距离都为0则不需要标注; bool bNeedWorkPtToWorkPt = cylinderTopViewSetting.FindDimValueByName(CCylinderTopViewSetting.mstrWorkPointToWorkPoint); if (bNeedWorkPtToWorkPt) { double xDistanceLeft = Math.Abs(mainBeamMaxY.Y - leftWorkPoint.Y); double xDistanceRight = Math.Abs(mainBeamMaxY.Y - rightWorkPoint.Y); if (xDistanceLeft < CCommonPara.mDblError && xDistanceRight < CCommonPara.mDblError) { return; } } PointList pointList = new PointList(); pointList.Add(leftWorkPoint); pointList.Add(rightWorkPoint); pointList.Add(mainBeamMinY); pointList.Add(mainBeamMaxY); Vector leftDimVector = new Vector(-1, 0, 0); mLeftDimDistance = GetLeftDimDistance(leftWorkPoint); CDimTools.GetInstance().DrawDimensionSet(mViewBase, pointList, leftDimVector, mLeftDimDistance, CCommonPara.mMainSizeDimPath); }
/// <summary> /// 绘制主梁左侧长度的标注; /// </summary> private void DrawMainPartLengthDimY() { CCylinderTopViewSetting cylinderTopViewSetting = CCylinderDimSetting.GetInstance().mTopViewSetting; //1.判断是否需要标注主梁的长度,如果需要采用单一的一道总尺寸; bool bNeedDimMainPartLength = cylinderTopViewSetting.FindDimValueByName(CCylinderTopViewSetting.mstrMainPartLength); bool bMarkValue = cylinderTopViewSetting.FindMarkValueByName(CCylinderTopViewSetting.mstrMainPartLength); mMainBeam.SetNeedAddMarkFlag(bMarkValue); if (!bNeedDimMainPartLength) { return; } Point minYPoint = mMainBeam.GetMinYMinXPoint(); Point maxYPoint = mMainBeam.GetMaxYMinXPoint(); bMarkValue = cylinderTopViewSetting.FindMarkValueByName(CCylinderTopViewSetting.mstrWorkPointToWorkPoint); mMainBeam.SetNeedAddMarkFlag(bMarkValue); //2.如果需要标注工作点到工作点,并且主部件与工作点的距离左边或者右边为0,或者都为0时则不标注主部件长度; bool bNeedWorkPtToWorkPt = cylinderTopViewSetting.FindDimValueByName(CCylinderTopViewSetting.mstrWorkPointToWorkPoint); if (bNeedWorkPtToWorkPt) { double xDistanceLeft = Math.Abs(maxYPoint.Y - CMrMainBeam.GetInstance().mLeftWorkPoint.Y); double xDistanceRight = Math.Abs(minYPoint.Y - CMrMainBeam.GetInstance().mRightWorkPoint.Y); if (xDistanceLeft < CCommonPara.mDblError || xDistanceRight < CCommonPara.mDblError) { return; } } PointList pointList = new PointList(); pointList.Add(minYPoint); pointList.Add(maxYPoint); Vector leftDimVector = new Vector(-1, 0, 0); mLeftDimDistance = GetLeftDimDistance(minYPoint); CDimTools.GetInstance().DrawDimensionSet(mViewBase, pointList, leftDimVector, mLeftDimDistance, CCommonPara.mMainSizeDimPath); }
/// <summary> /// 绘制支撑板及牛腿上的螺钉在Y方向的标注; /// </summary> private void DrawSupportPlateBoltDimY() { CCylinderTopViewSetting cylinderTopViewSetting = CCylinderDimSetting.GetInstance().mTopViewSetting; if (!cylinderTopViewSetting.FindDimValueByName(CCylinderTopViewSetting.mstrSupportPlate)) { return; } //移除主梁; mMrPartList.Remove(mMainBeam); foreach (CMrPart mrPart in mMrPartList) { CMrDimSet mrDimSet = mrPart.GetCylinderTopViewInfo().GetSupportPlateBoltYDimSet(); if (mrDimSet == null || mrDimSet.Count <= 1) { continue; } List <Point> dimPointList = mrDimSet.GetDimPointList(); PointList pointList = new PointList(); foreach (Point point in dimPointList) { pointList.Add(point); } double dimDistance = mrDimSet.mDimDistance; Vector dimVector = mrDimSet.mDimVector; CDimTools.GetInstance().DrawDimensionSet(mViewBase, pointList, dimVector, dimDistance, CCommonPara.mSizeDimPath); } mMrPartList.Add(mMainBeam); }
/// <summary> /// 绘制右侧所有零部件在Y向的标注,主要是区分支撑板和剩下的零部件标注; /// </summary> private void DrawAllPartRightFenSizeDimY() { //移除主梁; mMrPartList.Remove(mMainBeam); CCylinderTopViewSetting cylinderTopViewSetting = CCylinderDimSetting.GetInstance().mTopViewSetting; bool bNeedHorizontalConnectPlateDim = false; bool bNeedOtherPartDim = false; List <Point> horizontalConnectPlateDimPointList = new List <Point>(); List <Point> otherPartDimPointList = new List <Point>(); //1.遍历获得所有零件的向上标注的点; foreach (CMrPart mrPart in mMrPartList) { Vector normal = mrPart.mNormal; CMrDimSet partDimSet = mrPart.GetCylinderTopViewInfo().GetPartRightDimSet(); if (partDimSet != null && partDimSet.Count > 0) { //如果是水平连接板及支撑板、H型钢等; if (CDimTools.GetInstance().IsPartTheSupportPlate(mrPart)) { bNeedHorizontalConnectPlateDim = true; horizontalConnectPlateDimPointList.AddRange(partDimSet.GetDimPointList()); } else { bNeedOtherPartDim = true; otherPartDimPointList.AddRange(partDimSet.GetDimPointList()); } } } Point minYPoint = mMainBeam.GetMinYMaxXPoint(); Point maxYPoint = mMainBeam.GetMaxYMaxXPoint(); //1.如果其他剩下的零件需要标注; if (bNeedOtherPartDim) { PointList pointList = new PointList(); foreach (Point pt in otherPartDimPointList) { pointList.Add(pt); } //如果需要标注轴线; if (cylinderTopViewSetting.FindDimValueByName(CCylinderTopViewSetting.mstrAixLine)) { foreach (Point pt in mIntersectionPointList) { pointList.Add(pt); } } pointList.Add(minYPoint); pointList.Add(maxYPoint); Vector rightDimVector = new Vector(1, 0, 0); mRightDimDistance = GetRightDimDistance(pointList[0]); CDimTools.GetInstance().DrawDimensionSet(mViewBase, pointList, rightDimVector, mRightDimDistance, CCommonPara.mSizeDimPath); } //2.如果水平连接板及支撑需要标注; if (bNeedHorizontalConnectPlateDim) { PointList pointList = new PointList(); foreach (Point pt in horizontalConnectPlateDimPointList) { pointList.Add(pt); } //如果需要标注轴线; if (cylinderTopViewSetting.FindDimValueByName(CCylinderTopViewSetting.mstrAixLine)) { foreach (Point pt in mIntersectionPointList) { pointList.Add(pt); } } pointList.Add(minYPoint); pointList.Add(maxYPoint); Vector rightDimVector = new Vector(1, 0, 0); mRightDimDistance = GetRightDimDistance(pointList[0]); CDimTools.GetInstance().DrawDimensionSet(mViewBase, pointList, rightDimVector, mRightDimDistance, CCommonPara.mSizeDimPath); } mMrPartList.Add(mMainBeam); }