/// <summary> /// 绘制主部件螺栓,采用单独的一道尺寸; /// </summary> public void DrawMainPartBoltDimX() { PointList pointList = new PointList(); CBeamTopViewSetting beamTopViewSetting = CBeamDimSetting.GetInstance().mTopViewSetting; //2.判断主梁的螺栓是否需要标注; bool bNeedMainBeamBoltDim = beamTopViewSetting.FindDimValueByName(CBeamTopViewSetting.mstrBolt); if (bNeedMainBeamBoltDim) { CMrDimSet mrDimSet = GetMainPartBoltUpDimX(); foreach (Point pt in mrDimSet.GetDimPointList()) { pointList.Add(pt); } if (pointList.Count == 0) { return; } Point minXPoint = mMainBeam.GetMinXPoint(); Point maxXPoint = mMainBeam.GetMaxXPoint(); pointList.Add(minXPoint); pointList.Add(maxXPoint); Vector upDimVector = new Vector(0, 1, 0); mUpDimDistance = GetUpDimDistance(pointList[0]); CDimTools.GetInstance().DrawDimensionSet(mViewBase, pointList, upDimVector, mUpDimDistance, CCommonPara.mSizeDimPath); } }
/// <summary> /// 标注工作点到工作点之间的尺寸; /// </summary> public void DrawWorkPointToWorkPointDimX() { CBeamTopViewSetting beamTopViewSetting = CBeamDimSetting.GetInstance().mTopViewSetting; PointList pointList = new PointList(); bool bMarkValue = beamTopViewSetting.FindMarkValueByName(CBeamTopViewSetting.mstrWorkPointToWorkPoint); mMainBeam.SetNeedAddMarkFlag(bMarkValue); //1.判断工作点与工作点之间是否需要标注,需要标注的话是一道单尺寸; bool bNeedDimWpToWp = beamTopViewSetting.FindDimValueByName(CBeamTopViewSetting.mstrWorkPointToWorkPoint); if (bNeedDimWpToWp) { Point leftWorkPoint = CMrMainBeam.GetInstance().mLeftWorkPoint; Point rightWorkPoint = CMrMainBeam.GetInstance().mRightWorkPoint; pointList.Add(leftWorkPoint); pointList.Add(rightWorkPoint); Vector upDimVector = new Vector(0, 1, 0); mUpDimDistance = GetUpDimDistance(leftWorkPoint); CDimTools.GetInstance().DrawDimensionSet(mViewBase, pointList, upDimVector, mUpDimDistance, CCommonPara.mMainSizeDimPath); } }
/// <summary> /// 绘制主梁上螺钉的标记; /// </summary> public void DrawMainPartBoltMark() { CBeamTopViewSetting beamTopViewSetting = CBeamDimSetting.GetInstance().mTopViewSetting; bool bNeedMark = beamTopViewSetting.FindMarkValueByName(CBeamTopViewSetting.mstrBolt); if (!bNeedMark) { return; } List <CMrBoltArray> mrBoltArrayList = mMainBeam.GetBoltArrayList(); Vector zVector = new Vector(0, 0, 1); DrawingHandler drawingHandler = new DrawingHandler(); TSD.UI.DrawingObjectSelector DS = drawingHandler.GetDrawingObjectSelector(); foreach (CMrBoltArray mrBoltArray in mrBoltArrayList) { //只有与Z轴平行的螺钉组才进行编号; if (!CDimTools.GetInstance().IsTwoVectorParallel(zVector, mrBoltArray.mNormal)) { continue; } DS.SelectObject(mrBoltArray.mBoltInDrawing); } CDimTools.GetInstance().DrawMarkByMacro(); }
/// <summary> /// 标注切割的尺寸; /// </summary> public void DrawCuttingDim() { CBeamTopViewSetting beamTopViewSetting = CBeamDimSetting.GetInstance().mTopViewSetting; PointList pointList = new PointList(); //判断是否需要标注切割部分,切割需要采用单一尺寸来标注; bool bNeedDimCutting = beamTopViewSetting.FindDimValueByName(CBeamTopViewSetting.mstrCutting); if (bNeedDimCutting) { Point minYMinXPoint = mMainBeam.GetMinYMinXPoint(); Point maxYMinXPoint = mMainBeam.GetMaxYMinXPoint(); Vector upDimVector = new Vector(0, 1, 0); Vector downDimVector = new Vector(0, -1, 0); //A.判断主梁左侧的切割; if (maxYMinXPoint.X > minYMinXPoint.X) { pointList.Clear(); pointList.Add(maxYMinXPoint); pointList.Add(minYMinXPoint); double dimDistance = CCommonPara.mDefaultDimDistance; CDimTools.GetInstance().DrawDimensionSet(mViewBase, pointList, upDimVector, dimDistance, CCommonPara.mMainSizeDimPath); } if (maxYMinXPoint.X < minYMinXPoint.X) { pointList.Clear(); pointList.Add(maxYMinXPoint); pointList.Add(minYMinXPoint); double dimDistance = CCommonPara.mDefaultDimDistance; CDimTools.GetInstance().DrawDimensionSet(mViewBase, pointList, downDimVector, dimDistance, CCommonPara.mMainSizeDimPath); } //B.判断主梁右侧的切割; Point minYMaxXPoint = mMainBeam.GetMinYMaxXPoint(); Point maxYMaxXPoint = mMainBeam.GetMaxYMaxXPoint(); if (minYMaxXPoint.X > maxYMaxXPoint.X) { pointList.Clear(); pointList.Add(maxYMaxXPoint); pointList.Add(minYMaxXPoint); double dimDistance = CCommonPara.mDefaultDimDistance; CDimTools.GetInstance().DrawDimensionSet(mViewBase, pointList, upDimVector, dimDistance, CCommonPara.mMainSizeDimPath); } else if (minYMaxXPoint.X < maxYMaxXPoint.X) { pointList.Clear(); pointList.Add(minYMaxXPoint); pointList.Add(maxYMaxXPoint); double dimDistance = CCommonPara.mDefaultDimDistance; CDimTools.GetInstance().DrawDimensionSet(mViewBase, pointList, downDimVector, dimDistance, CCommonPara.mMainSizeDimPath); } } }
/// <summary> /// 绘制所有零件的上方标注; /// </summary> public void DrawAllPartUpDimX() { //移除主梁; mMrPartList.Remove(mMainBeam); List <Point> upDimPointList = new List <Point>(); bool bNeedUpDim = false; //1.遍历获得所有零件的向上标注的点; foreach (CMrPart mrPart in mMrPartList) { CMrDimSet partDimSet = mrPart.GetBeamTopViewInfo().GetPartUpDimSet(); if (partDimSet != null && partDimSet.Count > 0) { bNeedUpDim = true; upDimPointList.AddRange(partDimSet.GetDimPointList()); } } CBeamTopViewSetting beamTopViewSetting = CBeamDimSetting.GetInstance().mTopViewSetting; //2.判断主梁的螺栓是否需要标注; bool bNeedMainBeamBoltDim = beamTopViewSetting.FindDimValueByName(CBeamTopViewSetting.mstrBolt); if (bNeedMainBeamBoltDim) { CMrDimSet mrDimSet = GetMainPartBoltUpDimX(); upDimPointList.AddRange(mrDimSet.GetDimPointList()); } if (bNeedUpDim == false && bNeedMainBeamBoltDim == false) { return; } //3.默认把主梁的左右最小最大值点加入到链表中; Point minXPoint = mMainBeam.GetMinXPoint(); Point maxXPoint = mMainBeam.GetMaxXPoint(); upDimPointList.Add(minXPoint); upDimPointList.Add(maxXPoint); PointList pointList = new PointList(); foreach (Point point in upDimPointList) { pointList.Add(point); } Vector upDimVector = new Vector(0, 1, 0); mUpDimDistance = GetUpDimDistance(upDimPointList[0]); CDimTools.GetInstance().DrawDimensionSet(mViewBase, pointList, upDimVector, mUpDimDistance, CCommonPara.mSizeDimPath); mMrPartList.Add(mMainBeam); }
/// <summary> /// 标注工作点到主零件的距离之间尺寸; /// </summary> public void DrawWorkPointToMainPartDimX() { CBeamTopViewSetting beamTopViewSetting = CBeamDimSetting.GetInstance().mTopViewSetting; bool bMarkValue = beamTopViewSetting.FindMarkValueByName(CBeamTopViewSetting.mstrWorkPointToMainPart); mMainBeam.SetNeedAddMarkFlag(bMarkValue); //1.判断是否需要标注主梁与工作点之间的距离,采用一道尺寸来进行标注; bool bNeedDimWpToMainPart = beamTopViewSetting.FindDimValueByName(CBeamTopViewSetting.mstrWorkPointToMainPart); if (!bNeedDimWpToMainPart) { return; } Point mainBeamMinX = CMrMainBeam.GetInstance().GetMinXPoint(); Point mainBeamMaxX = CMrMainBeam.GetInstance().GetMaxXPoint(); Point leftWorkPoint = CMrMainBeam.GetInstance().mLeftWorkPoint; Point rightWorkPoint = CMrMainBeam.GetInstance().mRightWorkPoint; bMarkValue = beamTopViewSetting.FindMarkValueByName(CBeamTopViewSetting.mstrWorkPointToWorkPoint); mMainBeam.SetNeedAddMarkFlag(bMarkValue); //2.如果工作点到工作点需要进行标注,而主部件左右侧与工作点的左右侧的距离都为0则不需要标注; bool bNeedWorkPtToWorkPt = beamTopViewSetting.FindDimValueByName(CBeamTopViewSetting.mstrWorkPointToWorkPoint); if (bNeedWorkPtToWorkPt) { double xDistanceLeft = Math.Abs(mainBeamMinX.X - leftWorkPoint.X); double xDistanceRight = Math.Abs(mainBeamMaxX.X - rightWorkPoint.X); if (xDistanceLeft < CCommonPara.mDblError && xDistanceRight < CCommonPara.mDblError) { return; } } PointList pointList = new PointList(); pointList.Add(leftWorkPoint); pointList.Add(rightWorkPoint); pointList.Add(mainBeamMinX); pointList.Add(mainBeamMaxX); Vector upDimVector = new Vector(0, 1, 0); mUpDimDistance = GetUpDimDistance(leftWorkPoint); CDimTools.GetInstance().DrawDimensionSet(mViewBase, pointList, upDimVector, mUpDimDistance, CCommonPara.mMainSizeDimPath); }
/// <summary> /// 标注主零件的长度尺寸; /// </summary> public void DrawMainPartLengthDimX() { CBeamTopViewSetting beamTopViewSetting = CBeamDimSetting.GetInstance().mTopViewSetting; //1.判断是否需要标注主梁的长度,如果需要采用单一的一道总尺寸; bool bNeedDimMainPartLength = beamTopViewSetting.FindDimValueByName(CBeamTopViewSetting.mstrMainPartLength); bool bMarkValue = beamTopViewSetting.FindMarkValueByName(CBeamTopViewSetting.mstrMainPartLength); mMainBeam.SetNeedAddMarkFlag(bMarkValue); if (!bNeedDimMainPartLength) { return; } Point minXPoint = mMainBeam.GetMinXPoint(); Point maxXPoint = mMainBeam.GetMaxXPoint(); bMarkValue = beamTopViewSetting.FindMarkValueByName(CBeamTopViewSetting.mstrWorkPointToWorkPoint); mMainBeam.SetNeedAddMarkFlag(bMarkValue); //2.如果需要标注工作点到工作点,并且主部件与工作点的距离左边或者右边为0,或者都为0时则不标注主部件长度; bool bNeedWorkPtToWorkPt = beamTopViewSetting.FindDimValueByName(CBeamTopViewSetting.mstrWorkPointToWorkPoint); if (bNeedWorkPtToWorkPt) { double xDistanceLeft = Math.Abs(minXPoint.X - CMrMainBeam.GetInstance().mLeftWorkPoint.X); double xDistanceRight = Math.Abs(maxXPoint.X - CMrMainBeam.GetInstance().mRightWorkPoint.X); if (xDistanceLeft < CCommonPara.mDblError || xDistanceRight < CCommonPara.mDblError) { return; } } PointList pointList = new PointList(); pointList.Add(minXPoint); pointList.Add(maxXPoint); Vector upDimVector = new Vector(0, 1, 0); mUpDimDistance = GetUpDimDistance(minXPoint); CDimTools.GetInstance().DrawDimensionSet(mViewBase, pointList, upDimVector, mUpDimDistance, CCommonPara.mMainSizeDimPath); }
/// <summary> /// 绘制主梁的Bolt在Y向上的标注; /// </summary> private void DrawMainPartBoltDimY() { CBeamTopViewSetting beamTopViewSetting = CBeamDimSetting.GetInstance().mTopViewSetting; bool bNeedMainBeamBoltDim = beamTopViewSetting.FindDimValueByName(CBeamTopViewSetting.mstrBolt); if (!bNeedMainBeamBoltDim) { return; } List <CMrDimSet> boltDimSetList = GetMainPartBoltDimSetY(); if (boltDimSetList == null || boltDimSetList.Count == 0) { return; } foreach (CMrDimSet mrDimSet in boltDimSetList) { if (mrDimSet == null || mrDimSet.Count <= 1) { continue; } if (!IsNeedMrDimSetDim(mrDimSet)) { 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); } }
/// <summary> /// 私有构造函数; /// </summary> private CBeamDimSetting() { mTopViewSetting = new CBeamTopViewSetting(); mFrontViewSetting = new CBeamFrontViewSetting(); mSectionViewSetting = new CBeamSectionViewSetting(); }