/// <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> /// <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> /// 判断该MrDimSet是否需要标注; /// </summary> /// <param name="mrDimSet"></param> /// <returns></returns> private bool IsNeedMrDimSetDim(CMrDimSet mrDimSet) { String strPointList = null; List <Point> dimPointList = mrDimSet.GetDimPointList(); Comparison <Point> sorterX = new Comparison <Point>(CDimTools.ComparePointX); dimPointList.Sort(sorterX); foreach (Point point in dimPointList) { strPointList = strPointList + "_" + ((int)point.X).ToString(); } if (mDicYBoltDimPoints.ContainsKey(strPointList)) { return(false); } else { mDicYBoltDimPoints.Add(strPointList, true); return(true); } }
/// <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> /// <param name="nFlag">1:左侧;2:右侧</param> /// <returns></returns> private List <CMrDimSet> GetMrApronPlateDimSet(int nFlag) { List <CMrDimSet> mrDimSetList = new List <CMrDimSet>(); Dictionary <CMrPart, CMrApronPlate> mMapPartToApronPlate = CMrCylinderDoorTopManager.GetInstance().mMapYNormalPartToMrApronPlate; //如果是右侧; if (nFlag == 2) { foreach (CMrApronPlate mrApronPlate in mMapPartToApronPlate.Values) { CMrPart yNormalPart = mrApronPlate.mYNormalPart; double minX = yNormalPart.GetMinXPoint().X; if (minX < 0) { continue; } CMrDimSet mrDimSet = new CMrDimSet(); bool bIsUp = mrApronPlate.mIsUp; if (bIsUp) { mrDimSet.AddPoint(yNormalPart.GetMaxXMinYPoint()); } else { mrDimSet.AddPoint(yNormalPart.GetMaxXMaxYPoint()); } mrDimSetList.Add(mrDimSet); } } //如果是左侧; else if (nFlag == 1) { foreach (CMrApronPlate mrApronPlate in mMapPartToApronPlate.Values) { CMrPart yNormalPart = mrApronPlate.mYNormalPart; double maxX = yNormalPart.GetMaxXPoint().X; if (maxX > 0) { continue; } CMrDimSet mrDimSet = new CMrDimSet(); bool bIsUp = mrApronPlate.mIsUp; if (bIsUp) { mrDimSet.AddPoint(yNormalPart.GetMinXMinYPoint()); } else { mrDimSet.AddPoint(yNormalPart.GetMinXMaxYPoint()); } mrDimSetList.Add(mrDimSet); } } return(mrDimSetList); }
/// <summary> /// 对于正常的左右倾斜梁的上标注; /// </summary> public void DrawXUpDimNormal() { bool bNeedUpDim = false; List <Point> upDimPointList = new List <Point>(); foreach (CMrPart mrPart in mMrPartList) { CMrDimSet partDimSet = mrPart.GetBeamDoorFrontViewInfo().GetXUpDimSetNormal(); if (partDimSet != null && partDimSet.Count > 0) { bNeedUpDim = true; upDimPointList.AddRange(partDimSet.GetDimPointList()); } } if (bNeedUpDim == false) { return; } CMrPart topBeam = CMrBeamDoorManager.GetInstance().mTopBeam; upDimPointList.Add(topBeam.mLeftTopPoint); upDimPointList.Add(topBeam.mRightTopPoint); Comparison <Point> sorterX = new Comparison <Point>(CDimTools.ComparePointX); upDimPointList.Sort(sorterX); PointList pointList = new PointList(); foreach (Point point in upDimPointList) { pointList.Add(point); } Point MinXPoint = upDimPointList[0]; double dimDistance = Math.Abs(CCommonPara.mViewMaxY - MinXPoint.Y) + 2 * CCommonPara.mDefaultDimDistance; Vector upDimVector = CMrBeamDoorManager.GetInstance().GetTopBeamUpDimVector(); CDimTools.GetInstance().DrawDimensionSet(mViewBase, pointList, upDimVector, dimDistance, CCommonPara.mSizeDimPath); //再标注一个总长度; pointList.Clear(); Point firstPoint = topBeam.mLeftTopPoint; Point secondPoint = topBeam.mRightTopPoint; pointList.Add(firstPoint); pointList.Add(secondPoint); dimDistance = Math.Abs(CCommonPara.mViewMaxY - firstPoint.Y) + 4 * CCommonPara.mDefaultDimDistance; CDimTools.GetInstance().DrawDimensionSet(mViewBase, pointList, upDimVector, dimDistance, CCommonPara.mSizeDimPath); }
/// <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 DrawYMainLeftDim() { List <Point> leftDimPointList = new List <Point>(); foreach (CMrPart mrPart in mMrPartList) { CMrDimSet partDimSet = mrPart.GetCylinderDoorTopViewInfo().GetYLeftPartDim(); CMrDimSet boltDimSet = mrPart.GetCylinderDoorTopViewInfo().GetYLeftBoltDim(); if (partDimSet != null && partDimSet.Count > 0) { leftDimPointList.AddRange(partDimSet.GetDimPointList()); } if (boltDimSet != null && boltDimSet.Count > 0) { leftDimPointList.AddRange(boltDimSet.GetDimPointList()); } } //把最大Y值和最小Y值的点加进来; if (mMaxYPart != null) { leftDimPointList.Add(mMaxYPart.GetMaxYMinXPoint()); } if (mMinYPart != null) { leftDimPointList.Add(mMinYPart.GetMinYMinXPoint()); } //把檩托板的点加进来; List <CMrDimSet> mrDimSetList = GetMrApronPlateDimSet(1); foreach (CMrDimSet mrDimSet in mrDimSetList) { if (mrDimSet != null) { leftDimPointList.AddRange(mrDimSet.GetDimPointList()); } } Comparison <Point> sorterY = new Comparison <Point>(CDimTools.ComparePointY); leftDimPointList.Sort(sorterY); PointList pointList = new PointList(); foreach (Point point in leftDimPointList) { pointList.Add(point); } Point minYPoint = leftDimPointList[0]; double dimDistance = Math.Abs(CCommonPara.mViewMinX - minYPoint.X) + 2 * CCommonPara.mDefaultDimDistance; Vector rightDimVector = new Vector(-1, 0, 0); CDimTools.GetInstance().DrawDimensionSet(mViewBase, pointList, rightDimVector, dimDistance, CCommonPara.mSizeDimPath); }
/// <summary> /// 绘制主梁右侧Y方向上的标注; /// </summary> private void DrawYMainRightDim() { List <Point> rightDimPointList = new List <Point>(); foreach (CMrPart mrPart in mMrPartList) { CMrDimSet partDimSet = mrPart.GetCylinderDoorFrontViewInfo().GetYPartMainRightDimSet(); if (partDimSet != null && partDimSet.Count > 0) { rightDimPointList.AddRange(partDimSet.GetDimPointList()); } } //1.得到主梁中间需要整体进行标注的标注集; CMrDimSet mrDimSet = GetYNormalMiddlePartDimSet(); rightDimPointList.AddRange(mrDimSet.GetDimPointList()); //2.得到顶部需要进行标注的零部件; CMrDimSet mrTopPartDimSet = GetTopPartDimSet(2); rightDimPointList.AddRange(mrTopPartDimSet.GetDimPointList()); //3.得到主梁上螺钉组的标注集; CMrDimSet mrBoltDimSet = GetMainBeamYRightBoltDimSet(); rightDimPointList.AddRange(mrBoltDimSet.GetDimPointList()); Comparison <Point> sorterY = new Comparison <Point>(CDimTools.ComparePointY); rightDimPointList.Sort(sorterY); PointList pointList = new PointList(); foreach (Point point in rightDimPointList) { pointList.Add(point); } Point minYPoint = rightDimPointList[0]; double dimDistance = Math.Abs(CCommonPara.mViewMaxX - minYPoint.X) + 2 * CCommonPara.mDefaultDimDistance; Vector rightDimVector = new Vector(1, 0, 0); CDimTools.GetInstance().DrawDimensionSet(mViewBase, pointList, rightDimVector, dimDistance, CCommonPara.mSizeDimPath); //2.标注一个主尺寸; Point maxYPoint = rightDimPointList[rightDimPointList.Count - 1]; pointList.Clear(); pointList.Add(minYPoint); pointList.Add(maxYPoint); dimDistance = dimDistance + 2 * CCommonPara.mDefaultDimDistance; CDimTools.GetInstance().DrawDimensionSet(mViewBase, pointList, rightDimVector, dimDistance, CCommonPara.mMainSizeDimPath); }
/// <summary> /// 根据CMrDimSet来创建Tekla中的标注; /// </summary> /// <param name="mrDimSet"></param> private void CreateDimByMrDimSet(CMrDimSet mrDimSet) { PointList pointList = new PointList(); foreach (Point point in mrDimSet.GetDimPointList()) { pointList.Add(point); } CDimTools.GetInstance().DrawDimensionSet(mViewBase, pointList, mrDimSet.mDimVector, mrDimSet.mDimDistance, CCommonPara.mSizeDimPath); }
/// <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 DrawXVectorTopDim() { CMrDimSet mrDimSet = new CMrDimSet(); Vector xVector = new Vector(1, 0, 0); Vector yVector = new Vector(0, 1, 0); Vector zVector = new Vector(0, 0, 1); foreach (CMrPart mrPart in mMrPartList) { Vector normal = mrPart.mNormal; if (!IsNeedTopDim(mrPart)) { continue; } double minX = mrPart.GetMinXPoint().X; double maxX = mrPart.GetMaxXPoint().X; double maxY = mrPart.GetMaxYPoint().Y; List <CMrBoltArray> mrBoltArrayList = mrPart.GetBoltArrayList(); foreach (CMrBoltArray mrBoltArray in mrBoltArrayList) { List <Point> maxYPointList = mrBoltArray.GetMaxYPointList(); if (minX > 0 || maxX < 0) { mrDimSet.AddRange(maxYPointList); mrDimSet.AddPoint(new Point(0, maxY, 0)); } else { mrDimSet.AddRange(maxYPointList); mrDimSet.AddPoint(new Point(0, maxY, 0)); mrDimSet.AddPoint(mrPart.GetMinXMaxYPoint()); mrDimSet.AddPoint(mrPart.GetMaxXMaxYPoint()); } } } if (mrDimSet.Count == 0) { return; } mrDimSet.mDimVector = yVector; mrDimSet.mDimDistance = 1.5 * CCommonPara.mDefaultDimDistance; CreateDimByMrDimSet(mrDimSet); }
/// <summary> /// 绘制第三种中间梁的下标注; /// </summary> public void DrawXDownDimMiddle() { bool bNeedDownDim = false; List <Point> downDimPointList = new List <Point>(); foreach (CMrPart mrPart in mMrPartList) { CMrDimSet partDimSet = mrPart.GetBeamDoorFrontViewInfo().GetXDownDimSetMiddle(); if (partDimSet != null && partDimSet.Count > 0) { bNeedDownDim = true; downDimPointList.AddRange(partDimSet.GetDimPointList()); } } if (bNeedDownDim == false) { return; } CMrPart topBeam = CMrBeamDoorManager.GetInstance().mTopBeam; CMrPart leftBottomBeam = CMrBeamDoorManager.GetInstance().mLeftBottomBeam; CMrPart rightBottomBeam = CMrBeamDoorManager.GetInstance().mRightBottomBeam; downDimPointList.Add(leftBottomBeam.mLeftBottomPoint); downDimPointList.Add(topBeam.mLeftTopPoint); downDimPointList.Add(rightBottomBeam.mRightBottomPoint); downDimPointList.Add(topBeam.mRightTopPoint); Comparison <Point> sorterX = new Comparison <Point>(CDimTools.ComparePointX); downDimPointList.Sort(sorterX); PointList pointList = new PointList(); foreach (Point point in downDimPointList) { pointList.Add(point); } Point MinXPoint = downDimPointList[0]; double dimDistance = Math.Abs(CCommonPara.mViewMinY - MinXPoint.Y) + 1.2 * CCommonPara.mDefaultDimDistance; Vector downDimVector = new Vector(0, -1, 0); CDimTools.GetInstance().DrawDimensionSet(mViewBase, pointList, downDimVector, dimDistance, CCommonPara.mSizeDimPath); }
/// <summary> /// 获取主梁螺钉右侧的标注集; /// </summary> /// <returns></returns> private CMrDimSet GetMainBeamYRightBoltDimSet() { CMrDimSet mrDimSet = new CMrDimSet(); foreach (CMrBoltArray mrBoltArray in mMainBeam.GetBoltArrayList()) { if (!CDimTools.GetInstance().IsTwoVectorParallel(mrBoltArray.mNormal, new Vector(0, 0, 1))) { continue; } List <Point> pointList = mrBoltArray.GetMaxXPointList(); mrDimSet.AddRange(pointList); } return(mrDimSet); }
/// <summary> /// 获取法向与Y轴平行的单独进行标注的零部件的标注集合; /// </summary> /// <returns></returns> private CMrDimSet GetYNormalMiddlePartDimSet() { CMrDimSet mrDimSet = new CMrDimSet(); List <CMrPart> yNormalAlonePartList = CMrCylinderDoorFrontManager.GetInstance().mYNormalMiddlePartList; foreach (CMrPart mrPart in yNormalAlonePartList) { if (!IsYNormalMiddlePartNeedDim(mrPart)) { continue; } mrDimSet.AddPoint(mrPart.GetMaxXMinYPoint()); } return(mrDimSet); }
/// <summary> /// 绘制右侧的标注; /// </summary> private void DrawXVectorRightDim() { Vector xVector = new Vector(1, 0, 0); Vector yVector = new Vector(0, 1, 0); Vector zVector = new Vector(0, 0, 1); foreach (CMrPart mrPart in mMrPartList) { Vector normal = mrPart.mNormal; CMrDimSet mrDimSet = new CMrDimSet(); double maxX = mrPart.GetMaxXPoint().X; if (maxX < 0) { continue; } //如果法向与Z轴平行; if (CDimTools.GetInstance().IsTwoVectorParallel(normal, zVector) && mrPart.IsHaveBolt()) { List <CMrBoltArray> mrBoltArrayList = mrPart.GetBoltArrayList(); foreach (CMrBoltArray mrBoltArray in mrBoltArrayList) { List <Point> maxXPointList = mrBoltArray.GetMaxXPointList(); mrDimSet.AddRange(maxXPointList); mrDimSet.AddPoint(mrPart.GetMaxYMaxXPoint()); mrDimSet.AddPoint(mrPart.GetMinYMaxXPoint()); } } if (mrDimSet.Count == 0) { continue; } mrDimSet.mDimDistance = 1.5 * CCommonPara.mDefaultDimDistance; mrDimSet.mDimVector = xVector; CreateDimByMrDimSet(mrDimSet); } }
/// <summary> /// 获得主梁上方需要标注的螺钉组; /// </summary> private CMrDimSet GetMainPartBoltUpDimX() { CMrDimSet mrDimSet = new CMrDimSet(); List <CMrBoltArray> mrBoltArrayList = mMainBeam.GetBoltArrayList(); foreach (CMrBoltArray mrBoltArray in mrBoltArrayList) { Vector normal = mrBoltArray.mNormal; if (!CDimTools.GetInstance().IsTwoVectorParallel(normal, new Vector(0, 0, 1))) { continue; } List <Point> pointList = mrBoltArray.GetMaxYPointList(); mrDimSet.AddRange(pointList); } return(mrDimSet); }
/// <summary> /// 绘制所有零件的下方标注; /// </summary> public void DrawAllPartDownDimX() { mMrPartList.Remove(mMainBeam); bool bNeedDownDim = false; List <Point> downDimPointList = new List <Point>(); foreach (CMrPart mrPart in mMrPartList) { CMrDimSet partDimSet = mrPart.GetBeamTopViewInfo().GetPartDownDimSet(); if (partDimSet != null && partDimSet.Count > 0) { bNeedDownDim = true; downDimPointList.AddRange(partDimSet.GetDimPointList()); } } if (bNeedDownDim == false) { return; } //2.默认把主梁的左右最小最大点添加到链表中; Point minXPoint = mMainBeam.GetMinXPoint(); Point maxXPoint = mMainBeam.GetMaxXPoint(); downDimPointList.Add(minXPoint); downDimPointList.Add(maxXPoint); PointList pointList = new PointList(); foreach (Point point in downDimPointList) { pointList.Add(point); } double dimDistance = GetDownDimDistance(pointList[0]); Vector upDimVector = new Vector(0, -1, 0); CDimTools.GetInstance().DrawDimensionSet(mViewBase, pointList, upDimVector, dimDistance, CCommonPara.mSizeDimPath); mMrPartList.Add(mMainBeam); }
/// <summary> /// 对于正常的左右倾斜梁的下标注; /// </summary> public void DrawXDownDimNormal() { List <Point> downDimPointList = new List <Point>(); foreach (CMrPart mrPart in mMrPartList) { CMrDimSet partDimSet = mrPart.GetBeamDoorFrontViewInfo().GetXDownDimSetNormal(); if (partDimSet != null && partDimSet.Count > 0) { downDimPointList.AddRange(partDimSet.GetDimPointList()); } } CMrPart topBeam = CMrBeamDoorManager.GetInstance().mTopBeam; CMrPart bottomBeam = CMrBeamDoorManager.GetInstance().mBottonBeam; CMrPart leftBeam = CMrBeamDoorManager.GetInstance().mLeftBeam; CMrPart rightBeam = CMrBeamDoorManager.GetInstance().mRightBeam; downDimPointList.Add(topBeam.mLeftTopPoint); downDimPointList.Add(bottomBeam.mLeftBottomPoint); downDimPointList.Add(topBeam.mRightTopPoint); downDimPointList.Add(bottomBeam.mRightBottomPoint); Comparison <Point> sorterX = new Comparison <Point>(CDimTools.ComparePointX); downDimPointList.Sort(sorterX); PointList pointList = new PointList(); foreach (Point point in downDimPointList) { pointList.Add(point); } double dimDistance = Math.Abs(CCommonPara.mViewMinY - downDimPointList[0].Y) + 1.5 * CCommonPara.mDefaultDimDistance; Vector downDimVector = new Vector(0, -1, 0); CDimTools.GetInstance().DrawDimensionSet(mViewBase, pointList, downDimVector, dimDistance, CCommonPara.mSizeDimPath); }
/// <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 DrawYMainLeftDim() { List <Point> leftDimPointList = new List <Point>(); foreach (CMrPart mrPart in mMrPartList) { CMrDimSet partDimSet = mrPart.GetCylinderDoorFrontViewInfo().GetYPartMainLeftDimSet(); if (partDimSet != null && partDimSet.Count > 0) { leftDimPointList.AddRange(partDimSet.GetDimPointList()); } } //1.得到顶部需要进行标注的零部件; CMrDimSet mrTopPartDimSet = GetTopPartDimSet(1); leftDimPointList.AddRange(mrTopPartDimSet.GetDimPointList()); Comparison <Point> sorterY = new Comparison <Point>(CDimTools.ComparePointY); leftDimPointList.Sort(sorterY); PointList pointList = new PointList(); foreach (Point point in leftDimPointList) { pointList.Add(point); } Point MinXPoint = leftDimPointList[0]; double dimDistance = Math.Abs(CCommonPara.mViewMinX - MinXPoint.X) + 2 * CCommonPara.mDefaultDimDistance; Vector rightDimVector = new Vector(-1, 0, 0); CDimTools.GetInstance().DrawDimensionSet(mViewBase, pointList, rightDimVector, dimDistance, CCommonPara.mSizeDimPath); }
/// <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); }
/// <summary> /// 获得主梁螺钉在X向的标注集; /// </summary> /// <returns></returns> private List <CMrDimSet> GetMainPartBoltDimSetX() { List <CMrDimSet> mrDimSetList = new List <CMrDimSet>(); //.主梁上剩下未标注的螺钉组; List <CMrBoltArray> lastMrBoltArrayList = new List <CMrBoltArray>(); //构建具有相同属性螺钉组的集合; List <CMrBoltArrayGroup> mrBoltArrayGroupList = new List <CMrBoltArrayGroup>(); //构建主梁中间剩下的螺钉组的链表; foreach (CMrBoltArray mrBoltArray in mMainBeam.GetBoltArrayList()) { if (mrBoltArray.mBoltArrayShapeType != MrBoltArrayShapeType.ARRAY) { continue; } if (!CDimTools.GetInstance().IsTwoVectorParallel(mrBoltArray.mNormal, new Vector(0, 0, 1))) { continue; } lastMrBoltArrayList.Add(mrBoltArray); } //构建剩下螺钉组的组合; int nCount = lastMrBoltArrayList.Count; //螺钉的唯一标识符与螺钉组集合的映射表; Dictionary <Identifier, CMrBoltArrayGroup> mapIdentifierToBoltArrayGroup = new Dictionary <Identifier, CMrBoltArrayGroup>(); for (int i = 0; i < nCount; i++) { CMrBoltArray firstBoltArray = lastMrBoltArrayList[i]; //如果该螺钉已经加到螺钉组的集合中则返回继续查找; if (mapIdentifierToBoltArrayGroup.ContainsKey(firstBoltArray.mBoltArrayInModel.Identifier)) { continue; } CMrBoltArrayGroup mrBoltArrayGroup = new CMrBoltArrayGroup(); mrBoltArrayGroup.AppendMrBoltArray(firstBoltArray); mrBoltArrayGroupList.Add(mrBoltArrayGroup); mapIdentifierToBoltArrayGroup.Add(firstBoltArray.mBoltArrayInModel.Identifier, mrBoltArrayGroup); for (int j = i + 1; j < nCount; j++) { CMrBoltArray secondBoltArray = lastMrBoltArrayList[j]; if (IsMrBoltArrayCanAddToMrBoltArrayGroup(secondBoltArray, mrBoltArrayGroup)) { mrBoltArrayGroup.AppendMrBoltArray(secondBoltArray); mapIdentifierToBoltArrayGroup.Add(secondBoltArray.mBoltArrayInModel.Identifier, mrBoltArrayGroup); } } } //根据组合好的螺钉组集合来进行标注; foreach (CMrBoltArrayGroup mrBoltArrayGroup in mrBoltArrayGroupList) { CMrDimSet yMrDimSet = new CMrDimSet(); foreach (CMrBoltArray mrBoltArray in mrBoltArrayGroup.mrBoltArrayList) { List <Point> minYPointList = mrBoltArray.GetMinYPointList(); yMrDimSet.AddRange(minYPointList); } yMrDimSet.AddPoint(new Point(0, yMrDimSet.GetDimPointList()[0].Y, 0)); //需要判断螺钉是否在柱子的底端或上端; double maxY = mrBoltArrayGroup.GetMaxYPoint().Y; double minY = mrBoltArrayGroup.GetMinYPoint().Y; double mainBeamMaxY = mMainBeam.GetMaxYPoint().Y; double mainBeamMinY = mMainBeam.GetMinYPoint().Y; if (Math.Abs(maxY - mainBeamMaxY) < CCommonPara.mDefaultDimDistanceThreshold) { yMrDimSet.mDimDistance = Math.Abs(yMrDimSet.GetDimPointList()[0].Y - CCommonPara.mViewMaxY) + CCommonPara.mDefaultDimDistance; yMrDimSet.mDimVector = new Vector(0, 1, 0); mrDimSetList.Add(yMrDimSet); } else if (Math.Abs(minY - mainBeamMinY) < CCommonPara.mDefaultDimDistanceThreshold) { yMrDimSet.mDimDistance = Math.Abs(yMrDimSet.GetDimPointList()[0].Y - CCommonPara.mViewMinY) + CCommonPara.mDefaultDimDistance; yMrDimSet.mDimVector = new Vector(0, -1, 0); mrDimSetList.Add(yMrDimSet); } else { yMrDimSet.mDimDistance = CCommonPara.mDefaultDimDistance; yMrDimSet.mDimVector = new Vector(0, -1, 0); mrDimSetList.Add(yMrDimSet); } } return(mrDimSetList); }
/// <summary> /// 标注左侧的零部件; /// </summary> private void DrawLeftPartDim() { List <Point> pointList = new List <Point>(); Vector xVector = new Vector(1, 0, 0); Vector yVector = new Vector(0, 1, 0); Vector zVector = new Vector(0, 0, 1); bool bFlag = false; foreach (CMrPart mrPart in mMrPartList) { if (!IsInvalidPart(mrPart)) { continue; } Point minXPoint = mrPart.GetMinXPoint(); Point maxXPoint = mrPart.GetMaxXPoint(); //0.如果零件在右侧则直接返回; if (minXPoint.X > CCommonPara.mDblError) { continue; } //1.如果存在板的法向与y轴平行; if (CDimTools.GetInstance().IsTwoVectorParallel(mrPart.mNormal, yVector)) { //有些零件的法向朝Y,但是上面的螺钉是朝Z轴的,需要排除掉; List <CMrBoltArray> mrBoltArrayList = mrPart.GetBoltArrayList(); if (mrBoltArrayList != null && mrBoltArrayList.Count > 0) { Vector boltNormal = mrBoltArrayList[0].mNormal; if (CDimTools.GetInstance().IsTwoVectorParallel(boltNormal, zVector)) { } } else { //如果有水平的板的刚好水平放置在柱的中间,则取水平板的中间点即可; Point minXminYPoint = mrPart.GetMinXMinYPoint(); Point minXmaxYPoint = mrPart.GetMinXMaxYPoint(); if (Math.Abs(minXmaxYPoint.Y) < 10 && Math.Abs(minXminYPoint.Y) < 10 && Math.Abs(minXmaxYPoint.Y + minXminYPoint.Y) < CCommonPara.mDblError) { Point newPoint = new Point(0, 0, 0); newPoint.Y = 0; newPoint.X = minXminYPoint.X; pointList.Add(newPoint); bFlag = true; } else { pointList.Add(minXminYPoint); } } } //2.如果板的法向与Z轴平行; if (CDimTools.GetInstance().IsTwoVectorParallel(mrPart.mNormal, zVector) || CDimTools.GetInstance().IsTwoVectorParallel(mrPart.mNormal, yVector)) { if (!mrPart.IsHaveBolt()) { continue; } List <CMrBoltArray> mrBoltArrayList = mrPart.GetBoltArrayList(); foreach (CMrBoltArray mrBoltArray in mrBoltArrayList) { //如果该螺钉组的对称螺钉已经标注则不进行标注; CMrBoltArray mYSymBoltArray = mrBoltArray.GetMrBoltArrayInfo().mYSymBoltArray; if (mYSymBoltArray != null && mYSymBoltArray.GetMrBoltArrayInfo().mbIsRightDim == true) { continue; } Vector boltNormal = mrBoltArray.mNormal; if (!CDimTools.GetInstance().IsTwoVectorParallel(boltNormal, zVector)) { continue; } List <Point> boltPointList = mrBoltArray.GetMinXPointList(); if (boltPointList == null || boltPointList.Count == 0) { continue; } pointList.AddRange(boltPointList); } } } if (pointList.Count == 0) { return; } //3.如果没有设置水平中间板的点,则自动设置改点; if (false == bFlag && pointList.Count > 0) { double mainBeamMinX = mMainBeam.GetMinXPoint().X; pointList.Add(new Point(mainBeamMinX, 0, 0)); } CMrDimSet mrDimSet = new CMrDimSet(); mrDimSet.AddRange(pointList); pointList = mrDimSet.GetDimPointList(); Point viewMinPoint = mViewBase.RestrictionBox.MinPoint; double viewMinX = viewMinPoint.X; Vector dimVector = new Vector(-1, 0, 0); double distance = Math.Abs(viewMinX - pointList[0].X) + CCommonPara.mDefaultDimDistance; mrDimSet.mDimVector = dimVector; mrDimSet.mDimDistance = distance; CreateDimByMrDimSet(mrDimSet); }
/// <summary> /// 绘制主梁与X方向平行的剖面; /// </summary> private void DrawXVectorSectionDim() { List <Point> upPointList = new List <Point>(); List <Point> downPointList = new List <Point>(); List <Point> leftPointList = new List <Point>(); List <Point> rightPointList = new List <Point>(); double mainBeamMaxY = mMainBeam.GetMaxYPoint().Y; double mainBeamMinY = mMainBeam.GetMinYPoint().Y; Vector xVector = new Vector(1, 0, 0); Vector yVector = new Vector(0, 1, 0); Vector zVector = new Vector(0, 0, 1); //记录标注中是否存在螺钉,只有法向与Z轴平行的螺钉才进行标注; bool bHaveBoltDim = false; foreach (CMrPart mrPart in mMrPartList) { if (!mrPart.IsHaveBolt()) { continue; } Point partMinXPoint = mrPart.GetMinXPoint(); Point partMaxXPoint = mrPart.GetMaxXPoint(); Point partMinYPoint = mrPart.GetMinYPoint(); Point partMaxYPoint = mrPart.GetMaxYPoint(); Vector normal = mrPart.mNormal; //1.先标注法向与Z轴平行的螺钉组; List <CMrBoltArray> mrBoltArrayList = mrPart.GetBoltArrayList(); foreach (CMrBoltArray mrBoltArray in mrBoltArrayList) { Vector boltNormal = mrBoltArray.mNormal; if (!CDimTools.GetInstance().IsTwoVectorParallel(boltNormal, zVector)) { continue; } List <Point> boltMinXPointList = mrBoltArray.GetMinXPointList(); List <Point> boltMaxXPointList = mrBoltArray.GetMaxXPointList(); List <Point> boltMaxYPointList = mrBoltArray.GetMaxYPointList(); if (boltMaxXPointList[0].X < CCommonPara.mDblError) { leftPointList.AddRange(boltMinXPointList); upPointList.AddRange(boltMaxYPointList); } else { rightPointList.AddRange(boltMaxXPointList); upPointList.AddRange(boltMaxYPointList); } bHaveBoltDim = true; } //2.标注法向与X轴平行的零部件; if (CDimTools.GetInstance().IsTwoVectorParallel(xVector, normal)) { if (CDimTools.GetInstance().CompareTwoDoubleValue(partMinYPoint.Y, mainBeamMaxY) >= 0) { upPointList.Add(mrPart.GetMaxYMinXPoint()); } else if (CDimTools.GetInstance().CompareTwoDoubleValue(partMaxYPoint.Y, mainBeamMinY) <= 0) { downPointList.Add(mrPart.GetMinYMinXPoint()); } } //3.标注法向与Y轴平行的零部件; else if (CDimTools.GetInstance().IsTwoVectorParallel(yVector, normal)) { if (partMaxYPoint.X < CCommonPara.mDblError) { leftPointList.Add(mrPart.GetMaxYMinXPoint()); } else if (partMinXPoint.X > CCommonPara.mDblError) { rightPointList.Add(mrPart.GetMaxYMaxXPoint()); } } else if (CDimTools.GetInstance().IsTwoVectorParallel(zVector, normal)) { //4.法向与Z轴平行的零部件只标注螺钉,故不标注; } } Point viewMinPoint = mViewBase.RestrictionBox.MinPoint; Point viewMaxPoint = mViewBase.RestrictionBox.MaxPoint; double viewMaxY = viewMaxPoint.Y; double viewMinY = viewMinPoint.Y; double viewMaxX = viewMaxPoint.X; double viewMinX = viewMinPoint.X; AdjustMainBeamPoint(); //1.如果主梁上面需要进行标注; if (upPointList.Count > 0) { if (upPointList.Count > 1) { Point middlePoint = new Point(0, mMainBeam.GetMaxYPoint().Y, 0); upPointList.Add(middlePoint); } else if (upPointList.Count == 1) { if (bHaveBoltDim) { Point middlePoint = new Point(0, mMainBeam.mLeftTopPoint.Y, 0); if (upPointList[0].X < CCommonPara.mDblError) { upPointList.Add(mMainBeam.mLeftTopPoint); upPointList.Add(middlePoint); } else if (upPointList[0].X > CCommonPara.mDblError) { upPointList.Add(mMainBeam.mRightTopPoint); upPointList.Add(middlePoint); } } else { upPointList.Add(mMainBeam.mLeftTopPoint); upPointList.Add(mMainBeam.mRightTopPoint); } } Comparison <Point> sorterX = new Comparison <Point>(CDimTools.ComparePointX); upPointList.Sort(sorterX); Vector upVector = new Vector(0, 1, 0); double distance = Math.Abs(CCommonPara.mViewMaxY - upPointList[0].Y) + CCommonPara.mDefaultDimDistance; CMrDimSet mrDimSet = new CMrDimSet(); mrDimSet.AddRange(upPointList); mrDimSet.mDimVector = upVector; mrDimSet.mDimDistance = distance; CreateDimByMrDimSet(mrDimSet); } //2.如果主梁的下面需要进行标注; if (downPointList.Count > 0) { if (downPointList.Count > 1) { Point middlePoint = new Point(0, mMainBeam.mLeftBottomPoint.Y, 0); downPointList.Add(middlePoint); } else if (downPointList.Count == 1) { Point middlePoint = new Point(0, mMainBeam.mLeftBottomPoint.Y, 0); if (downPointList[0].X > CCommonPara.mDblError) { downPointList.Add(mMainBeam.mRightBottomPoint); downPointList.Add(middlePoint); } else if (downPointList[0].X < CCommonPara.mDblError) { downPointList.Add(mMainBeam.mLeftBottomPoint); downPointList.Add(middlePoint); } else { downPointList.Add(mMainBeam.mLeftBottomPoint); downPointList.Add(mMainBeam.mRightBottomPoint); } } Comparison <Point> sorterX = new Comparison <Point>(CDimTools.ComparePointX); downPointList.Sort(sorterX); Vector downVector = new Vector(0, -1, 0); double distance = Math.Abs(CCommonPara.mViewMinY - downPointList[0].Y) + CCommonPara.mDefaultDimDistance; CMrDimSet mrDimSet = new CMrDimSet(); mrDimSet.AddRange(downPointList); mrDimSet.mDimVector = downVector; mrDimSet.mDimDistance = distance; CreateDimByMrDimSet(mrDimSet); } //3.如果主梁右侧需要进行标注; if (rightPointList.Count > 0) { rightPointList.Add(mMainBeam.mRightTopPoint); Comparison <Point> sorterY = new Comparison <Point>(CDimTools.ComparePointY); rightPointList.Sort(sorterY); Vector rightVector = new Vector(1, 0, 0); double distance = Math.Abs(CCommonPara.mViewMaxX - rightPointList[0].X) + CCommonPara.mDefaultDimDistance; CMrDimSet mrDimSet = new CMrDimSet(); mrDimSet.AddRange(rightPointList); mrDimSet.mDimVector = rightVector; mrDimSet.mDimDistance = distance; CreateDimByMrDimSet(mrDimSet); } //4.如果梁的左侧需要进行标注; if (leftPointList.Count > 0) { leftPointList.Add(mMainBeam.mLeftTopPoint); Comparison <Point> sorterY = new Comparison <Point>(CDimTools.ComparePointY); leftPointList.Sort(sorterY); Vector leftVector = new Vector(-1, 0, 0); double distance = Math.Abs(CCommonPara.mViewMinX - leftPointList[0].X) + CCommonPara.mDefaultDimDistance; CMrDimSet mrDimSet = new CMrDimSet(); mrDimSet.AddRange(leftPointList); mrDimSet.mDimVector = leftVector; mrDimSet.mDimDistance = distance; CreateDimByMrDimSet(mrDimSet); } }
/// <summary> /// 获得主梁螺钉在Y向的标注集; /// </summary> /// <returns></returns> private List <CMrDimSet> GetMainPartBoltDimSetY() { List <CMrDimSet> mrDimSetList = new List <CMrDimSet>(); List <CMrBoltArray> mrLeftBoltArrayList = new List <CMrBoltArray>(); List <CMrBoltArray> mrRightBoltArrayList = new List <CMrBoltArray>(); //0.首先需要获得在主梁两侧并在一定阈值内的螺钉,该螺钉需要标注到主梁两侧; GetMainPartBorderBoltArrayList(ref mrLeftBoltArrayList, ref mrRightBoltArrayList); //1.左侧的标注集; if (mrLeftBoltArrayList.Count > 0) { CMrDimSet mrLeftDimSet = new CMrDimSet(); foreach (CMrBoltArray mrBoltArray in mrLeftBoltArrayList) { List <Point> minXPointList = mrBoltArray.GetMinXPointList(); mrLeftDimSet.AddRange(minXPointList); } if (mrLeftDimSet.Count > 0) { mrLeftDimSet.AddPoint(new Point(mMainBeam.GetMinXPoint().X, 0, 0)); } mrLeftDimSet.mDimVector = new Vector(-1, 0, 0); double dblDistance = Math.Abs(CCommonPara.mViewMinX - mrLeftDimSet.GetDimPointList()[0].X); mrLeftDimSet.mDimDistance = dblDistance + CCommonPara.mDefaultDimDistance; mrDimSetList.Add(mrLeftDimSet); } //2.右侧的标注集; if (mrRightBoltArrayList.Count > 0) { CMrDimSet mrRightDimSet = new CMrDimSet(); foreach (CMrBoltArray mrBoltArray in mrRightBoltArrayList) { List <Point> maxXPointList = mrBoltArray.GetMaxXPointList(); mrRightDimSet.AddRange(maxXPointList); } if (mrRightDimSet.Count > 0) { mrRightDimSet.AddPoint(new Point(mMainBeam.GetMaxXPoint().X, 0, 0)); } mrRightDimSet.mDimVector = new Vector(1, 0, 0); double dblDistance = Math.Abs(CCommonPara.mViewMaxX - mrRightDimSet.GetDimPointList()[0].X); mrRightDimSet.mDimDistance = dblDistance + CCommonPara.mDefaultDimDistance; mrDimSetList.Add(mrRightDimSet); } //3.主梁上剩下的螺钉组标注,标注在主梁中间; foreach (CMrBoltArray mrBoltArray in mMainBeam.GetBoltArrayList()) { Vector normal = mrBoltArray.mNormal; if (!CDimTools.GetInstance().IsTwoVectorParallel(normal, new Vector(0, 0, 1))) { continue; } if (mrLeftBoltArrayList.Contains(mrBoltArray) || mrRightBoltArrayList.Contains(mrBoltArray)) { continue; } CMrDimSet mrDimSet = new CMrDimSet(); mrDimSet.AddRange(mrBoltArray.GetMaxXPointList()); mrDimSet.AddPoint(new Point(mrBoltArray.GetMaxXPoint().X, 0, 0)); mrDimSet.mDimVector = new Vector(1, 0, 0); mrDimSet.mDimDistance = CCommonPara.mDefaultDimDistance; mrDimSetList.Add(mrDimSet); } return(mrDimSetList); }
/// <summary> /// 绘制主梁中间的零部件标注; /// 主梁中间的零部件只有法向与主梁顶部部件平行的才进行标注; /// </summary> private void DrawMainBeamMiddlePartDimMiddle() { CMrPart topBeam = CMrBeamDoorManager.GetInstance().mTopBeam; Point midMaxPoint = CMrBeamDoorManager.GetInstance().mMidMaxPoint; Point leftTopPoint = topBeam.mLeftTopPoint; Point rightTopPoint = topBeam.mRightTopPoint; CMrBeamDoorManager.GetInstance().BuildMostNearPartToPartList(mMrPartList); Dictionary <CMrPart, List <CMrPart> > dicPartToPartList = CMrBeamDoorManager.GetInstance().mDicPartToPartList; List <CMrDimSet> mrDimSetList = new List <CMrDimSet>(); foreach (CMrPart mostNearPart in dicPartToPartList.Keys) { List <CMrPart> mrPartList = dicPartToPartList[mostNearPart]; if (mrPartList.Count == 0) { continue; } //(1).与顶板平行方向标注螺钉; CMrDimSet mrDimSet = new CMrDimSet(); if (mostNearPart.mLeftTopPoint.X < midMaxPoint.X) { mrDimSet.AddPoint(mostNearPart.mRightTopPoint); } else { mrDimSet.AddPoint(mostNearPart.mLeftTopPoint); } //如果在上翼板的左侧; if (mostNearPart.mLeftTopPoint.X < midMaxPoint.X) { foreach (CMrPart mrPart in mrPartList) { CMrBoltArray mrBoltArray = mrPart.GetBoltArrayList()[0]; Point boltPoint = mrBoltArray.GetMaxXPoint(); mrDimSet.AddPoint(boltPoint); } mrDimSet.mDimVector = CMrBeamDoorManager.GetInstance().mLeftTopVector; mrDimSet.mDimDistance = CCommonPara.mDefaultDimDistance; mrDimSetList.Add(mrDimSet); //(2).与顶板竖直方向标注; mrDimSet = new CMrDimSet(); mrDimSet.AddPoint(mrPartList[0].mLeftBottomPoint); Point fontPt = CDimTools.GetInstance().ComputeFootPointToLine(mrPartList[0].mLeftBottomPoint, leftTopPoint, midMaxPoint); mrDimSet.AddPoint(fontPt); mrDimSet.mDimDistance = CCommonPara.mDefaultDimDistance; mrDimSet.mDimVector = new Vector(leftTopPoint.X - midMaxPoint.X, leftTopPoint.Y - midMaxPoint.Y, 0); mrDimSetList.Add(mrDimSet); } //如果在上翼板的右侧; else if (mostNearPart.mLeftTopPoint.X > midMaxPoint.X) { foreach (CMrPart mrPart in mrPartList) { CMrBoltArray mrBoltArray = mrPart.GetBoltArrayList()[0]; Point boltPoint = mrBoltArray.GetMaxXPoint(); mrDimSet.AddPoint(boltPoint); } mrDimSet.mDimVector = CMrBeamDoorManager.GetInstance().mRightTopVector; mrDimSet.mDimDistance = CCommonPara.mDefaultDimDistance; mrDimSetList.Add(mrDimSet); //(2).与顶板竖直方向标注; mrDimSet = new CMrDimSet(); mrDimSet.AddPoint(mrPartList[0].mRightBottomPoint); Point fontPt = CDimTools.GetInstance().ComputeFootPointToLine(mrPartList[0].mRightBottomPoint, rightTopPoint, midMaxPoint); mrDimSet.AddPoint(fontPt); mrDimSet.mDimDistance = CCommonPara.mDefaultDimDistance; mrDimSet.mDimVector = new Vector(rightTopPoint.X - midMaxPoint.X, rightTopPoint.Y - midMaxPoint.Y, 0); mrDimSetList.Add(mrDimSet); } } foreach (CMrDimSet mrDimSet in mrDimSetList) { List <Point> dimPointList = mrDimSet.GetDimPointList(); PointList pointList = new PointList(); foreach (Point point in dimPointList) { pointList.Add(point); } Vector dimVector = mrDimSet.mDimVector; double length = mrDimSet.mDimDistance; CDimTools.GetInstance().DrawDimensionSet(mViewBase, pointList, dimVector, length, CCommonPara.mSizeDimPath); } }
/// <summary> /// 绘制主梁与Y方向平行的剖面; /// </summary> private void DrawYVectorSectionDim() { List <Point> upPointList = new List <Point>(); List <Point> downPointList = new List <Point>(); List <Point> leftPointList = new List <Point>(); List <Point> rightPointList = new List <Point>(); double mainBeamMinX = mMainBeam.mLeftTopPoint.X; double mainBeamMaxX = mMainBeam.mRightTopPoint.X; Vector xVector = new Vector(1, 0, 0); Vector yVector = new Vector(0, 1, 0); Vector zVector = new Vector(0, 0, 1); foreach (CMrPart mrPart in mMrPartList) { if (!mrPart.IsHaveBolt()) { continue; } List <Point> pointList = mrPart.GetPointList(); int nCount = pointList.Count; Comparison <Point> sorterX = new Comparison <Point>(CDimTools.ComparePointX); pointList.Sort(sorterX); Point partMinXPoint = pointList[0]; Point partMaxXPoint = pointList[nCount - 1]; Comparison <Point> sorterY = new Comparison <Point>(CDimTools.ComparePointY); pointList.Sort(sorterY); Point partMinYPoint = pointList[0]; Point partMaxYPoint = pointList[nCount - 1]; Vector normal = mrPart.mNormal; if (CDimTools.GetInstance().IsTwoVectorParallel(xVector, normal)) { if (partMinYPoint.Y > CCommonPara.mDblError) { if (IsValidPoint(mrPart.mLeftTopPoint)) { upPointList.Add(mrPart.mLeftTopPoint); } } else if (partMinYPoint.Y < CCommonPara.mDblError) { if (IsValidPoint(mrPart.mLeftBottomPoint)) { downPointList.Add(mrPart.mLeftBottomPoint); } } } else if (CDimTools.GetInstance().IsTwoVectorParallel(yVector, normal)) { if (CDimTools.GetInstance().CompareTwoDoubleValue(partMaxXPoint.X, mainBeamMinX) <= 0) { if (IsValidPoint(mrPart.mLeftTopPoint)) { leftPointList.Add(mrPart.mLeftTopPoint); } } else if (CDimTools.GetInstance().CompareTwoDoubleValue(partMinXPoint.X, mainBeamMaxX) >= 0) { if (IsValidPoint(mrPart.mRightTopPoint)) { rightPointList.Add(mrPart.mRightTopPoint); } } } else if (CDimTools.GetInstance().IsTwoVectorParallel(zVector, normal)) { if (partMinYPoint.Y > CCommonPara.mDblError) { List <CMrBoltArray> mrBoltArrayList = mrPart.GetBoltArrayList(); foreach (CMrBoltArray mrBoltArray in mrBoltArrayList) { Vector boltNormal = mrBoltArray.mNormal; if (!CDimTools.GetInstance().IsTwoVectorParallel(boltNormal, zVector)) { continue; } List <Point> boltMinXPointList = mrBoltArray.GetMinXPointList(); List <Point> boltMaxYPointList = mrBoltArray.GetMaxYPointList(); leftPointList.AddRange(boltMinXPointList); upPointList.AddRange(boltMaxYPointList); } } else if (partMaxYPoint.Y < CCommonPara.mDblError) { List <CMrBoltArray> mrBoltArrayList = mrPart.GetBoltArrayList(); foreach (CMrBoltArray mrBoltArray in mrBoltArrayList) { Vector boltNormal = mrBoltArray.mNormal; if (!CDimTools.GetInstance().IsTwoVectorParallel(boltNormal, zVector)) { continue; } List <Point> boltMinYPointList = mrBoltArray.GetMinYPointList(); List <Point> boltMinXPointList = mrBoltArray.GetMinXPointList(); leftPointList.AddRange(boltMinXPointList); downPointList.AddRange(boltMinYPointList); } } } } Point viewMinPoint = mViewBase.RestrictionBox.MinPoint; Point viewMaxPoint = mViewBase.RestrictionBox.MaxPoint; double viewMaxY = viewMaxPoint.Y; double viewMinY = viewMinPoint.Y; double viewMaxX = viewMaxPoint.X; double viewMinX = viewMinPoint.X; AdjustMainBeamPoint(); if (upPointList.Count > 0) { upPointList.Add(mMainBeam.mLeftTopPoint); upPointList.Add(mMainBeam.mRightTopPoint); Point dimMinYPoint = CDimTools.GetInstance().GetMinYPoint(upPointList); Comparison <Point> sorterX = new Comparison <Point>(CDimTools.ComparePointX); upPointList.Sort(sorterX); Vector upVector = new Vector(0, 1, 0); double distance = Math.Abs(viewMaxY - upPointList[0].Y) + CCommonPara.mDefaultDimDistance; CMrDimSet mrDimSet = new CMrDimSet(); mrDimSet.AddRange(upPointList); mrDimSet.mDimVector = upVector; mrDimSet.mDimDistance = distance; CreateDimByMrDimSet(mrDimSet); } if (downPointList.Count > 0) { downPointList.Add(mMainBeam.mLeftBottomPoint); downPointList.Add(mMainBeam.mRightBottomPoint); Point dimMaxYPoint = CDimTools.GetInstance().GetMaxYPoint(downPointList); Comparison <Point> sorterX = new Comparison <Point>(CDimTools.ComparePointX); downPointList.Sort(sorterX); Vector downVector = new Vector(0, -1, 0); double distance = Math.Abs(viewMinY - downPointList[0].Y) + CCommonPara.mDefaultDimDistance; CMrDimSet mrDimSet = new CMrDimSet(); mrDimSet.AddRange(downPointList); mrDimSet.mDimVector = downVector; mrDimSet.mDimDistance = distance; CreateDimByMrDimSet(mrDimSet); } if (rightPointList.Count > 0) { if (rightPointList.Count > 1) { Point middlePoint = new Point(mMainBeam.mRightTopPoint.X, 0, 0); rightPointList.Add(middlePoint); } else if (rightPointList.Count == 1) { rightPointList.Add(mMainBeam.mRightBottomPoint); rightPointList.Add(mMainBeam.mRightTopPoint); } Point dimMinXPoint = CDimTools.GetInstance().GetMinXPoint(rightPointList); Comparison <Point> sorterY = new Comparison <Point>(CDimTools.ComparePointY); rightPointList.Sort(sorterY); Vector rightVector = new Vector(1, 0, 0); double distance = Math.Abs(viewMaxX - rightPointList[0].X) + CCommonPara.mDefaultDimDistance; CMrDimSet mrDimSet = new CMrDimSet(); mrDimSet.AddRange(rightPointList); mrDimSet.mDimVector = rightVector; mrDimSet.mDimDistance = distance; CreateDimByMrDimSet(mrDimSet); } if (leftPointList.Count > 0) { if (leftPointList.Count > 1) { Point middlePoint = new Point(mMainBeam.mLeftTopPoint.X, 0, 0); leftPointList.Add(middlePoint); } else if (leftPointList.Count == 1) { leftPointList.Add(mMainBeam.mLeftBottomPoint); leftPointList.Add(mMainBeam.mLeftTopPoint); } Point dimMaxXPoint = CDimTools.GetInstance().GetMaxXPoint(leftPointList); Comparison <Point> sorterY = new Comparison <Point>(CDimTools.ComparePointY); leftPointList.Sort(sorterY); Vector leftVector = new Vector(-1, 0, 0); double distance = Math.Abs(viewMinX - leftPointList[0].X) + CCommonPara.mDefaultDimDistance; CMrDimSet mrDimSet = new CMrDimSet(); mrDimSet.AddRange(leftPointList); mrDimSet.mDimVector = leftVector; mrDimSet.mDimDistance = distance; CreateDimByMrDimSet(mrDimSet); } }
/// <summary> /// 绘制所有零件向下的分尺寸; /// </summary> public void DrawAllPartDownFenSizeDimX() { //移除主梁; mMrPartList.Remove(mMainBeam); 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.GetBeamTopViewInfo().GetPartDownDimSet(); 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 minXPoint = mMainBeam.GetMinXMinYPoint(); Point maxXPoint = mMainBeam.GetMaxXMinYPoint(); //1.如果其他剩下的零件需要标注; if (bNeedOtherPartDim) { PointList pointList = new PointList(); foreach (Point pt in otherPartDimPointList) { pointList.Add(pt); } pointList.Add(minXPoint); pointList.Add(maxXPoint); Vector upDimVector = new Vector(0, -1, 0); mDownDimDistance = GetDownDimDistance(pointList[0]); CDimTools.GetInstance().DrawDimensionSet(mViewBase, pointList, upDimVector, mDownDimDistance, CCommonPara.mSizeDimPath); } //2.如果水平连接板及支撑需要标注; if (bNeedHorizontalConnectPlateDim) { PointList pointList = new PointList(); foreach (Point pt in horizontalConnectPlateDimPointList) { pointList.Add(pt); } pointList.Add(minXPoint); pointList.Add(maxXPoint); Vector upDimVector = new Vector(0, -1, 0); mDownDimDistance = GetDownDimDistance(pointList[0]); CDimTools.GetInstance().DrawDimensionSet(mViewBase, pointList, upDimVector, mDownDimDistance, CCommonPara.mSizeDimPath); } mMrPartList.Add(mMainBeam); }
/// <summary> /// 标注下方的零部件; /// </summary> private void DrawBottomPartDim() { List <Point> pointList = new List <Point>(); Vector xVector = new Vector(1, 0, 0); Vector yVector = new Vector(0, 1, 0); Vector zVector = new Vector(0, 0, 1); bool bFlagLeft = false; bool bFlagRight = false; double mainBeamMinX = mMainBeam.GetMinXPoint().X; double mainBeamMaxX = mMainBeam.GetMaxXPoint().X; foreach (CMrPart mrPart in mMrPartList) { if (!IsInvalidPart(mrPart)) { continue; } Point minYPoint = mrPart.GetMinYPoint(); Point maxYPoint = mrPart.GetMaxYPoint(); //0.如果零件在上侧则直接返回; if (minYPoint.Y > CCommonPara.mDblError) { continue; } //1.如果存在板的法向与x轴平行; if (CDimTools.GetInstance().IsTwoVectorParallel(mrPart.mNormal, xVector)) { Point minYminXPoint = mrPart.GetMinYMinXPoint(); Point minYmaxXPoint = mrPart.GetMinYMaxXPoint(); if (Math.Abs(minYminXPoint.X - mainBeamMinX) < CCommonPara.mDblError) { bFlagLeft = true; pointList.Add(minYminXPoint); } else if (Math.Abs(minYmaxXPoint.X - mainBeamMaxX) < CCommonPara.mDblError) { bFlagRight = true; pointList.Add(minYmaxXPoint); } else { pointList.Add(minYminXPoint); } } //2.如果板的法向与Z轴平行; if (CDimTools.GetInstance().IsTwoVectorParallel(mrPart.mNormal, zVector) || CDimTools.GetInstance().IsTwoVectorParallel(mrPart.mNormal, yVector)) { if (!mrPart.IsHaveBolt()) { continue; } List <CMrBoltArray> mrBoltArrayList = mrPart.GetBoltArrayList(); foreach (CMrBoltArray mrBoltArray in mrBoltArrayList) { //如果该螺钉组的对称螺钉组已经标注,则不进行标注; CMrBoltArray mXSymBoltArray = mrBoltArray.GetMrBoltArrayInfo().mXSymBoltArray; if (mXSymBoltArray != null && mXSymBoltArray.GetMrBoltArrayInfo().mbIsUpDim == true) { continue; } Vector boltNormal = mrBoltArray.mNormal; if (!CDimTools.GetInstance().IsTwoVectorParallel(boltNormal, zVector)) { continue; } List <Point> boltPointList = mrBoltArray.GetMinYPointList(); if (boltPointList == null || boltPointList.Count == 0) { continue; } pointList.AddRange(boltPointList); } } } if (pointList.Count == 0) { return; } //3.增加柱两边的端点; double mainBeamMinY = mMainBeam.GetMinYPoint().Y; if (bFlagLeft == false) { pointList.Add(new Point(mainBeamMinX, mainBeamMinY, 0)); } if (bFlagRight == false) { pointList.Add(new Point(mainBeamMaxX, mainBeamMinY, 0)); } CMrDimSet mrDimSet = new CMrDimSet(); mrDimSet.AddRange(pointList); pointList = mrDimSet.GetDimPointList(); Point viewMinPoint = mViewBase.RestrictionBox.MinPoint; double viewMinY = viewMinPoint.Y; Vector dimVector = new Vector(0, -1, 0); double distance = Math.Abs(viewMinY - pointList[0].Y) + CCommonPara.mDefaultDimDistance; mrDimSet.mDimVector = dimVector; mrDimSet.mDimDistance = distance; CreateDimByMrDimSet(mrDimSet); }