示例#1
0
        /// <summary>
        /// 创建垂直方向的剖面;
        /// </summary>
        private void CreateVerticalSection(CMrSection mrSection)
        {
            //判断是否需要创建该剖面或者只是添加零件标记;
            CMrSection mrSameSection = null;

            View.ViewAttributes viewAttributes = new View.ViewAttributes();
            viewAttributes.LoadAttributes(CCommonPara.mSectionAttPath);

            SectionMarkBase.SectionMarkAttributes sectionMarkAttributes = new SectionMarkBase.SectionMarkAttributes();
            sectionMarkAttributes.LoadAttributes(CCommonPara.mSectionMarkNotePath);

            View        sectionView = null;
            SectionMark setionMark  = null;

            double dblX          = 50;
            Point  sectionMinXPt = null;
            Point  sectionMaxXPt = null;

            double mainBeamMinX = CMrMainBeam.GetInstance().GetMinXPoint().X;
            double mainBeamMaxX = CMrMainBeam.GetInstance().GetMaxXPoint().X;

            mrSection.GetSectionMinXAndMaxXPoint(ref sectionMinXPt, ref sectionMaxXPt);

            if (sectionMaxXPt.X < mainBeamMaxX)
            {
                sectionMaxXPt.X = mainBeamMaxX;
            }
            if (sectionMinXPt.X > mainBeamMinX)
            {
                sectionMinXPt.X = mainBeamMinX;
            }

            Point startPt = new Point(sectionMaxXPt.X + dblX, mrSection.mSectionMidY, 0);
            Point endPt   = new Point(sectionMinXPt.X - dblX, mrSection.mSectionMidY, 0);

            if (CCommonPara.mVerticalSection == MrSectionOrientation.MrSectionDown)
            {
                Point tempPt = startPt;
                startPt = endPt;
                endPt   = startPt;
            }

            bool bNeedCreateView = IsTheSectionNeedCreateView(mrSection, ref mrSameSection);

            if (bNeedCreateView)
            {
                mSectionMarkIndex++;
                mrSection.mSectionMark = mSectionMarkArray[mSectionMarkIndex];

                View.CreateSectionView(mFrontView, startPt, endPt, new Point(0, 0, 0), CCommonPara.mDblSectionUpDepth
                                       , CCommonPara.mDblSectionDownDepth, viewAttributes, sectionMarkAttributes, out sectionView, out setionMark);
            }
            else if (CCommonPara.mbShowSameSectionMark)
            {
                sectionMarkAttributes.MarkName = mrSameSection.mSectionMark;
                setionMark = new SectionMark(mFrontView, startPt, endPt, sectionMarkAttributes);
                setionMark.Insert();
                mFrontView.Modify();
            }
        }
示例#2
0
        /// <summary>
        /// 创建水平方向的剖面;
        /// </summary>
        private void CreateHorizontalSection(CMrSection mrSection)
        {
            //判断是否需要创建该剖面或者只是添加零件标记;
            CMrSection mrSameSection = null;

            View.ViewAttributes viewAttributes = new View.ViewAttributes();
            viewAttributes.LoadAttributes(CCommonPara.mSectionAttPath);

            SectionMarkBase.SectionMarkAttributes sectionMarkAttributes = new SectionMarkBase.SectionMarkAttributes();
            sectionMarkAttributes.LoadAttributes(CCommonPara.mSectionMarkNotePath);

            View        sectionView = null;
            SectionMark setionMark  = null;

            double sectionMinY = 0.0;
            double sectionMaxY = 0.0;
            double dblY        = 50;

            mrSection.GetSectionMinYAndMaxY(ref sectionMinY, ref sectionMaxY);

            Point startPt = new Point(mrSection.mSectionMidX, sectionMaxY + dblY, 0);
            Point endPt   = new Point(mrSection.mSectionMidX, sectionMinY - dblY, 0);

            if (CCommonPara.mHorizontalSection == MrSectionOrientation.MrSectionLeft)
            {
                Point tempPt = startPt;
                startPt = endPt;
                endPt   = tempPt;
            }

            bool bNeedCreateView = IsTheSectionNeedCreateView(mrSection, ref mrSameSection);

            if (bNeedCreateView)
            {
                mSectionMarkIndex++;
                mrSection.mSectionMark = mSectionMarkArray[mSectionMarkIndex];

                View.CreateSectionView(mFrontView, startPt, endPt, new Point(0, 0, 0), CCommonPara.mDblSectionUpDepth
                                       , CCommonPara.mDblSectionDownDepth, viewAttributes, sectionMarkAttributes, out sectionView, out setionMark);
            }
            else if (CCommonPara.mbShowSameSectionMark)
            {
                sectionMarkAttributes.MarkName = mrSameSection.mSectionMark;
                setionMark = new SectionMark(mFrontView, startPt, endPt, sectionMarkAttributes);
                setionMark.Insert();
                mFrontView.Modify();
            }
        }
        /// <summary>
        /// 创建水平方向的剖面;
        /// </summary>
        /// <param name="mrSection"></param>
        private void CreateHorizontalMiddleSection(CMrSection mrSection, CMrPart mrPart)
        {
            CMrPart mTopBeam         = CMrBeamDoorManager.GetInstance().mTopBeam;
            CMrPart mLeftBottomBeam  = CMrBeamDoorManager.GetInstance().mLeftBottomBeam;
            CMrPart mRightBottomBeam = CMrBeamDoorManager.GetInstance().mRightBottomBeam;

            //1.判断是否需要创建该剖面或者只是添加零件标记;
            CMrSection mrSameSection = null;

            View.ViewAttributes viewAttributes = new View.ViewAttributes();
            viewAttributes.LoadAttributes(CCommonPara.mSectionAttPath);

            SectionMarkBase.SectionMarkAttributes sectionMarkAttributes = new SectionMarkBase.SectionMarkAttributes();
            sectionMarkAttributes.LoadAttributes(CCommonPara.mSectionMarkNotePath);

            View        sectionView = null;
            SectionMark setionMark  = null;

            Point sectionMinYPt = new Point();
            Point sectionMaxYPt = new Point();

            mrSection.GetSectionMinYAndMaxYPoint(ref sectionMinYPt, ref sectionMaxYPt);

            double dblY = 50;

            Point startPt = null;
            Point endPt   = null;

            Point tBLeftTopPt  = null;
            Point tBRightTopPt = null;

            Point bBLeftTopPt  = null;
            Point bBRightTopPt = null;

            Point maxXPt    = mrPart.GetMaxXPoint();
            Point midMaxYPt = CMrBeamDoorManager.GetInstance().mMidMaxPoint;

            if (maxXPt.X < midMaxYPt.X)
            {
                tBLeftTopPt  = mTopBeam.mLeftTopPoint;
                tBRightTopPt = midMaxYPt;

                bBLeftTopPt  = mLeftBottomBeam.mLeftTopPoint;
                bBRightTopPt = mLeftBottomBeam.mRightTopPoint;
            }
            else if (maxXPt.X > midMaxYPt.X)
            {
                tBLeftTopPt  = midMaxYPt;
                tBRightTopPt = mTopBeam.mRightTopPoint;

                bBLeftTopPt  = mRightBottomBeam.mLeftTopPoint;
                bBRightTopPt = mRightBottomBeam.mRightTopPoint;
            }

            Point partLeftBottomPt = mrPart.mLeftBottomPoint;
            Point partLeftTopPt    = mrPart.mLeftTopPoint;

            //2.如果Y值最大的点在顶部梁的上方;
            if (CDimTools.GetInstance().IsThePointOnLine(sectionMaxYPt, tBLeftTopPt, tBRightTopPt) > 0)
            {
                Point newMaxYPt = new Point(sectionMaxYPt.X, sectionMaxYPt.Y + dblY, 0);
                Point footPt    = CDimTools.GetInstance().ComputeFootPointToLine(newMaxYPt, partLeftBottomPt, partLeftTopPt);
                startPt = footPt;
            }
            else
            {
                Point footPt    = CDimTools.GetInstance().ComputeFootPointToLine(partLeftTopPt, tBLeftTopPt, tBRightTopPt);
                Point newMaxYPt = new Point(footPt.X, footPt.Y + dblY, 0);
                footPt  = CDimTools.GetInstance().ComputeFootPointToLine(newMaxYPt, partLeftBottomPt, partLeftTopPt);
                startPt = footPt;
            }

            //3.如果Y值最小的点在底部梁的下方;
            if (CDimTools.GetInstance().IsThePointOnLine(sectionMinYPt, bBLeftTopPt, bBRightTopPt) < 0)
            {
                Point newMinYPt = new Point(sectionMinYPt.X, sectionMinYPt.Y - dblY, 0);
                Point footPt    = CDimTools.GetInstance().ComputeFootPointToLine(newMinYPt, partLeftBottomPt, partLeftTopPt);
                endPt = footPt;
            }
            else
            {
                Point footPt    = CDimTools.GetInstance().ComputeFootPointToLine(partLeftBottomPt, bBLeftTopPt, bBRightTopPt);
                Point newMinYPt = new Point(footPt.X, footPt.Y - dblY, 0);
                footPt = CDimTools.GetInstance().ComputeFootPointToLine(newMinYPt, partLeftBottomPt, partLeftTopPt);
                endPt  = footPt;
            }

            if (CCommonPara.mHorizontalSection == MrSectionOrientation.MrSectionRight)
            {
                Point tempPt = startPt;
                startPt = endPt;
                endPt   = startPt;
            }

            bool bNeedCreateView = IsTheSectionNeedCreateView(mrSection, ref mrSameSection);

            if (bNeedCreateView)
            {
                mSectionMarkIndex++;
                mrSection.mSectionMark = mSectionMarkArray[mSectionMarkIndex];
                View.CreateSectionView(mFrontView, startPt, endPt, new Point(0, 0, 0), CCommonPara.mDblSectionUpDepth
                                       , CCommonPara.mDblSectionDownDepth, viewAttributes, sectionMarkAttributes, out sectionView, out setionMark);
            }
            else if (CCommonPara.mbShowSameSectionMark)
            {
                sectionMarkAttributes.MarkName = mrSameSection.mSectionMark;
                setionMark = new SectionMark(mFrontView, startPt, endPt, sectionMarkAttributes);
                setionMark.Insert();
                mFrontView.Modify();
            }
        }
        /// <summary>
        /// 创建所有零部件的剖面;
        /// </summary>
        private void CreateAllPartSection()
        {
            CDimTools.GetInstance().SortMrPartByMinX(mAllSectionPartList);

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

                CMrSection mrSection = new CMrSection(MrSectionType.MrSectionBeam);
                mrSection.AppendSectionPart(mrPart);

                Point minXPt = mrPart.GetMinXPoint();
                Point maxXpt = mrPart.GetMaxXPoint();

                mrSection.mSectionMidX = (minXPt.X + maxXpt.X) / 2.0;

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

                mSectionList.Add(mrSection);

                //3.判断是否需要创建该剖面或者只是添加零件标记;
                CMrSection mrSameSection = null;

                View.ViewAttributes viewAttributes = new View.ViewAttributes();
                viewAttributes.LoadAttributes(CCommonPara.mSectionAttPath);

                SectionMarkBase.SectionMarkAttributes sectionMarkAttributes = new SectionMarkBase.SectionMarkAttributes();
                sectionMarkAttributes.LoadAttributes(CCommonPara.mSectionMarkNotePath);

                View        sectionView = null;
                SectionMark setionMark  = null;

                double mainBeamMaxY = CMrMainBeam.GetInstance().GetMaxYPoint().Y;
                double mainBeamMinY = CMrMainBeam.GetInstance().GetMinYPoint().Y;
                double dblY         = 50;

                double sectionMinY = 0.0;
                double sectionMaxY = 0.0;

                mrSection.GetSectionMinYAndMaxY(ref sectionMinY, ref sectionMaxY);

                Point startPt = null;
                Point endPt   = null;

                if (sectionMinY > mainBeamMinY)
                {
                    sectionMinY = mainBeamMinY;
                }
                if (sectionMaxY < mainBeamMaxY)
                {
                    sectionMaxY = mainBeamMaxY;
                }
                startPt = new Point(mrSection.mSectionMidX, sectionMaxY + dblY, 0);
                endPt   = new Point(mrSection.mSectionMidX, sectionMinY - dblY, 0);

                if (CCommonPara.mHorizontalSection == MrSectionOrientation.MrSectionLeft)
                {
                    Point tempPt = startPt;
                    startPt = endPt;
                    endPt   = tempPt;
                }
                bool bNeedCreateView = IsTheSectionNeedCreateView(mrSection, ref mrSameSection);

                if (bNeedCreateView)
                {
                    mSectionMarkIndex++;
                    mrSection.mSectionMark = mSectionMarkArray[mSectionMarkIndex];

                    View.CreateSectionView(mFrontView, startPt, endPt, new Point(0, 0, 0), CCommonPara.mDblSectionUpDepth
                                           , CCommonPara.mDblSectionDownDepth, viewAttributes, sectionMarkAttributes, out sectionView, out setionMark);
                }
                else if (CCommonPara.mbShowSameSectionMark)
                {
                    sectionMarkAttributes.MarkName = mrSameSection.mSectionMark;
                    setionMark = new SectionMark(mFrontView, startPt, endPt, sectionMarkAttributes);
                    setionMark.Insert();
                    mFrontView.Modify();
                }
            }
        }