/// <summary> /// 获得法向与Z轴平行的中间的零件中螺钉标记; /// </summary> /// <returns></returns> public List <CMrMark> GetZNormalMiddleBoltMark() { List <CMrMark> mrMarkList = new List <CMrMark>(); Vector normal = mMrPart.mNormal; double minX = mMrPart.GetMinXPoint().X; double maxX = mMrPart.GetMaxXPoint().X; if (!CDimTools.GetInstance().IsTwoVectorParallel(normal, new Vector(0, 0, 1)) || !mMrPart.IsHaveBolt()) { return(mrMarkList); } if (CDimTools.GetInstance().CompareTwoDoubleValue(minX, 0) >= 0 || CDimTools.GetInstance().CompareTwoDoubleValue(maxX, 0) <= 0) { return(mrMarkList); } List <CMrBoltArray> mrBoltArrayList = mMrPart.GetBoltArrayList(); foreach (CMrBoltArray mrBoltArray in mrBoltArrayList) { if (!CDimTools.GetInstance().IsTwoVectorParallel(mrBoltArray.mNormal, new Vector(0, 0, 1))) { continue; } CMrMark mrMark = new CMrMark(); double dblAngle = CCommonPara.mBoltMarkAngle; mrMark.mModelObject = mrBoltArray.mBoltInDrawing; mrMark.mInsertPoint = mrBoltArray.GetMaxXMaxYPoint(); double increaseXDistance = CCommonPara.mBoltMarkLength / Math.Tan(dblAngle); mrMark.mTextPoint.X = mrMark.mInsertPoint.X + increaseXDistance; mrMark.mTextPoint.Y = mrMark.mInsertPoint.Y + 1.2 * CCommonPara.mBoltMarkLength; mrMarkList.Add(mrMark); } return(mrMarkList); }
/// <summary> /// 获取在零件法向在XY平面内的零件标记; /// </summary> /// <param name="mrPart"></param> /// <returns></returns> private CMrMark GetXYPlaneNormalPartMark(CMrPart mrPart) { double maxY = mMrPart.GetMaxYPoint().Y; double minX = mMrPart.GetMinXPoint().X; double maxX = mMrPart.GetMaxXPoint().X; CMrPart mrTopPart = CMrCylinderDoorFrontManager.GetInstance().mTopPart; CMrMark mrMark = new CMrMark(); double dblAngle = CCommonPara.mPartMarkAngle; mrMark.mModelObject = mMrPart.mPartInDrawing; if (mrTopPart != null) { if (maxY > mrTopPart.GetMaxYPoint().Y) { mrMark.mInsertPoint = mMrPart.GetMaxYPoint(); double increaseXDistance = CCommonPara.mPartMarkLength / Math.Tan(dblAngle); mrMark.mTextPoint.X = mrMark.mInsertPoint.X + increaseXDistance; mrMark.mTextPoint.Y = mrMark.mInsertPoint.Y + CCommonPara.mPartMarkLength; return(mrMark); } } if (minX > 0) { mrMark.mInsertPoint = mMrPart.mMidPoint; double increaseXDistance = CCommonPara.mPartMarkLength / Math.Tan(dblAngle); mrMark.mTextPoint.X = mrMark.mInsertPoint.X + increaseXDistance; mrMark.mTextPoint.Y = mrMark.mInsertPoint.Y - CCommonPara.mPartMarkLength; return(mrMark); } else if (minX < 0) { mrMark.mInsertPoint = mMrPart.mMidPoint; double increaseXDistance = CCommonPara.mPartMarkLength / Math.Tan(dblAngle); mrMark.mTextPoint.X = mrMark.mInsertPoint.X - increaseXDistance; mrMark.mTextPoint.Y = mrMark.mInsertPoint.Y - CCommonPara.mPartMarkLength; return(mrMark); } return(null); }
/// <summary> /// 获取零件标记; /// </summary> /// <returns></returns> public CMrMark GetPartMark() { CMrMark mrMark = new CMrMark(); Vector normal = mMrPart.mNormal; double minX = mMrPart.GetMinXPoint().X; double maxX = mMrPart.GetMaxXPoint().X; if (minX < 0 && maxX > 0) { return(null); } if (!CDimTools.GetInstance().IsTwoVectorParallel(normal, new Vector(0, 0, 1)) || !mMrPart.IsHaveBolt()) { return(null); } double dblAngle = CCommonPara.mPartMarkAngle; mrMark.mModelObject = mMrPart.mPartInDrawing; if (minX > 0) { mrMark.mInsertPoint = mMrPart.GetMaxXMaxYPoint(); double increaseXDistance = CCommonPara.mPartMarkLength / Math.Tan(dblAngle); mrMark.mTextPoint.X = mrMark.mInsertPoint.X + increaseXDistance; mrMark.mTextPoint.Y = mrMark.mInsertPoint.Y + 1.2 * CCommonPara.mPartMarkLength; return(mrMark); } if (maxX < 0) { mrMark.mInsertPoint = mMrPart.GetMinXMaxYPoint(); double increaseXDistance = CCommonPara.mPartMarkLength / Math.Tan(dblAngle); mrMark.mTextPoint.X = mrMark.mInsertPoint.X - increaseXDistance; mrMark.mTextPoint.Y = mrMark.mInsertPoint.Y + 1.2 * CCommonPara.mPartMarkLength; return(mrMark); } return(null); }
/// <summary> /// 获取零件法向与Z后平行的零件标记; /// </summary> /// <param name="mrPart"></param> /// <returns></returns> private CMrMark GetZNormalPartMark(CMrPart mrPart) { CMrMark mrMark = new CMrMark(); double dblAngle = CCommonPara.mPartMarkAngle; mrMark.mModelObject = mMrPart.mPartInDrawing; CMrPart mrRightPart = CMrCylinderDoorFrontManager.GetInstance().mRightPart; CMrPart mrRightTopPart = CMrCylinderDoorFrontManager.GetInstance().mRightTopPart; CMrPart mrRightTopMiddlePart = CMrCylinderDoorFrontManager.GetInstance().mRightTopMiddlePart; CMrPart mrLeftPart = CMrCylinderDoorFrontManager.GetInstance().mLeftPart; CMrPart mrLeftTopPart = CMrCylinderDoorFrontManager.GetInstance().mLeftTopPart; CMrPart mrLeftTopMiddlePart = CMrCylinderDoorFrontManager.GetInstance().mLeftTopMiddlePart; CMrPart mrYNormalBottomPart = CMrCylinderDoorFrontManager.GetInstance().mYNormalBottomPart; CMrPart mrTopPart = CMrCylinderDoorFrontManager.GetInstance().mTopPart; double minX = mMrPart.GetMinXPoint().X; double minY = mMrPart.GetMinYPoint().Y; double maxX = mMrPart.GetMaxXPoint().X; double maxY = mMrPart.GetMaxYPoint().Y; double yBottomPartMaxY = mrYNormalBottomPart.GetMaxYPoint().Y; //如果该零件存在于檩托板则不进行标记; CMrApronPlate mrApronPlate = CMrCylinderDoorFrontManager.GetInstance().FindMrApronPlateByZNormalPart(mMrPart); if (mrApronPlate != null) { return(null); } //1:如果零件的底部和主梁下面的零件顶部重合; if (CDimTools.GetInstance().CompareTwoDoubleValue(minY, yBottomPartMaxY) == 0) { if (minX > 0) { mrMark.mInsertPoint = mMrPart.GetMaxXMaxYPoint(); double increaseXDistance = CCommonPara.mPartMarkLength / Math.Tan(dblAngle); mrMark.mTextPoint.X = mrMark.mInsertPoint.X + increaseXDistance; mrMark.mTextPoint.Y = mrMark.mInsertPoint.Y + CCommonPara.mPartMarkLength; return(mrMark); } else { mrMark.mInsertPoint = mMrPart.GetMinXMaxYPoint(); double increaseXDistance = CCommonPara.mPartMarkLength / Math.Tan(dblAngle); mrMark.mTextPoint.X = mrMark.mInsertPoint.X - increaseXDistance; mrMark.mTextPoint.Y = mrMark.mInsertPoint.Y + CCommonPara.mPartMarkLength; return(mrMark); } } else if (CDimTools.GetInstance().CompareTwoDoubleValue(maxX, mrLeftPart.GetMinXPoint().X) <= 0) { Point insertPt = mMrPart.GetMinXMaxYPoint(); mrMark.mInsertPoint = new Point(insertPt.X, insertPt.Y - 20, 0); double increaseXDistance = CCommonPara.mPartMarkLength / Math.Tan(dblAngle); mrMark.mTextPoint.X = mrMark.mInsertPoint.X - increaseXDistance; mrMark.mTextPoint.Y = mrMark.mInsertPoint.Y - CCommonPara.mPartMarkLength; return(mrMark); } else if (CDimTools.GetInstance().CompareTwoDoubleValue(minX, mrRightPart.GetMaxXPoint().X) >= 0) { Point insertPt = mMrPart.GetMaxXMaxYPoint(); mrMark.mInsertPoint = new Point(insertPt.X, insertPt.Y - 20, 0); double increaseXDistance = CCommonPara.mPartMarkLength / Math.Tan(dblAngle); mrMark.mTextPoint.X = mrMark.mInsertPoint.X + increaseXDistance; mrMark.mTextPoint.Y = mrMark.mInsertPoint.Y - CCommonPara.mPartMarkLength; return(mrMark); } else if (mrLeftTopPart != null && minY > mrLeftTopPart.GetMinYPoint().Y&& CDimTools.GetInstance().CompareTwoDoubleValue(maxX, mrLeftTopPart.GetMaxXPoint().X) <= 0) { Point insertPt = mMrPart.GetMinXMaxYPoint(); mrMark.mInsertPoint = new Point(insertPt.X, insertPt.Y - 20, 0); double increaseXDistance = CCommonPara.mPartMarkLength / Math.Tan(dblAngle); mrMark.mTextPoint.X = mrMark.mInsertPoint.X - increaseXDistance; mrMark.mTextPoint.Y = mrMark.mInsertPoint.Y - CCommonPara.mPartMarkLength; return(mrMark); } else if (mrRightTopPart != null && minY > mrRightTopPart.GetMinYPoint().Y&& CDimTools.GetInstance().CompareTwoDoubleValue(minX, mrRightTopPart.GetMaxXPoint().X) >= 0) { Point insertPt = mMrPart.GetMaxXMaxYPoint(); mrMark.mInsertPoint = new Point(insertPt.X, insertPt.Y - 20, 0); double increaseXDistance = CCommonPara.mPartMarkLength / Math.Tan(dblAngle); mrMark.mTextPoint.X = mrMark.mInsertPoint.X + increaseXDistance; mrMark.mTextPoint.Y = mrMark.mInsertPoint.Y - CCommonPara.mPartMarkLength; return(mrMark); } else if (mrLeftTopMiddlePart != null && minY > mrLeftTopMiddlePart.GetMinYPoint().Y&& CDimTools.GetInstance().CompareTwoDoubleValue(maxX, mrLeftTopMiddlePart.GetMaxXPoint().X) <= 0) { Point insertPt = mMrPart.GetMinXMaxYPoint(); mrMark.mInsertPoint = new Point(insertPt.X, insertPt.Y - 20, 0); double increaseXDistance = CCommonPara.mPartMarkLength / Math.Tan(dblAngle); mrMark.mTextPoint.X = mrMark.mInsertPoint.X - increaseXDistance; mrMark.mTextPoint.Y = mrMark.mInsertPoint.Y - CCommonPara.mPartMarkLength; return(mrMark); } else if (mrRightTopMiddlePart != null && minY > mrRightTopMiddlePart.GetMinYPoint().Y&& CDimTools.GetInstance().CompareTwoDoubleValue(minX, mrRightTopMiddlePart.GetMaxXPoint().X) >= 0) { Point insertPt = mMrPart.GetMaxXMaxYPoint(); mrMark.mInsertPoint = new Point(insertPt.X, insertPt.Y - 20, 0); double increaseXDistance = CCommonPara.mPartMarkLength / Math.Tan(dblAngle); mrMark.mTextPoint.X = mrMark.mInsertPoint.X + increaseXDistance; mrMark.mTextPoint.Y = mrMark.mInsertPoint.Y - CCommonPara.mPartMarkLength; return(mrMark); } //如果是顶端法向与z轴平行的板; if (maxY > mrTopPart.GetMaxYPoint().Y) { if (minX > 0) { mrMark.mInsertPoint = mMrPart.mMidPoint; double increaseXDistance = CCommonPara.mPartMarkLength / Math.Tan(dblAngle); mrMark.mTextPoint.X = mrMark.mInsertPoint.X + increaseXDistance; mrMark.mTextPoint.Y = mrMark.mInsertPoint.Y + CCommonPara.mPartMarkLength; return(mrMark); } else { mrMark.mInsertPoint = mMrPart.mMidPoint; double increaseXDistance = CCommonPara.mPartMarkLength / Math.Tan(dblAngle); mrMark.mTextPoint.X = mrMark.mInsertPoint.X - increaseXDistance; mrMark.mTextPoint.Y = mrMark.mInsertPoint.Y + CCommonPara.mPartMarkLength; return(mrMark); } } return(null); }
/// <summary> /// 获取零件法向与Y轴平行的零件标记; /// </summary> /// <param name="mrPart"></param> /// <returns></returns> private CMrMark GetYNormalPartMark(CMrPart mrPart) { CMrMark mrMark = new CMrMark(); double dblAngle = CCommonPara.mPartMarkAngle; mrMark.mModelObject = mMrPart.mPartInDrawing; CMrPart mrRightPart = CMrCylinderDoorFrontManager.GetInstance().mRightPart; CMrPart mrRightTopPart = CMrCylinderDoorFrontManager.GetInstance().mRightTopPart; CMrPart mrRightTopMiddlePart = CMrCylinderDoorFrontManager.GetInstance().mRightTopMiddlePart; CMrPart mrLeftPart = CMrCylinderDoorFrontManager.GetInstance().mLeftPart; CMrPart mrLeftTopPart = CMrCylinderDoorFrontManager.GetInstance().mLeftTopPart; CMrPart mrLeftTopMiddlePart = CMrCylinderDoorFrontManager.GetInstance().mLeftTopMiddlePart; double minX = mMrPart.GetMinXPoint().X; double maxX = mMrPart.GetMaxXPoint().X; double minY = mMrPart.GetMinYPoint().Y; //如果该零件存在于檩托板则不进行标记; CMrApronPlate mrApronPlate = CMrCylinderDoorFrontManager.GetInstance().FindMrApronPlateByYNormalPart(mMrPart); if (mrApronPlate != null) { return(null); } if (CDimTools.GetInstance().CompareTwoDoubleValue(maxX, mrLeftPart.GetMinXPoint().X) <= 0) { mrMark.mInsertPoint = mMrPart.GetMinXMinYPoint(); double increaseXDistance = CCommonPara.mPartMarkLength / Math.Tan(dblAngle); mrMark.mTextPoint.X = mrMark.mInsertPoint.X - increaseXDistance; mrMark.mTextPoint.Y = mrMark.mInsertPoint.Y + CCommonPara.mPartMarkLength; return(mrMark); } else if (CDimTools.GetInstance().CompareTwoDoubleValue(minX, mrRightPart.GetMaxXPoint().X) >= 0) { mrMark.mInsertPoint = mMrPart.GetMaxXMinYPoint(); double increaseXDistance = CCommonPara.mPartMarkLength / Math.Tan(dblAngle); mrMark.mTextPoint.X = mrMark.mInsertPoint.X + increaseXDistance; mrMark.mTextPoint.Y = mrMark.mInsertPoint.Y + CCommonPara.mPartMarkLength; return(mrMark); } else if (mrLeftTopPart != null && minY > mrLeftTopPart.GetMinYPoint().Y&& CDimTools.GetInstance().CompareTwoDoubleValue(maxX, mrLeftTopPart.GetMaxXPoint().X) <= 0) { mrMark.mInsertPoint = mMrPart.GetMinXMinYPoint(); double increaseXDistance = CCommonPara.mPartMarkLength / Math.Tan(dblAngle); mrMark.mTextPoint.X = mrMark.mInsertPoint.X - increaseXDistance; mrMark.mTextPoint.Y = mrMark.mInsertPoint.Y + CCommonPara.mPartMarkLength; return(mrMark); } else if (mrRightTopPart != null && minY > mrRightTopPart.GetMinYPoint().Y&& CDimTools.GetInstance().CompareTwoDoubleValue(minX, mrRightTopPart.GetMaxXPoint().X) >= 0) { mrMark.mInsertPoint = mMrPart.GetMaxXMinYPoint(); double increaseXDistance = CCommonPara.mPartMarkLength / Math.Tan(dblAngle); mrMark.mTextPoint.X = mrMark.mInsertPoint.X + increaseXDistance; mrMark.mTextPoint.Y = mrMark.mInsertPoint.Y + CCommonPara.mPartMarkLength; return(mrMark); } else if (mrLeftTopMiddlePart != null && minY > mrLeftTopMiddlePart.GetMinYPoint().Y&& CDimTools.GetInstance().CompareTwoDoubleValue(maxX, mrLeftTopMiddlePart.GetMaxXPoint().X) <= 0) { mrMark.mInsertPoint = mMrPart.GetMinXMinYPoint(); double increaseXDistance = CCommonPara.mPartMarkLength / Math.Tan(dblAngle); mrMark.mTextPoint.X = mrMark.mInsertPoint.X - increaseXDistance; mrMark.mTextPoint.Y = mrMark.mInsertPoint.Y + CCommonPara.mPartMarkLength; return(mrMark); } else if (mrRightTopMiddlePart != null && minY > mrRightTopMiddlePart.GetMinYPoint().Y&& CDimTools.GetInstance().CompareTwoDoubleValue(minX, mrRightTopMiddlePart.GetMaxXPoint().X) >= 0) { mrMark.mInsertPoint = mMrPart.GetMaxXMinYPoint(); double increaseXDistance = CCommonPara.mPartMarkLength / Math.Tan(dblAngle); mrMark.mTextPoint.X = mrMark.mInsertPoint.X + increaseXDistance; mrMark.mTextPoint.Y = mrMark.mInsertPoint.Y + CCommonPara.mPartMarkLength; return(mrMark); } else if (IsYNormalPartInMainBeamMiddle(mMrPart)) { mrMark.mInsertPoint = mMrPart.GetMinXMinYPoint(); double increaseXDistance = CCommonPara.mPartMarkLength / Math.Tan(dblAngle); mrMark.mTextPoint.X = mrMark.mInsertPoint.X - increaseXDistance; mrMark.mTextPoint.Y = mrMark.mInsertPoint.Y - CCommonPara.mPartMarkLength; return(mrMark); } return(null); }
/// <summary> /// 获取零件法向与X轴平行的零件标记; /// </summary> /// <param name="mrPart"></param> /// <returns></returns> private CMrMark GerXNormalPartMark(CMrPart mrPart) { CMrMark mrMark = new CMrMark(); double dblAngle = CCommonPara.mPartMarkAngle; mrMark.mModelObject = mMrPart.mPartInDrawing; CMrPart mrYNormalBottomPart = CMrCylinderDoorFrontManager.GetInstance().mYNormalBottomPart; CMrPart mrRightPart = CMrCylinderDoorFrontManager.GetInstance().mRightPart; CMrPart mrRightTopPart = CMrCylinderDoorFrontManager.GetInstance().mRightTopPart; CMrPart mrRightTopMiddlePart = CMrCylinderDoorFrontManager.GetInstance().mRightTopMiddlePart; CMrPart mrLeftPart = CMrCylinderDoorFrontManager.GetInstance().mLeftPart; CMrPart mrLeftTopPart = CMrCylinderDoorFrontManager.GetInstance().mLeftTopPart; CMrPart mrLeftTopMiddlePart = CMrCylinderDoorFrontManager.GetInstance().mLeftTopMiddlePart; double minX = mMrPart.GetMinXPoint().X; double maxX = mMrPart.GetMaxXPoint().X; double minY = mMrPart.GetMinYPoint().Y; double yBottomPartMaxY = mrYNormalBottomPart.GetMaxYPoint().Y; //1.如果零件的底部和主梁下面的零件顶部重合; if (CDimTools.GetInstance().CompareTwoDoubleValue(minY, yBottomPartMaxY) == 0) { if (minX < 0) { mrMark.mInsertPoint = mMrPart.GetMinXMinYPoint(); double increaseXDistance = CCommonPara.mPartMarkLength / Math.Tan(dblAngle); mrMark.mTextPoint.X = mrMark.mInsertPoint.X - increaseXDistance; mrMark.mTextPoint.Y = mrMark.mInsertPoint.Y - CCommonPara.mPartMarkLength; return(mrMark); } else { mrMark.mInsertPoint = mMrPart.GetMaxXMinYPoint(); double increaseXDistance = CCommonPara.mPartMarkLength / Math.Tan(dblAngle); mrMark.mTextPoint.X = mrMark.mInsertPoint.X + increaseXDistance; mrMark.mTextPoint.Y = mrMark.mInsertPoint.Y - CCommonPara.mPartMarkLength; return(mrMark); } } else if (CDimTools.GetInstance().CompareTwoDoubleValue(maxX, mrLeftPart.GetMinXPoint().X) <= 0) { mrMark.mInsertPoint = mMrPart.GetMinXMinYPoint(); double increaseXDistance = CCommonPara.mPartMarkLength / Math.Tan(dblAngle); mrMark.mTextPoint.X = mrMark.mInsertPoint.X - increaseXDistance; mrMark.mTextPoint.Y = mrMark.mInsertPoint.Y - CCommonPara.mPartMarkLength; return(mrMark); } else if (CDimTools.GetInstance().CompareTwoDoubleValue(minX, mrRightPart.GetMaxXPoint().X) >= 0) { mrMark.mInsertPoint = mMrPart.GetMaxXMinYPoint(); double increaseXDistance = CCommonPara.mPartMarkLength / Math.Tan(dblAngle); mrMark.mTextPoint.X = mrMark.mInsertPoint.X + increaseXDistance; mrMark.mTextPoint.Y = mrMark.mInsertPoint.Y - CCommonPara.mPartMarkLength; return(mrMark); } else if (mrLeftTopPart != null && minY > mrLeftTopPart.GetMinYPoint().Y&& CDimTools.GetInstance().CompareTwoDoubleValue(maxX, mrLeftTopPart.GetMaxXPoint().X) <= 0) { mrMark.mInsertPoint = mMrPart.GetMinXMinYPoint(); double increaseXDistance = CCommonPara.mPartMarkLength / Math.Tan(dblAngle); mrMark.mTextPoint.X = mrMark.mInsertPoint.X - increaseXDistance; mrMark.mTextPoint.Y = mrMark.mInsertPoint.Y - CCommonPara.mPartMarkLength; return(mrMark); } else if (mrRightTopPart != null && minY > mrRightTopPart.GetMinYPoint().Y&& CDimTools.GetInstance().CompareTwoDoubleValue(minX, mrRightTopPart.GetMaxXPoint().X) >= 0) { mrMark.mInsertPoint = mMrPart.GetMaxXMinYPoint(); double increaseXDistance = CCommonPara.mPartMarkLength / Math.Tan(dblAngle); mrMark.mTextPoint.X = mrMark.mInsertPoint.X + increaseXDistance; mrMark.mTextPoint.Y = mrMark.mInsertPoint.Y - CCommonPara.mPartMarkLength; return(mrMark); } else if (mrLeftTopMiddlePart != null && minY > mrLeftTopMiddlePart.GetMinYPoint().Y&& CDimTools.GetInstance().CompareTwoDoubleValue(maxX, mrLeftTopMiddlePart.GetMaxXPoint().X) <= 0) { mrMark.mInsertPoint = mMrPart.GetMinXMinYPoint(); double increaseXDistance = CCommonPara.mPartMarkLength / Math.Tan(dblAngle); mrMark.mTextPoint.X = mrMark.mInsertPoint.X - increaseXDistance; mrMark.mTextPoint.Y = mrMark.mInsertPoint.Y - CCommonPara.mPartMarkLength; return(mrMark); } else if (mrRightTopMiddlePart != null && minY > mrRightTopMiddlePart.GetMinYPoint().Y&& CDimTools.GetInstance().CompareTwoDoubleValue(minX, mrRightTopMiddlePart.GetMaxXPoint().X) >= 0) { mrMark.mInsertPoint = mMrPart.GetMaxXMinYPoint(); double increaseXDistance = CCommonPara.mPartMarkLength / Math.Tan(dblAngle); mrMark.mTextPoint.X = mrMark.mInsertPoint.X + increaseXDistance; mrMark.mTextPoint.Y = mrMark.mInsertPoint.Y - CCommonPara.mPartMarkLength; return(mrMark); } return(null); }
/// <summary> /// 获取门式框架结构柱子中的零件标记; /// </summary> /// <returns></returns> public CMrMark GetPartMark() { CMrPart mrRightPart = CMrCylinderDoorFrontManager.GetInstance().mRightPart; CMrPart mrRightTopPart = CMrCylinderDoorFrontManager.GetInstance().mRightTopPart; CMrPart mrRightTopMiddlePart = CMrCylinderDoorFrontManager.GetInstance().mRightTopMiddlePart; CMrPart mrLeftPart = CMrCylinderDoorFrontManager.GetInstance().mLeftPart; CMrPart mrLeftTopPart = CMrCylinderDoorFrontManager.GetInstance().mLeftTopPart; CMrPart mrLeftTopMiddlePart = CMrCylinderDoorFrontManager.GetInstance().mLeftTopMiddlePart; CMrPart mrTopPart = CMrCylinderDoorFrontManager.GetInstance().mTopPart; CMrPart mrZNormalBottomPart = CMrCylinderDoorFrontManager.GetInstance().mZNormalBottomPart; CMrPart mrYNormalBottomPart = CMrCylinderDoorFrontManager.GetInstance().mYNormalBottomPart; Vector xVector = new Vector(1, 0, 0); Vector yVector = new Vector(0, 1, 0); Vector zVector = new Vector(0, 0, 1); Vector normal = mMrPart.mNormal; CMrMark mrMark = new CMrMark(); double dblAngle = CCommonPara.mPartMarkAngle; mrMark.mModelObject = mMrPart.mPartInDrawing; //0.如果是主梁; if (mMrPart == CMrMainBeam.GetInstance()) { mrMark.mInsertPoint = mMrPart.mMidPoint; double increaseXDistance = 2 * CCommonPara.mPartMarkLength / Math.Tan(dblAngle); mrMark.mTextPoint.X = mrMark.mInsertPoint.X - increaseXDistance; mrMark.mTextPoint.Y = mrMark.mInsertPoint.Y + 2 * CCommonPara.mPartMarkLength; return(mrMark); } //1.如果是左侧零部件或者是右侧零部件; if (mMrPart == mrLeftPart || mMrPart == mrRightPart) { return(null); } //2.如果是主梁底部零部件; if (mMrPart == mrZNormalBottomPart) { mrMark.mInsertPoint = mMrPart.GetMinYMinXPoint(); double increaseXDistance = CCommonPara.mPartMarkLength / Math.Tan(dblAngle); mrMark.mTextPoint.X = mrMark.mInsertPoint.X - increaseXDistance; mrMark.mTextPoint.Y = mrMark.mInsertPoint.Y - CCommonPara.mPartMarkLength; return(mrMark); } //3.如果是主梁顶部的零部件; else if (mMrPart == mrTopPart) { mrMark.mInsertPoint = mMrPart.GetMaxXMaxYPoint(); double increaseXDistance = CCommonPara.mPartMarkLength / Math.Tan(dblAngle); mrMark.mTextPoint.X = mrMark.mInsertPoint.X + increaseXDistance; mrMark.mTextPoint.Y = mrMark.mInsertPoint.Y + CCommonPara.mPartMarkLength; return(mrMark); } //4.如果是主梁左上侧零部件; else if (mMrPart == mrLeftTopPart) { mrMark.mInsertPoint = mMrPart.mMidPoint; double increaseXDistance = CCommonPara.mPartMarkLength / Math.Tan(dblAngle); mrMark.mTextPoint.X = mrMark.mInsertPoint.X - increaseXDistance; mrMark.mTextPoint.Y = mrMark.mInsertPoint.Y + CCommonPara.mPartMarkLength; return(mrMark); } //5.如果是主梁右上侧零部件; else if (mMrPart == mrRightTopPart) { mrMark.mInsertPoint = mMrPart.mMidPoint; double increaseXDistance = CCommonPara.mPartMarkLength / Math.Tan(dblAngle); mrMark.mTextPoint.X = mrMark.mInsertPoint.X + increaseXDistance; mrMark.mTextPoint.Y = mrMark.mInsertPoint.Y + CCommonPara.mPartMarkLength; return(mrMark); } //6.如果是主梁左上侧中间零部件; else if (mMrPart == mrLeftTopMiddlePart) { mrMark.mInsertPoint = mMrPart.GetMinXMinYPoint(); double increaseXDistance = CCommonPara.mPartMarkLength / Math.Tan(dblAngle); mrMark.mTextPoint.X = mrMark.mInsertPoint.X - increaseXDistance; mrMark.mTextPoint.Y = mrMark.mInsertPoint.Y - CCommonPara.mPartMarkLength; return(mrMark); } //7.如果是主梁右上侧中间零部件; else if (mMrPart == mrRightTopMiddlePart) { mrMark.mInsertPoint = mMrPart.GetMaxXMinYPoint(); double increaseXDistance = CCommonPara.mPartMarkLength / Math.Tan(dblAngle); mrMark.mTextPoint.X = mrMark.mInsertPoint.X + increaseXDistance; mrMark.mTextPoint.Y = mrMark.mInsertPoint.Y - CCommonPara.mPartMarkLength; return(mrMark); } //8.如果零件的向量与X轴平行; if (CDimTools.GetInstance().IsTwoVectorParallel(normal, xVector)) { mrMark = GerXNormalPartMark(mMrPart); return(mrMark); } //9.如果零件的向量与Y轴平行; else if (CDimTools.GetInstance().IsTwoVectorParallel(normal, yVector)) { mrMark = GetYNormalPartMark(mMrPart); return(mrMark); } //10.如果零件的向量与Z轴平行; else if (CDimTools.GetInstance().IsTwoVectorParallel(normal, zVector)) { mrMark = GetZNormalPartMark(mMrPart); return(mrMark); } //11.如果零件的法向在XY面内; else if (CDimTools.GetInstance().IsVectorInXYPlane(normal)) { mrMark = GetXYPlaneNormalPartMark(mMrPart); return(mrMark); } return(null); }
/// <summary> /// 获取上翼板是向两边弯曲时的零件标记; /// </summary> /// <returns></returns> public CMrMark GetPartMarkMiddle() { CMrPart topBeam = CMrBeamDoorManager.GetInstance().mTopBeam; CMrPart leftBeam = CMrBeamDoorManager.GetInstance().mLeftBeam; CMrPart rightBeam = CMrBeamDoorManager.GetInstance().mRightBeam; CMrPart leftBottomBeam = CMrBeamDoorManager.GetInstance().mLeftBottomBeam; CMrPart rightBottomBeam = CMrBeamDoorManager.GetInstance().mRightBottomBeam; Vector leftTopVector = CMrBeamDoorManager.GetInstance().mLeftTopVector; Vector rightTopVector = CMrBeamDoorManager.GetInstance().mRightTopVector; Point midMaxPoint = CMrBeamDoorManager.GetInstance().mMidMaxPoint; Vector leftDirectionVector = new Vector(midMaxPoint.X - topBeam.mLeftTopPoint.X, midMaxPoint.Y - topBeam.mLeftTopPoint.Y, 0); Vector rightDirectionVector = new Vector(midMaxPoint.X - topBeam.mRightTopPoint.X, midMaxPoint.Y - topBeam.mRightTopPoint.Y, 0); Point minY = mMrPart.GetMinYPoint(); Point maxY = mMrPart.GetMaxYPoint(); Vector normal = mMrPart.mNormal; CMrMark mrMark = new CMrMark(); double dblAngle = CCommonPara.mPartMarkAngle; mrMark.mModelObject = mMrPart.mPartInDrawing; if (mMrPart == leftBeam) { mrMark.mInsertPoint = mMrPart.mMidPoint; double increaseXDistance = 1.8 * CCommonPara.mPartMarkLength / Math.Tan(dblAngle); mrMark.mTextPoint.X = mrMark.mInsertPoint.X - increaseXDistance; mrMark.mTextPoint.Y = mrMark.mInsertPoint.Y + 1.8 * CCommonPara.mPartMarkLength; return(mrMark); } else if (mMrPart == rightBeam) { mrMark.mInsertPoint = mMrPart.mMidPoint; double increaseXDistance = 1.8 * CCommonPara.mPartMarkLength / Math.Tan(dblAngle); mrMark.mTextPoint.X = mrMark.mInsertPoint.X + increaseXDistance; mrMark.mTextPoint.Y = mrMark.mInsertPoint.Y + 1.8 * CCommonPara.mPartMarkLength; return(mrMark); } else if (mMrPart == leftBottomBeam || mMrPart == rightBottomBeam) { mrMark.mInsertPoint = mMrPart.mMidPoint; double increaseXDistance = 1.8 * CCommonPara.mPartMarkLength / Math.Tan(dblAngle); mrMark.mTextPoint.X = mrMark.mInsertPoint.X + increaseXDistance; mrMark.mTextPoint.Y = mrMark.mInsertPoint.Y - 1.8 * CCommonPara.mPartMarkLength; return(mrMark); } else if (mMrPart == topBeam) { mrMark.mInsertPoint = mMrPart.mMidPoint; double increaseXDistance = 0.5 * CCommonPara.mPartMarkLength / Math.Tan(dblAngle); mrMark.mTextPoint.X = mrMark.mInsertPoint.X + increaseXDistance; mrMark.mTextPoint.Y = mrMark.mInsertPoint.Y + 0.5 * CCommonPara.mPartMarkLength; return(mrMark); } //如果向量与Z轴平行; if (CDimTools.GetInstance().IsTwoVectorParallel(normal, new Vector(0, 0, 1))) { //如果是在上翼板的左上方; if (CDimTools.GetInstance().IsThePointOnLine(maxY, topBeam.mLeftTopPoint, midMaxPoint) > 0) { //如果是靠左侧挡板的那块板; if (CDimTools.GetInstance().CompareTwoDoubleValue(mMrPart.GetMaxYPoint().X, leftBeam.mRightTopPoint.X) == 0) { double x = mMrPart.GetMinXPoint().X + 20; double y = mMrPart.GetMinYPoint().Y + 20; Point insertPoint = new Point(x, y, 0); mrMark.mInsertPoint = insertPoint; double increaseXDistance = 1.2 * CCommonPara.mPartMarkLength / Math.Tan(dblAngle); mrMark.mTextPoint.X = mrMark.mInsertPoint.X + increaseXDistance; mrMark.mTextPoint.Y = mrMark.mInsertPoint.Y + 1.2 * CCommonPara.mPartMarkLength; return(mrMark); } else { if (mMrPart.mLeftTopPoint.X < midMaxPoint.X) { double x = mMrPart.GetMaxXPoint().X - 20; double y = mMrPart.GetMinYPoint().Y + 20; Point insertPoint = new Point(x, y, 0); mrMark.mInsertPoint = insertPoint; double increaseXDistance = CCommonPara.mPartMarkLength / Math.Tan(dblAngle); mrMark.mTextPoint.X = mrMark.mInsertPoint.X - increaseXDistance; mrMark.mTextPoint.Y = mrMark.mInsertPoint.Y + 0.8 * CCommonPara.mPartMarkLength; return(mrMark); } } } //如果在上翼板的右侧上方; if (CDimTools.GetInstance().IsThePointOnLine(maxY, midMaxPoint, topBeam.mRightTopPoint) > 0) { //如果是靠右侧挡板的那块板; if (CDimTools.GetInstance().CompareTwoDoubleValue(mMrPart.GetMaxYPoint().X, leftBeam.mRightTopPoint.X) == 0) { double x = mMrPart.GetMaxXPoint().X - 20; double y = mMrPart.GetMinYPoint().Y + 20; Point insertPoint = new Point(x, y, 0); mrMark.mInsertPoint = insertPoint; double increaseXDistance = 1.2 * CCommonPara.mPartMarkLength / Math.Tan(dblAngle); mrMark.mTextPoint.X = mrMark.mInsertPoint.X + increaseXDistance; mrMark.mTextPoint.Y = mrMark.mInsertPoint.Y + 1.2 * CCommonPara.mPartMarkLength; return(mrMark); } else { if (mMrPart.mLeftTopPoint.X > midMaxPoint.X) { double x = mMrPart.GetMinXPoint().X + 20; double y = mMrPart.GetMinYPoint().Y + 20; Point insertPoint = new Point(x, y, 0); mrMark.mInsertPoint = insertPoint; double increaseXDistance = CCommonPara.mPartMarkLength / Math.Tan(dblAngle); mrMark.mTextPoint.X = mrMark.mInsertPoint.X + increaseXDistance; mrMark.mTextPoint.Y = mrMark.mInsertPoint.Y + 0.8 * CCommonPara.mPartMarkLength; return(mrMark); } } } //如果是在下翼板的下方; if (CDimTools.GetInstance().IsThePointOnLine(minY, leftBeam.mLeftTopPoint, leftBeam.mRightTopPoint) < 0) { if (CDimTools.GetInstance().CompareTwoDoubleValue(mMrPart.GetMinYPoint().X, leftBeam.mRightBottomPoint.X) == 0) { double x = mMrPart.GetMinXPoint().X + 20; double y = mMrPart.GetMaxYPoint().Y - 20; Point insertPoint = new Point(x, y, 0); mrMark.mInsertPoint = insertPoint; double increaseXDistance = 1.4 * CCommonPara.mPartMarkLength / Math.Tan(dblAngle); mrMark.mTextPoint.X = mrMark.mInsertPoint.X + increaseXDistance; mrMark.mTextPoint.Y = mrMark.mInsertPoint.Y - 1.4 * CCommonPara.mPartMarkLength; return(mrMark); } if (CDimTools.GetInstance().CompareTwoDoubleValue(mMrPart.GetMinYPoint().X, rightBeam.mLeftBottomPoint.X) == 0) { double x = mMrPart.GetMaxXPoint().X - 20; double y = mMrPart.GetMaxYPoint().Y - 20; Point insertPoint = new Point(x, y, 0); mrMark.mInsertPoint = insertPoint; double increaseXDistance = 1.4 * CCommonPara.mPartMarkLength / Math.Tan(dblAngle); mrMark.mTextPoint.X = mrMark.mInsertPoint.X + increaseXDistance; mrMark.mTextPoint.Y = mrMark.mInsertPoint.Y - 1.4 * CCommonPara.mPartMarkLength; return(mrMark); } } } //如果法向与X轴平行; else if (CDimTools.GetInstance().IsTwoVectorParallel(normal, new Vector(1, 0, 0))) { if (mMrPart.mLeftBottomPoint.X < midMaxPoint.X) { mrMark.mInsertPoint = mMrPart.mRightBottomPoint; double increaseXDistance = CCommonPara.mPartMarkLength / Math.Tan(dblAngle); mrMark.mTextPoint.X = mrMark.mInsertPoint.X - increaseXDistance; mrMark.mTextPoint.Y = mrMark.mInsertPoint.Y - CCommonPara.mPartMarkLength; return(mrMark); } else if (mMrPart.mLeftBottomPoint.X > midMaxPoint.X) { mrMark.mInsertPoint = mMrPart.mRightBottomPoint; double increaseXDistance = CCommonPara.mPartMarkLength / Math.Tan(dblAngle); mrMark.mTextPoint.X = mrMark.mInsertPoint.X + increaseXDistance; mrMark.mTextPoint.Y = mrMark.mInsertPoint.Y - CCommonPara.mPartMarkLength; return(mrMark); } } //如果法向与Y轴平行; else if (CDimTools.GetInstance().IsTwoVectorParallel(normal, new Vector(0, 1, 0))) { mrMark.mInsertPoint = mMrPart.mMidPoint; double increaseXDistance = CCommonPara.mPartMarkLength / Math.Tan(dblAngle); mrMark.mTextPoint.X = mrMark.mInsertPoint.X + increaseXDistance; mrMark.mTextPoint.Y = mrMark.mInsertPoint.Y - CCommonPara.mPartMarkLength; return(mrMark); } //如果法向量与上翼板左侧的法向垂直; else if (CDimTools.GetInstance().IsTwoVectorParallel(normal, leftDirectionVector) || CDimTools.GetInstance().IsTwoVectorParallel(normal, rightDirectionVector)) { //如果在上翼板左侧上方; if (CDimTools.GetInstance().IsThePointOnLine(maxY, topBeam.mLeftTopPoint, midMaxPoint) > 0) { if (mMrPart.mLeftTopPoint.X < midMaxPoint.X) { mrMark.mInsertPoint = mMrPart.mRightTopPoint; double increaseXDistance = 1.2 * CCommonPara.mPartMarkLength / Math.Tan(dblAngle); mrMark.mTextPoint.X = mrMark.mInsertPoint.X - increaseXDistance; mrMark.mTextPoint.Y = mrMark.mInsertPoint.Y + 1.2 * CCommonPara.mPartMarkLength; return(mrMark); } } //如果在下翼板左侧上方; else if (CDimTools.GetInstance().IsThePointOnLine(maxY, leftBottomBeam.mLeftTopPoint, leftBottomBeam.mRightTopPoint) > 0) { if (mMrPart.mLeftTopPoint.X < midMaxPoint.X) { mrMark.mInsertPoint = mMrPart.mRightBottomPoint; double increaseXDistance = CCommonPara.mPartMarkLength / Math.Tan(dblAngle); mrMark.mTextPoint.X = mrMark.mInsertPoint.X - increaseXDistance; mrMark.mTextPoint.Y = mrMark.mInsertPoint.Y - 1.2 * CCommonPara.mPartMarkLength; return(mrMark); } } //如果在上翼板右侧上方; if (CDimTools.GetInstance().IsThePointOnLine(maxY, topBeam.mRightTopPoint, midMaxPoint) > 0) { if (mMrPart.mLeftTopPoint.X > midMaxPoint.X) { mrMark.mInsertPoint = mMrPart.mRightTopPoint; double increaseXDistance = 1.2 * CCommonPara.mPartMarkLength / Math.Tan(dblAngle); mrMark.mTextPoint.X = mrMark.mInsertPoint.X + increaseXDistance; mrMark.mTextPoint.Y = mrMark.mInsertPoint.Y + 1.2 * CCommonPara.mPartMarkLength; return(mrMark); } } //如果在下翼板右侧上方; else if (CDimTools.GetInstance().IsThePointOnLine(maxY, rightBottomBeam.mLeftTopPoint, rightBottomBeam.mRightTopPoint) > 0) { if (mMrPart.mLeftTopPoint.X > midMaxPoint.X) { mrMark.mInsertPoint = mMrPart.mRightBottomPoint; double increaseXDistance = CCommonPara.mPartMarkLength / Math.Tan(dblAngle); mrMark.mTextPoint.X = mrMark.mInsertPoint.X + increaseXDistance; mrMark.mTextPoint.Y = mrMark.mInsertPoint.Y - 1.2 * CCommonPara.mPartMarkLength; return(mrMark); } } } //如果法向与左右向上的法向平行并且有螺钉; else if ((CDimTools.GetInstance().IsTwoVectorVertical(normal, leftDirectionVector) || CDimTools.GetInstance().IsTwoVectorVertical(normal, rightDirectionVector)) && mMrPart.IsHaveBolt()) { mrMark.mInsertPoint = mMrPart.mRightBottomPoint; double increaseXDistance = CCommonPara.mPartMarkLength / Math.Tan(dblAngle); mrMark.mTextPoint.X = mrMark.mInsertPoint.X + increaseXDistance; mrMark.mTextPoint.Y = mrMark.mInsertPoint.Y - CCommonPara.mPartMarkLength; return(mrMark); } return(null); }
/// <summary> /// 获取上翼板左斜或者右斜时的零件标记; /// </summary> /// <returns></returns> public CMrMark GetPartMarkNormal() { CMrPart topBeam = CMrBeamDoorManager.GetInstance().mTopBeam; CMrPart bottomBeam = CMrBeamDoorManager.GetInstance().mBottonBeam; CMrPart leftBeam = CMrBeamDoorManager.GetInstance().mLeftBeam; CMrPart rightBeam = CMrBeamDoorManager.GetInstance().mRightBeam; Point minY = mMrPart.GetMinYPoint(); Point maxY = mMrPart.GetMaxYPoint(); Vector normal = mMrPart.mNormal; CMrMark mrMark = new CMrMark(); double dblAngle = CCommonPara.mPartMarkAngle; mrMark.mModelObject = mMrPart.mPartInDrawing; if (mMrPart == leftBeam) { mrMark.mInsertPoint = mMrPart.mMidPoint; double increaseXDistance = 1.8 * CCommonPara.mPartMarkLength / Math.Tan(dblAngle); mrMark.mTextPoint.X = mrMark.mInsertPoint.X - increaseXDistance; mrMark.mTextPoint.Y = mrMark.mInsertPoint.Y + 1.8 * CCommonPara.mPartMarkLength; return(mrMark); } if (mMrPart == rightBeam) { mrMark.mInsertPoint = mMrPart.mMidPoint; double increaseXDistance = 1.8 * CCommonPara.mPartMarkLength / Math.Tan(dblAngle); mrMark.mTextPoint.X = mrMark.mInsertPoint.X + increaseXDistance; mrMark.mTextPoint.Y = mrMark.mInsertPoint.Y + 1.8 * CCommonPara.mPartMarkLength; return(mrMark); } if (mMrPart == topBeam || mMrPart == bottomBeam) { mrMark.mInsertPoint = mMrPart.mMidPoint; double increaseXDistance = CCommonPara.mPartMarkLength / Math.Tan(dblAngle); mrMark.mTextPoint.X = mrMark.mInsertPoint.X + increaseXDistance; mrMark.mTextPoint.Y = mrMark.mInsertPoint.Y - CCommonPara.mPartMarkLength; return(mrMark); } //如果向量与Z轴平行; if (CDimTools.GetInstance().IsTwoVectorParallel(normal, new Vector(0, 0, 1))) { //如果是在上翼板的上方; if (CDimTools.GetInstance().IsThePointOnLine(maxY, topBeam.mLeftTopPoint, topBeam.mRightTopPoint) > 0) { //1.如果是靠右侧挡板的那块板; if (Math.Abs(mMrPart.GetMaxYPoint().X - rightBeam.mLeftTopPoint.X) < 5) { double x = mMrPart.GetMaxXPoint().X - 20; double y = mMrPart.GetMinYPoint().Y + 20; Point insertPoint = new Point(x, y, 0); mrMark.mInsertPoint = insertPoint; double increaseXDistance = 1.2 * CCommonPara.mPartMarkLength / Math.Tan(dblAngle); mrMark.mTextPoint.X = mrMark.mInsertPoint.X + increaseXDistance; mrMark.mTextPoint.Y = mrMark.mInsertPoint.Y + 1.2 * CCommonPara.mPartMarkLength; return(mrMark); } //2.如果是靠左侧挡板的那块板; if (Math.Abs(mMrPart.GetMaxYPoint().X - leftBeam.mRightTopPoint.X) < 5) { double x = mMrPart.GetMaxXPoint().X - 20; double y = mMrPart.GetMinYPoint().Y + 20; Point insertPoint = new Point(x, y, 0); mrMark.mInsertPoint = insertPoint; double increaseXDistance = 1.2 * CCommonPara.mPartMarkLength / Math.Tan(dblAngle); mrMark.mTextPoint.X = mrMark.mInsertPoint.X - increaseXDistance; mrMark.mTextPoint.Y = mrMark.mInsertPoint.Y + 1.2 * CCommonPara.mPartMarkLength; return(mrMark); } else { MrSlopeType mrSlopeType = CDimTools.GetInstance().JudgeLineSlope(new Point(0, 0, 0), topBeam.mNormal); if (mrSlopeType == MrSlopeType.MORETHAN_ZERO) { double x = mMrPart.GetMinXPoint().X + 20; double y = mMrPart.GetMinYPoint().Y + 20; Point insertPoint = new Point(x, y, 0); mrMark.mInsertPoint = insertPoint; double increaseXDistance = CCommonPara.mPartMarkLength / Math.Tan(dblAngle); mrMark.mTextPoint.X = mrMark.mInsertPoint.X + 1.1 * increaseXDistance; mrMark.mTextPoint.Y = mrMark.mInsertPoint.Y + 0.8 * CCommonPara.mPartMarkLength; return(mrMark); } else if (mrSlopeType == MrSlopeType.LESSTHAN_ZERO) { double x = mMrPart.GetMinXPoint().X + 20; double y = mMrPart.GetMinYPoint().Y + 20; Point insertPoint = new Point(x, y, 0); mrMark.mInsertPoint = insertPoint; double increaseXDistance = CCommonPara.mPartMarkLength / Math.Tan(dblAngle); mrMark.mTextPoint.X = mrMark.mInsertPoint.X - 1.1 * increaseXDistance; mrMark.mTextPoint.Y = mrMark.mInsertPoint.Y + 0.8 * CCommonPara.mPartMarkLength; return(mrMark); } } } //如果在下翼板下方; if (CDimTools.GetInstance().IsThePointOnLine(minY, bottomBeam.mLeftBottomPoint, bottomBeam.mRightBottomPoint) < 0) { //1.如果是靠右侧挡板的那块板; if (Math.Abs(mMrPart.GetMinYPoint().X - rightBeam.mLeftBottomPoint.X) < 5) { double x = mMrPart.GetMaxXPoint().X - 20; double y = mMrPart.GetMaxYPoint().Y - 20; Point insertPoint = new Point(x, y, 0); mrMark.mInsertPoint = insertPoint; double increaseXDistance = 1.2 * CCommonPara.mPartMarkLength / Math.Tan(dblAngle); mrMark.mTextPoint.X = mrMark.mInsertPoint.X + increaseXDistance; mrMark.mTextPoint.Y = mrMark.mInsertPoint.Y - 1.2 * CCommonPara.mPartMarkLength; return(mrMark); } //2.如果是靠左侧挡板的那块板; else if (Math.Abs(mMrPart.GetMinYPoint().X - leftBeam.mRightBottomPoint.X) < 5) { double x = mMrPart.GetMaxXPoint().X - 20; double y = mMrPart.GetMaxYPoint().Y - 20; Point insertPoint = new Point(x, y, 0); mrMark.mInsertPoint = insertPoint; double increaseXDistance = 1.2 * CCommonPara.mPartMarkLength / Math.Tan(dblAngle); mrMark.mTextPoint.X = mrMark.mInsertPoint.X - increaseXDistance; mrMark.mTextPoint.Y = mrMark.mInsertPoint.Y - 1.2 * CCommonPara.mPartMarkLength; return(mrMark); } else { double x = mMrPart.GetMinXPoint().X + 20; double y = mMrPart.GetMaxYPoint().Y - 20; Point insertPoint = new Point(x, y, 0); mrMark.mInsertPoint = insertPoint; double increaseXDistance = CCommonPara.mPartMarkLength / Math.Tan(dblAngle); mrMark.mTextPoint.X = mrMark.mInsertPoint.X + 1.1 * increaseXDistance; mrMark.mTextPoint.Y = mrMark.mInsertPoint.Y - 0.8 * CCommonPara.mPartMarkLength; return(mrMark); } } } else if (CDimTools.GetInstance().IsTwoVectorParallel(normal, new Vector(1, 0, 0))) { mrMark.mInsertPoint = mMrPart.mRightBottomPoint; double increaseXDistance = CCommonPara.mPartMarkLength / Math.Tan(dblAngle); mrMark.mTextPoint.X = mrMark.mInsertPoint.X + increaseXDistance; mrMark.mTextPoint.Y = mrMark.mInsertPoint.Y - CCommonPara.mPartMarkLength; return(mrMark); } //如果法向量与上翼板的法向垂直; else if (CDimTools.GetInstance().IsTwoVectorVertical(normal, topBeam.mNormal)) { //如果在上翼板的上方; if (CDimTools.GetInstance().IsThePointOnLine(maxY, topBeam.mLeftTopPoint, topBeam.mRightTopPoint) > 0) { MrSlopeType mrSlopeType = CDimTools.GetInstance().JudgeLineSlope(new Point(0, 0, 0), topBeam.mNormal); if (mrSlopeType == MrSlopeType.MORETHAN_ZERO) { mrMark.mInsertPoint = mMrPart.mRightTopPoint; double increaseXDistance = 1.2 * CCommonPara.mPartMarkLength / Math.Tan(dblAngle); mrMark.mTextPoint.X = mrMark.mInsertPoint.X + increaseXDistance; mrMark.mTextPoint.Y = mrMark.mInsertPoint.Y + 1.2 * CCommonPara.mPartMarkLength; return(mrMark); } else if (mrSlopeType == MrSlopeType.LESSTHAN_ZERO) { mrMark.mInsertPoint = mMrPart.mRightTopPoint; double increaseXDistance = 1.2 * CCommonPara.mPartMarkLength / Math.Tan(dblAngle); mrMark.mTextPoint.X = mrMark.mInsertPoint.X - increaseXDistance; mrMark.mTextPoint.Y = mrMark.mInsertPoint.Y + 1.2 * CCommonPara.mPartMarkLength; return(mrMark); } } else if (CDimTools.GetInstance().IsThePointOnLine(maxY, bottomBeam.mLeftTopPoint, bottomBeam.mRightTopPoint) > 0) { mrMark.mInsertPoint = mMrPart.mRightBottomPoint; double increaseXDistance = CCommonPara.mPartMarkLength / Math.Tan(dblAngle); mrMark.mTextPoint.X = mrMark.mInsertPoint.X + increaseXDistance; mrMark.mTextPoint.Y = mrMark.mInsertPoint.Y - 1.2 * CCommonPara.mPartMarkLength; return(mrMark); } } else if (CDimTools.GetInstance().IsTwoVectorParallel(normal, topBeam.mNormal) && mMrPart.IsHaveBolt()) { mrMark.mInsertPoint = mMrPart.mRightBottomPoint; double increaseXDistance = CCommonPara.mPartMarkLength / Math.Tan(dblAngle); mrMark.mTextPoint.X = mrMark.mInsertPoint.X + increaseXDistance; mrMark.mTextPoint.Y = mrMark.mInsertPoint.Y - CCommonPara.mPartMarkLength; return(mrMark); } return(null); }