コード例 #1
0
        /// <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);
        }
コード例 #2
0
        /// <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);
        }
コード例 #3
0
        /// <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);
        }
コード例 #4
0
        /// <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);
            }
        }
コード例 #5
0
        /// <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);
        }
コード例 #6
0
        /// <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);
        }
コード例 #7
0
        /// <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);
        }
コード例 #8
0
        /// <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);
            }
        }
コード例 #9
0
        /// <summary>
        /// 获取顶部零件的标注集;
        /// </summary>
        /// <param name="nFlag">1:左侧,2:右侧</param>
        /// <returns></returns>
        private CMrDimSet GetTopPartDimSet(int nFlag)
        {
            CMrDimSet mrDimSet = new CMrDimSet();

            CMrPart mrTopPart      = CMrCylinderDoorFrontManager.GetInstance().mTopPart;
            CMrPart mrLeftTopPart  = CMrCylinderDoorFrontManager.GetInstance().mLeftTopPart;
            CMrPart mrRightTopPart = CMrCylinderDoorFrontManager.GetInstance().mRightTopPart;

            //标注顶板右侧的情况;
            if (nFlag == 2)
            {
                //如果顶部零件为空,则把主梁最上面的点加入进去;
                if (mrTopPart == null)
                {
                    mrDimSet.AddPoint(mMainBeam.GetMaxYMaxXPoint());
                    return(mrDimSet);
                }

                Vector normal = mrTopPart.mNormal;

                if (CDimTools.GetInstance().IsTwoVectorParallel(normal, new Vector(0, 1, 0)))
                {
                    mrDimSet.AddPoint(mrTopPart.GetMaxXMaxYPoint());
                    mrDimSet.AddPoint(mrTopPart.GetMaxXMinYPoint());
                }
                else
                {
                    if (mrLeftTopPart != null && mrRightTopPart != null)
                    {
                        if (mrLeftTopPart.GetMaxYPoint().Y > mrRightTopPart.GetMaxYPoint().Y)
                        {
                            mrDimSet.AddPoint(mrLeftTopPart.GetMaxXMaxYPoint());
                        }
                        else
                        {
                            mrDimSet.AddPoint(mrRightTopPart.GetMaxXMaxYPoint());
                        }
                    }
                    else if (mrLeftTopPart != null)
                    {
                        mrDimSet.AddPoint(mrLeftTopPart.GetMaxXMaxYPoint());
                    }
                    else if (mrRightTopPart != null)
                    {
                        mrDimSet.AddPoint(mrRightTopPart.GetMinXMaxYPoint());
                    }
                }
            }
            //标注顶板左侧的情况;
            else if (nFlag == 1)
            {
                if (mrTopPart == null)
                {
                    mrDimSet.AddPoint(mMainBeam.GetMaxYMinXPoint());
                    return(mrDimSet);
                }

                Vector normal = mrTopPart.mNormal;

                if (CDimTools.GetInstance().IsTwoVectorParallel(normal, new Vector(0, 1, 0)))
                {
                    mrDimSet.AddPoint(mrTopPart.GetMinXMaxYPoint());
                    mrDimSet.AddPoint(mrTopPart.GetMinXMinYPoint());
                }
                else
                {
                    if (mrLeftTopPart != null && mrRightTopPart != null)
                    {
                        if (mrLeftTopPart.GetMaxYPoint().Y > mrRightTopPart.GetMaxYPoint().Y)
                        {
                            mrDimSet.AddPoint(mrLeftTopPart.GetMaxXMaxYPoint());
                        }
                        else
                        {
                            mrDimSet.AddPoint(mrRightTopPart.GetMinXMaxYPoint());
                        }
                    }
                    else if (mrLeftTopPart != null)
                    {
                        mrDimSet.AddPoint(mrLeftTopPart.GetMaxXMaxYPoint());
                    }
                    else if (mrRightTopPart != null)
                    {
                        mrDimSet.AddPoint(mrRightTopPart.GetMinXMaxYPoint());
                    }
                }
            }

            return(mrDimSet);
        }
コード例 #10
0
        /// <summary>
        /// 绘制主梁法向朝Y方向的剖面标注;
        /// </summary>
        private void DrawYVectorSectionDim()
        {
            Vector zVector = new Vector(0, 0, 1);
            Vector yVector = new Vector(0, 1, 0);
            Vector xVector = new Vector(1, 0, 0);

            foreach (CMrPart mrPart in mMrPartList)
            {
                Vector normal = mrPart.mNormal;

                if (CDimTools.GetInstance().IsTwoVectorParallel(normal, new Vector(0, 0, 1)) && mrPart.IsHaveBolt())
                {
                    double minY = mrPart.GetMinYPoint().Y;
                    double maxY = mrPart.GetMaxYPoint().Y;

                    //如果零件在X轴上方或者下方;
                    if (minY > 0 || maxY < 0)
                    {
                        List <CMrBoltArray> mrBoltArrayList = mrPart.GetBoltArrayList();

                        CMrBoltArray mrBoltArray       = mrBoltArrayList[0];
                        List <Point> maxYBoltPointList = mrBoltArray.GetMaxYPointList();
                        List <Point> maxXBoltPointList = mrBoltArray.GetMaxXPointList();

                        Vector dimVector = null;

                        if (minY > 0)
                        {
                            dimVector = new Vector(0, 1, 0);
                        }
                        if (maxY < 0)
                        {
                            dimVector = new Vector(0, -1, 0);
                        }

                        //标注零部件的顶侧标注;
                        CMrDimSet mrDimSet = new CMrDimSet();

                        mrDimSet.AddPoint(mrPart.GetMinXMaxYPoint());
                        mrDimSet.AddPoint(mrPart.GetMaxXMaxYPoint());
                        mrDimSet.AddRange(maxYBoltPointList);
                        mrDimSet.mDimDistance = 1.2 * CCommonPara.mDefaultDimDistance;
                        mrDimSet.mDimVector   = dimVector;

                        CreateDimByMrDimSet(mrDimSet);

                        //标注零部件的右侧标注;
                        mrDimSet = new CMrDimSet();
                        mrDimSet.AddRange(maxXBoltPointList);
                        mrDimSet.AddPoint(new Point(maxXBoltPointList[0].X, 0, 0));
                        mrDimSet.mDimDistance = 1.5 * CCommonPara.mDefaultDimDistance;
                        mrDimSet.mDimVector   = xVector;

                        CreateDimByMrDimSet(mrDimSet);
                    }
                    else if (minY < 0 && maxY > 0)
                    {
                        List <CMrBoltArray> mrBoltArrayList = mrPart.GetBoltArrayList();

                        CMrBoltArray mrBoltArray       = mrBoltArrayList[0];
                        List <Point> maxYBoltPointList = mrBoltArray.GetMaxYPointList();
                        List <Point> maxXBoltPointList = mrBoltArray.GetMaxXPointList();

                        //标注零部件的顶侧标注;
                        CMrDimSet mrDimSet = new CMrDimSet();

                        mrDimSet.AddRange(maxYBoltPointList);
                        mrDimSet.AddPoint(mrPart.GetMinXMaxYPoint());
                        mrDimSet.AddPoint(mrPart.GetMaxXMaxYPoint());
                        mrDimSet.mDimDistance = 1.2 * CCommonPara.mDefaultDimDistance;
                        mrDimSet.mDimVector   = yVector;

                        CreateDimByMrDimSet(mrDimSet);

                        //标注零部件的右侧标注;
                        mrDimSet = new CMrDimSet();
                        mrDimSet.AddPoint(mrPart.GetMaxXMaxYPoint());
                        mrDimSet.AddPoint(mrPart.GetMaxXMinYPoint());
                        mrDimSet.AddRange(maxXBoltPointList);
                        mrDimSet.AddPoint(new Point(maxXBoltPointList[0].X, 0, 0));
                        mrDimSet.mDimDistance = 1.2 * CCommonPara.mDefaultDimDistance;
                        mrDimSet.mDimVector   = xVector;

                        CreateDimByMrDimSet(mrDimSet);
                    }
                }
            }
        }