Example #1
0
        /// <summary>
        /// 创建所有剖面;
        /// </summary>
        private void CreateAllPartSection()
        {
            double mainBeamMinX = CMrMainBeam.GetInstance().GetMinXPoint().X;
            double mainBeamMaxX = CMrMainBeam.GetInstance().GetMaxXPoint().X;
            double mainBeamMinY = CMrMainBeam.GetInstance().GetMinYPoint().Y;

            CMrPart leftTopPart  = CMrCylinderDoorFrontManager.GetInstance().mLeftTopPart;
            CMrPart rightTopPart = CMrCylinderDoorFrontManager.GetInstance().mRightTopPart;

            bool bFlag = false;

            CDimTools.GetInstance().SortMrPartByMaxY(mAllSectionPartList);

            foreach (CMrPart mrPart in mAllSectionPartList)
            {
                double partMinX = mrPart.GetMinXPoint().X;
                double partMaxX = mrPart.GetMaxXPoint().X;
                double partMinY = mrPart.GetMinYPoint().Y;

                Vector     normal    = mrPart.mNormal;
                CMrSection mrSection = new CMrSection(MrSectionType.MrSectionCylinder);
                mrSection.AppendSectionPart(mrPart);

                if (mrPart == leftTopPart || mrPart == rightTopPart)
                {
                    Point minXPt = mrPart.GetMinXPoint();
                    Point maxXpt = mrPart.GetMaxXPoint();
                    Point minYPt = mrPart.GetMinYPoint();
                    Point maxYpt = mrPart.GetMaxYPoint();
                    mrSection.mSectionMaxY = maxYpt.Y;
                    mrSection.mSectionMinY = minYPt.Y;
                    mrSection.mSectionMidX = minXPt.X;
                    mrSection.mSectionMode = MrSectionMode.MrHorizontal;
                }
                else if (CDimTools.GetInstance().IsTwoVectorParallel(normal, new Vector(1, 0, 0)))
                {
                    if (CDimTools.GetInstance().CompareTwoDoubleValue(partMaxX, mainBeamMinX) < 0 ||
                        CDimTools.GetInstance().CompareTwoDoubleValue(partMinX, mainBeamMaxX) > 0)
                    {
                        Point minXPt = mrPart.GetMinXPoint();
                        Point maxXpt = mrPart.GetMaxXPoint();
                        Point minYPt = mrPart.GetMinYPoint();
                        Point maxYpt = mrPart.GetMaxYPoint();
                        mrSection.mSectionMaxY = maxYpt.Y;
                        mrSection.mSectionMinY = minYPt.Y;
                        mrSection.mSectionMidX = (minXPt.X + maxXpt.X) / 2.0;
                        mrSection.mSectionMode = MrSectionMode.MrHorizontal;
                    }
                    else if (CDimTools.GetInstance().CompareTwoDoubleValue(partMinX, mainBeamMinX) > 0 &&
                             CDimTools.GetInstance().CompareTwoDoubleValue(partMaxX, mainBeamMaxX) < 0 &&
                             CDimTools.GetInstance().CompareTwoDoubleValue(partMinY, mainBeamMinY) > 0)
                    {
                        Point minXPt = mrPart.GetMinXPoint();
                        Point maxXpt = mrPart.GetMaxXPoint();
                        Point minYPt = mrPart.GetMinYPoint();
                        Point maxYpt = mrPart.GetMaxYPoint();
                        mrSection.mSectionMidX = (minXPt.X + maxXpt.X) / 2.0;
                        mrSection.mSectionMidY = maxYpt.Y;
                        mrSection.mSectionMode = MrSectionMode.MrVertical;
                    }
                }
                else if (CDimTools.GetInstance().IsTwoVectorParallel(normal, new Vector(0, 1, 0)))
                {
                    if (CDimTools.GetInstance().CompareTwoDoubleValue(partMaxX, mainBeamMinX) < 0 ||
                        CDimTools.GetInstance().CompareTwoDoubleValue(partMinX, mainBeamMaxX) > 0)
                    {
                        Point minYPt = mrPart.GetMinYPoint();
                        Point maxYpt = mrPart.GetMaxYPoint();
                        mrSection.mSectionMidY = (minYPt.Y + maxYpt.Y) / 2.0;
                        mrSection.mSectionMode = MrSectionMode.MrVertical;
                    }
                    if (CDimTools.GetInstance().CompareTwoDoubleValue(partMinX, mainBeamMinX) < 0 &&
                        CDimTools.GetInstance().CompareTwoDoubleValue(partMaxX, mainBeamMaxX) > 0)
                    {
                        Point minYPt = mrPart.GetMinYPoint();
                        Point maxYpt = mrPart.GetMaxYPoint();
                        mrSection.mSectionMidY = (minYPt.Y + maxYpt.Y) / 2.0;
                        mrSection.mSectionMode = MrSectionMode.MrVertical;
                    }
                    if (CDimTools.GetInstance().CompareTwoDoubleValue(partMinX, mainBeamMinX) > 0 &&
                        CDimTools.GetInstance().CompareTwoDoubleValue(partMaxX, mainBeamMaxX) < 0)
                    {
                        CMrApronPlate mrApronPlate = CMrCylinderDoorFrontManager.GetInstance().FindMrApronPlate2ByYNormalPart(mrPart);

                        //梁中间的檩托板只剖一次;
                        if (mrApronPlate != null && bFlag == false)
                        {
                            Point minYPt = mrPart.GetMinYPoint();
                            Point maxYpt = mrPart.GetMaxYPoint();
                            mrSection.mSectionMidY = (minYPt.Y + maxYpt.Y) / 2.0;
                            mrSection.mSectionMode = MrSectionMode.MrVertical;
                            bFlag = true;
                        }
                    }
                }

                //1.如果零部件已经存在于剖面中则直接返回;
                if (IsPartInSection(mrPart, mrSection.mSectionMode))
                {
                    continue;
                }

                if (mrSection.mSectionMode == MrSectionMode.None)
                {
                    continue;
                }

                //2.把所有属于该剖面的零部件加入;
                AddPartInSection(mrSection);

                mSectionList.Add(mrSection);

                if (mrSection.mSectionMode == MrSectionMode.MrHorizontal)
                {
                    CreateHorizontalSection(mrSection);
                }
                if (mrSection.mSectionMode == MrSectionMode.MrVertical)
                {
                    CreateVerticalSection(mrSection);
                }
            }
        }
Example #2
0
        /// <summary>
        /// 构建需要进行剖视的零部件;
        /// </summary>
        private void BuildNeedSectionPartList()
        {
            CMrPart mainBeam = CMrMainBeam.GetInstance();

            double mainBeamMinY = mainBeam.GetMinYPoint().Y;
            double mainBeamMaxY = mainBeam.GetMaxYPoint().Y;
            double mainBeamMinX = mainBeam.GetMinXPoint().X;
            double mainBeamMaxX = mainBeam.GetMaxXPoint().X;

            CMrPart leftPart       = CMrCylinderDoorFrontManager.GetInstance().mLeftPart;
            CMrPart leftMiddlePart = CMrCylinderDoorFrontManager.GetInstance().mLeftTopMiddlePart;
            CMrPart leftTopPart    = CMrCylinderDoorFrontManager.GetInstance().mLeftTopPart;

            CMrPart rightPart       = CMrCylinderDoorFrontManager.GetInstance().mRightPart;
            CMrPart rightMiddlePart = CMrCylinderDoorFrontManager.GetInstance().mRightTopMiddlePart;
            CMrPart rightTopPart    = CMrCylinderDoorFrontManager.GetInstance().mRightTopPart;

            mrPartList.Remove(leftPart);
            mrPartList.Remove(leftMiddlePart);
            mrPartList.Remove(rightPart);
            mrPartList.Remove(rightMiddlePart);

            foreach (CMrPart mrPart in mrPartList)
            {
                double partMinX = mrPart.GetMinXPoint().X;
                double partMaxX = mrPart.GetMaxXPoint().X;
                double partMaxY = mrPart.GetMaxYPoint().Y;
                double partMinY = mrPart.GetMinYPoint().Y;

                if (!mrPart.IsHaveBolt())
                {
                    continue;
                }

                Vector normal = mrPart.mNormal;

                //如果法向量与X轴平行;
                if (CDimTools.GetInstance().IsTwoVectorParallel(normal, new Vector(1, 0, 0)))
                {
                    if (mrPart == leftTopPart || mrPart == rightTopPart)
                    {
                        mAllSectionPartList.Add(mrPart);
                    }

                    //1.如果竖直的板在柱子中间;
                    if (CDimTools.GetInstance().CompareTwoDoubleValue(partMinX, mainBeamMinX) > 0 &&
                        CDimTools.GetInstance().CompareTwoDoubleValue(partMaxX, mainBeamMaxX) < 0)
                    {
                        mAllSectionPartList.Add(mrPart);
                    }
                    //2.如果竖直的板在主梁侧板的外侧;
                    if (leftPart != null && CDimTools.GetInstance().CompareTwoDoubleValue(partMaxX, leftPart.GetMinXPoint().X) < 0)
                    {
                        mAllSectionPartList.Add(mrPart);
                    }
                    if (rightPart != null && CDimTools.GetInstance().CompareTwoDoubleValue(partMinX, rightPart.GetMaxXPoint().X) > 0)
                    {
                        mAllSectionPartList.Add(mrPart);
                    }
                }
                //如果法向量与Y轴平行;
                else if (CDimTools.GetInstance().IsTwoVectorParallel(normal, new Vector(0, 1, 0)))
                {
                    //如果是檩托板中的零部件则返回;
                    if (CMrCylinderDoorFrontManager.GetInstance().FindMrApronPlateByYNormalPart(mrPart) != null)
                    {
                        continue;
                    }

                    //如果是底板;
                    if (CDimTools.GetInstance().CompareTwoDoubleValue(mainBeamMinY, partMaxY) == 0)
                    {
                        mAllSectionPartList.Add(mrPart);
                    }
                    //如果是顶板;
                    if (CDimTools.GetInstance().CompareTwoDoubleValue(mainBeamMaxY, partMinY) == 0)
                    {
                        mAllSectionPartList.Add(mrPart);
                    }
                    if (CDimTools.GetInstance().CompareTwoDoubleValue(partMinX, mainBeamMaxX) > 0 ||
                        CDimTools.GetInstance().CompareTwoDoubleValue(partMaxX, mainBeamMinX) < 0)
                    {
                        mAllSectionPartList.Add(mrPart);
                    }
                    if (CDimTools.GetInstance().CompareTwoDoubleValue(partMinX, mainBeamMinX) > 0 ||
                        CDimTools.GetInstance().CompareTwoDoubleValue(partMaxX, mainBeamMaxX) < 0)
                    {
                        mAllSectionPartList.Add(mrPart);
                    }
                }
            }

            //1.把类型1中檩托板的任意一块板加进来;
            CMrApronPlate mrApronPlate = CMrCylinderDoorFrontManager.GetInstance().GetFirstMrApronPlateType1();

            if (mrApronPlate != null)
            {
                mAllSectionPartList.Add(mrApronPlate.mYNormalPart);
            }
        }