Esempio n. 1
0
        /// <summary>
        /// 构建剪切板,剪切板的构建主要是针对柱的顶视图中;
        /// </summary>
        public void BuildMrClipPlate(List <CMrPart> mrPartList, MrViewType mrViewType)
        {
            this.mViewType = mrViewType;

            Vector zVector = new Vector(0, 0, 1);

            foreach (CMrPart mrPart in mrPartList)
            {
                if (IsOutsidePlate(mrPart))
                {
                    continue;
                }

                Vector normal = mrPart.mNormal;

                if (CDimTools.GetInstance().IsTwoVectorParallel(normal, zVector))
                {
                    CMrPart topPart = FindTopPart(mrPart, mrPartList);

                    CMrPart bottomPart = FindBottomPart(mrPart, mrPartList);

                    if (topPart != null && bottomPart != null)
                    {
                        CMrClipPlate mrClipPlate = new CMrClipPlate(topPart, mrPart, bottomPart);

                        mMrClipPlateList.Add(mrClipPlate);
                    }
                }
            }
        }
Esempio n. 2
0
        /// <summary>
        /// 判断与Y轴平行零部件是否刚好在主梁的中间;
        /// </summary>
        /// <param name="mrPart"></param>
        /// <returns></returns>
        private bool IsYNormalPartInMainBeamMiddle(CMrPart mrPart)
        {
            double mainBeamMinX    = CMrMainBeam.GetInstance().GetMinXPoint().X;
            double mainBeamMaxX    = CMrMainBeam.GetInstance().GetMaxXPoint().X;
            double mainBeamXLength = mainBeamMaxX - mainBeamMinX;

            double partMinX    = mMrPart.GetMinXPoint().X;
            double partMaxX    = mMrPart.GetMaxXPoint().X;
            double partXLength = partMaxX - partMinX;

            Vector normal = mrPart.mNormal;

            if (!CDimTools.GetInstance().IsTwoVectorParallel(normal, new Vector(0, 1, 0)))
            {
                return(false);
            }
            if (partMinX > mainBeamMaxX)
            {
                return(false);
            }
            if (partMaxX < mainBeamMinX)
            {
                return(false);
            }
            if (Math.Abs(mainBeamXLength - partXLength) > 2 * mainBeamMaxX / 3)
            {
                return(false);
            }
            return(true);
        }
Esempio n. 3
0
        /// <summary>
        /// 得到顶板向上的标注向量;
        /// </summary>
        /// <returns></returns>
        public Vector GetTopBeamUpDimVector()
        {
            CMrPart topBeam = CMrBeamDoorManager.GetInstance().mTopBeam;

            Point leftTopPt  = topBeam.mLeftTopPoint;
            Point rightTopPt = topBeam.mRightTopPoint;

            MrSlopeType slopeType = CDimTools.GetInstance().JudgeLineSlope(leftTopPt, rightTopPt);

            Vector normal = new Vector(rightTopPt.X - leftTopPt.X, rightTopPt.Y - leftTopPt.Y, 0);

            Vector upDimVector = new Vector(normal.Y, -normal.X, 0);

            if (slopeType == MrSlopeType.MORETHAN_ZERO)
            {
                upDimVector.X = -Math.Abs(upDimVector.X);
                upDimVector.Y = Math.Abs(upDimVector.Y);
                upDimVector.Z = 0;
            }
            else
            {
                upDimVector.X = Math.Abs(upDimVector.X);
                upDimVector.Y = Math.Abs(upDimVector.Y);
                upDimVector.Z = 0;
            }

            return(upDimVector);
        }
Esempio n. 4
0
        /// <summary>
        /// 判断门式框架底部的梁;
        /// </summary>
        public void JudgeBottomBeam(CMrPart mrPart)
        {
            double dblWidth = mrPart.GetXSpaceValue();

            double mainBeamWidth = mMainBeam.GetXSpaceValue();

            //顶部梁的长度应该大于主梁的五分之四;
            if (dblWidth < 4 * mainBeamWidth / 5.0)
            {
                return;
            }

            if (mBottonBeam == null)
            {
                mBottonBeam = mrPart;

                return;
            }

            Point maxYPoint = mrPart.GetMaxYPoint();

            Point bottomMaxYPoint = mBottonBeam.GetMaxYPoint();

            if (CDimTools.GetInstance().CompareTwoDoubleValue(maxYPoint.Y, bottomMaxYPoint.Y) < 0)
            {
                mBottonBeam = mrPart;
            }
        }
        /// <summary>
        /// 构建檩托板;
        /// </summary>
        public void BuildMrApronPlate(List <CMrPart> mrPartList)
        {
            Vector yVector = new Vector(0, 1, 0);

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

                if (!CDimTools.GetInstance().IsTwoVectorParallel(normal, yVector))
                {
                    continue;
                }

                CMrApronPlate mrApronPlate = CreateMrApronPlate(mrPart, mrPartList);

                if (mrApronPlate == null)
                {
                    continue;
                }
                CMrPart zNormalPart = mrApronPlate.mZNormalPart;

                if (!mMapYNormalPartToMrApronPlate.ContainsKey(mrPart))
                {
                    mMapYNormalPartToMrApronPlate.Add(mrPart, mrApronPlate);
                }
            }
        }
        /// <summary>
        /// 获取上翼板向两边弯时顶视图下方的标注集合;
        /// </summary>
        /// <returns></returns>
        public CMrDimSet GetXDownDimSetMiddle()
        {
            if (!IsNeedXDownDimMiddle())
            {
                return(null);
            }

            CMrDimSet mrDimSet = new CMrDimSet();

            CMrPart leftBottomBeam  = CMrBeamDoorManager.GetInstance().mLeftBottomBeam;
            CMrPart rightBottomBeam = CMrBeamDoorManager.GetInstance().mRightBottomBeam;

            Point midMaxPoint = CMrBeamDoorManager.GetInstance().mMidMaxPoint;

            if (mMrPart == leftBottomBeam)
            {
                mrDimSet.AddPoint(mMrPart.mRightBottomPoint);
            }
            else if (mMrPart == rightBottomBeam)
            {
                mrDimSet.AddPoint(mMrPart.mLeftBottomPoint);
            }
            else
            {
                if (mMrPart.mLeftBottomPoint.X < midMaxPoint.X)
                {
                    mrDimSet.AddPoint(mMrPart.mLeftBottomPoint);
                }
                else if (mMrPart.mLeftBottomPoint.X > midMaxPoint.X)
                {
                    mrDimSet.AddPoint(mMrPart.mRightBottomPoint);
                }
            }
            return(mrDimSet);
        }
        /// <summary>
        /// 清除数据;
        /// </summary>
        private void ClearData()
        {
            mMapYNormalPartToMrApronPlate.Clear();

            mYNormalBottomPart = null;
            mTopPart           = null;
        }
Esempio n. 8
0
        /// <summary>
        /// 创建类型2的檩托板;
        /// </summary>
        /// <param name="myNormalPart"></param>
        /// <param name="mrPartList"></param>
        /// <returns></returns>
        public CMrApronPlate CreateMrApronPlateType2(CMrPart myNormalPart, List <CMrPart> mrPartList)
        {
            Vector xVector = new Vector(1, 0, 0);

            double minY = myNormalPart.GetMinYPoint().Y;
            double maxY = myNormalPart.GetMaxYPoint().Y;
            double minX = myNormalPart.GetMinXPoint().X;
            double maxX = myNormalPart.GetMaxXPoint().X;

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

                if (!CDimTools.GetInstance().IsTwoVectorParallel(normal, xVector))
                {
                    continue;
                }

                double xNormalMaxY = mrPart.GetMaxYPoint().Y;
                double xNormalMinY = mrPart.GetMinYPoint().Y;
                double xNormalMaxX = mrPart.GetMaxXPoint().X;
                double xNormalMinX = mrPart.GetMinXPoint().X;

                if (CDimTools.GetInstance().CompareTwoDoubleValue(xNormalMaxY, minY) == 0 ||
                    CDimTools.GetInstance().CompareTwoDoubleValue(xNormalMinY, maxY) == 0)
                {
                    CMrApronPlate mrApronPlate = new CMrApronPlate(mrPart, myNormalPart, MrApronPlateType.Type2);
                    return(mrApronPlate);
                }
            }
            return(null);
        }
Esempio n. 9
0
 /// <summary>
 /// 初始化;
 /// </summary>
 private void ClearData()
 {
     mLeftBeam   = null;
     mRightBeam  = null;
     mTopBeam    = null;
     mBottonBeam = null;
     mDimPartList.Clear();
 }
 /// <summary>
 /// 添加到螺钉组合的链表中;
 /// </summary>
 /// <param name="CMrPart"></param>
 public void AppendMrPart(CMrPart mrPart)
 {
     if (mrPartList.Contains(mrPart))
     {
         return;
     }
     mrPartList.Add(mrPart);
 }
 /// <summary>
 /// 根据给定的零件查找檩托板;
 /// </summary>
 /// <param name="mrPart"></param>
 /// <returns></returns>
 public CMrApronPlate FindMrApronPlateByYNormalPart(CMrPart mrPart)
 {
     if (mMapYNormalPartToMrApronPlate.ContainsKey(mrPart))
     {
         return(mMapYNormalPartToMrApronPlate[mrPart]);
     }
     return(null);
 }
Esempio n. 12
0
        /// <summary>
        /// 判断该剖面中是否已经包含了该零件;
        /// </summary>
        /// <param name="mrPart"></param>
        public bool IsHaveThePart(CMrPart mrPart)
        {
            if (mSectionPartList.Contains(mrPart))
            {
                return(true);
            }

            return(false);
        }
        /// <summary>
        /// 剪切板的构造函数;
        /// </summary>
        /// <param name="mTopPart"></param>
        /// <param name="mMidPart"></param>
        /// <param name="mBottomPart"></param>
        public CMrClipPlate(CMrPart mTopPart, CMrPart mMidPart, CMrPart mBottomPart)
        {
            mMrTopPart    = mTopPart;
            mMrMidPart    = mMidPart;
            mMrBottomPart = mBottomPart;

            //如果上下板之间有一个为空则无效;
            if (mTopPart == null || mBottomPart == null)
            {
                mbValid = false;
            }
        }
        /// <summary>
        /// 判断是否需要在上面进行标注;
        /// </summary>
        /// <returns></returns>
        protected bool IsNeedXUpDimNormal()
        {
            Vector normal = mMrPart.mNormal;

            if (CDimTools.GetInstance().IsTwoVectorParallel(normal, new Vector(0, 0, 1)))
            {
                return(false);
            }

            double partHeight = Math.Abs(mMrPart.GetMaxYPoint().Y - mMrPart.GetMinYPoint().Y);

            double mainBeamHeight = Math.Abs(CMrMainBeam.GetInstance().GetMaxYPoint().Y - CMrMainBeam.GetInstance().GetMinYPoint().Y);

            CMrPart mTopBeam = CMrBeamDoorManager.GetInstance().mTopBeam;

            Vector topBeamNormal = mTopBeam.mNormal;

            Point leftTopPoint     = CMrMainBeam.GetInstance().mLeftTopPoint;
            Point rightTopPoint    = CMrMainBeam.GetInstance().mRightTopPoint;
            Point rightBottomPoint = CMrMainBeam.GetInstance().mRightBottomPoint;

            Point partMinY = mMrPart.GetMinYPoint();
            Point partMaxY = mMrPart.GetMaxYPoint();

            //(1).如果是零件是左右两侧的板;
            if (mMrPart == CMrBeamDoorManager.GetInstance().mLeftBeam || mMrPart == CMrBeamDoorManager.GetInstance().mRightBeam)
            {
                return(false);
            }
            //(2).如果零件在主梁的上方;
            if (CDimTools.GetInstance().IsThePointOnLine(partMinY, leftTopPoint, rightTopPoint) > 0)
            {
                if (CDimTools.GetInstance().IsTwoVectorVertical(normal, topBeamNormal))
                {
                    CMrBeamDoorManager.GetInstance().AppendUpDimPart(mMrPart);

                    return(true);
                }
            }
            //(3).如果零件与主梁对角线相交,并且与地面垂直;
            if (CDimTools.GetInstance().IsThePointOnLine(partMaxY, leftTopPoint, rightBottomPoint) > 0 &&
                CDimTools.GetInstance().IsThePointOnLine(partMinY, leftTopPoint, rightBottomPoint) < 0 &&
                partHeight > mainBeamHeight / 3.0)
            {
                if (CDimTools.GetInstance().IsTwoVectorParallel(normal, new Vector(1, 0, 0)))
                {
                    CMrBeamDoorManager.GetInstance().AppendUpDimPart(mMrPart);
                    return(true);
                }
            }
            return(false);
        }
Esempio n. 15
0
        /// <summary>
        /// 判断框架柱剖面中的两个零件是否相同;
        /// </summary>
        /// <param name="mrSrcPart"></param>
        /// <param name="mrDesPart"></param>
        /// <returns></returns>
        private bool IsTwoCylinderPartSame(CMrPart mrSrcPart, CMrPart mrDesPart)
        {
            Vector srcVector = mrSrcPart.mNormal;
            Vector desVector = mrDesPart.mNormal;

            string strSrcPartMark = mrSrcPart.mPartInModel.GetPartMark();
            string strDesPartMark = mrDesPart.mPartInModel.GetPartMark();

            if (!CDimTools.GetInstance().IsTwoVectorParallel(desVector, srcVector))
            {
                return(false);
            }

            if (!strSrcPartMark.Equals(strDesPartMark))
            {
                return(false);
            }

            if (mrSrcPart.IsHaveBolt() != mrDesPart.IsHaveBolt())
            {
                return(false);
            }

            List <CMrBoltArray> mrSrcBoltArray = mrSrcPart.GetBoltArrayList();
            List <CMrBoltArray> mrDesBoltArray = mrDesPart.GetBoltArrayList();

            if (mrSrcBoltArray.Count != mrDesBoltArray.Count)
            {
                return(false);
            }

            List <Point> mrSrcBoltPointList = new List <Point>();
            List <Point> mrDesBoltPointList = new List <Point>();

            foreach (CMrBoltArray mrBoltArray in mrSrcBoltArray)
            {
                mrSrcBoltPointList.AddRange(mrBoltArray.GetBoltPointList());
            }

            foreach (CMrBoltArray mrBoltArray in mrDesBoltArray)
            {
                mrDesBoltPointList.AddRange(mrBoltArray.GetBoltPointList());
            }

            if (mrSrcBoltPointList.Count != mrDesBoltPointList.Count)
            {
                return(false);
            }
            return(true);
        }
Esempio n. 16
0
        /// <summary>
        /// 判断顶部的零部件,顶部的零部件法向可能与Y轴平行,也可能在XY平面内;
        /// </summary>
        /// <param name="?"></param>
        private void JudgeTopPart(CMrPart mrPart)
        {
            Vector normal = mrPart.mNormal;
            double maxY   = mrPart.GetMaxYPoint().Y;

            if (maxY < mMainBeamMaxY)
            {
                return;
            }

            //1.如果零部件的法向与Y轴的法向相同;
            if (CDimTools.GetInstance().IsTwoVectorParallel(normal, new Vector(0, 1, 0)))
            {
                if (mTopPart == null)
                {
                    mTopPart = mrPart;
                }
                else if (maxY > mTopPart.GetMaxYPoint().Y)
                {
                    mTopPart = mrPart;
                }
            }
            //2.如果法向在XY平面内;
            else if (CDimTools.GetInstance().IsVectorInXYPlane(normal))
            {
                if (mTopPart == null)
                {
                    mTopPart = mrPart;
                }
                else if (mLeftTopPart != null && mRightTopPart != null)
                {
                    double leftTopMaxY  = mLeftTopPart.GetMaxYPoint().Y;
                    double rightTopMaxY = mRightTopPart.GetMaxYPoint().Y;

                    if (maxY > leftTopMaxY && maxY > rightTopMaxY)
                    {
                        return;
                    }
                    else if (maxY > mTopPart.GetMaxYPoint().Y)
                    {
                        mTopPart = mrPart;
                    }
                }
                else if (maxY > mTopPart.GetMaxYPoint().Y)
                {
                    mTopPart = mrPart;
                }
            }
        }
        /// <summary>
        /// 判断该板是否需要进行标注;
        /// </summary>
        /// <returns></returns>
        protected bool IsNeedXUpDimMiddle()
        {
            Vector normal = mMrPart.mNormal;

            if (CDimTools.GetInstance().IsTwoVectorParallel(normal, new Vector(0, 0, 1)))
            {
                return(false);
            }

            CMrPart mTopBeam = CMrBeamDoorManager.GetInstance().mTopBeam;

            Vector leftTopVector  = CMrBeamDoorManager.GetInstance().mLeftTopVector;
            Vector rightTopVector = CMrBeamDoorManager.GetInstance().mRightTopVector;

            Point leftBottom       = mTopBeam.mLeftBottomPoint;
            Point rightBottomPoint = mTopBeam.mRightBottomPoint;
            Point midTopPoint      = CMrBeamDoorManager.GetInstance().mMidMaxPoint;

            Point partMinY = mMrPart.GetMinYPoint();

            //(1).如果是零件是左右两侧的板;
            if (mMrPart == CMrBeamDoorManager.GetInstance().mLeftBeam ||
                mMrPart == CMrBeamDoorManager.GetInstance().mRightBeam)
            {
                return(false);
            }

            //(2).如果零件在主梁的左上方;
            if (CDimTools.GetInstance().IsThePointOnLine(partMinY, leftBottom, midTopPoint) > 0)
            {
                if (CDimTools.GetInstance().IsTwoVectorVertical(normal, leftTopVector))
                {
                    CMrBeamDoorManager.GetInstance().AppendUpDimPart(mMrPart);

                    return(true);
                }
            }
            //(3).如果零件在主梁的右上方;
            if (CDimTools.GetInstance().IsThePointOnLine(partMinY, rightBottomPoint, midTopPoint) > 0)
            {
                if (CDimTools.GetInstance().IsTwoVectorVertical(normal, rightTopVector))
                {
                    CMrBeamDoorManager.GetInstance().AppendUpDimPart(mMrPart);

                    return(true);
                }
            }
            return(false);
        }
        /// <summary>
        /// 构造函数;
        /// </summary>
        /// <param name="yNormalPart"></param>
        /// <param name="zNormalPart"></param>
        public CMrApronPlate(CMrPart yNormalPart, CMrPart zNormalPart, MrApronPlateType type)
        {
            mType = type;

            if (mType == MrApronPlateType.Type1)
            {
                mYNormalPart = yNormalPart;
                mZNormalPart = zNormalPart;
            }
            if (mType == MrApronPlateType.Type2)
            {
                mXNormalPart = yNormalPart;
                mYNormalPart = zNormalPart;
            }
        }
Esempio n. 19
0
        /// <summary>
        /// 判断零件是否是剪切板中的一块板;
        /// </summary>
        /// <param name="mrPart"></param>
        /// <returns></returns>
        public bool IsInClipPlate(CMrPart mrPart)
        {
            MrClipPlatePosType mrClipTypePosType = MrClipPlatePosType.NONE;

            foreach (CMrClipPlate mrClipPlate in mMrClipPlateList)
            {
                mrClipTypePosType = mrClipPlate.IsHaveThePart(mrPart);

                if (mrClipTypePosType != MrClipPlatePosType.NONE)
                {
                    return(true);
                }
            }
            return(false);
        }
        /// <summary>
        /// 获取顶视图上方的标注集合;
        /// </summary>
        /// <returns></returns>
        public CMrDimSet GetXUpDimSetNormal()
        {
            if (!IsNeedXUpDimNormal())
            {
                return(null);
            }

            CMrDimSet mrDimSet = new CMrDimSet();

            CMrPart topBeam = CMrBeamDoorManager.GetInstance().mTopBeam;

            Vector normal        = mMrPart.mNormal;
            Vector topBeamNormal = topBeam.mNormal;

            Point leftTopPoint  = topBeam.mLeftTopPoint;
            Point rightTopPoint = topBeam.mRightTopPoint;

            MrSlopeType slopeType = CDimTools.GetInstance().JudgeLineSlope(leftTopPoint, rightTopPoint);

            if (slopeType == MrSlopeType.MORETHAN_ZERO)
            {
                if (CDimTools.GetInstance().IsTwoVectorParallel(normal, new Vector(1, 0, 0)))
                {
                    mrDimSet.AddPoint(mMrPart.GetMaxXMaxYPoint());
                }
                else
                {
                    mrDimSet.AddPoint(mMrPart.mRightTopPoint);
                }
            }
            else if (slopeType == MrSlopeType.LESSTHAN_ZERO)
            {
                if (CDimTools.GetInstance().IsTwoVectorParallel(normal, new Vector(1, 0, 0)))
                {
                    mrDimSet.AddPoint(mMrPart.GetMinXMaxYPoint());
                }
                else
                {
                    mrDimSet.AddPoint(mMrPart.mLeftTopPoint);
                }
            }
            else
            {
                mrDimSet.AddPoint(mMrPart.mLeftTopPoint);
            }

            return(mrDimSet);
        }
Esempio n. 21
0
        /// <summary>
        /// 判断右侧和右上侧的零部件;
        /// </summary>
        /// <param name="mrPart"></param>
        private void JudgeRightAndRightTopPart(CMrPart mrPart)
        {
            Vector normal = mrPart.mNormal;

            if (mrPart.GetMaxXPoint().X < 0)
            {
                return;
            }

            double partMaxX = mrPart.GetMaxXPoint().X;
            double partMinX = mrPart.GetMinXPoint().X;
            double partMinY = mrPart.GetMinYPoint().Y;
            double partMaxY = mrPart.GetMaxYPoint().Y;

            double partHeight = Math.Abs(partMaxY - partMinY);

            double mainBeamHeight = Math.Abs(mMainBeamMaxY - mMainBeamMinY);

            if (partHeight > mainBeamHeight / 2.0 && Math.Abs(partMinY - mMainBeamMinY) < 0.5)
            {
                if (mRightPart == null)
                {
                    mRightPart = mrPart;
                }
                else if (mrPart.GetMaxXPoint().X > mRightPart.GetMaxXPoint().X)
                {
                    mRightPart = mrPart;
                }

                return;
            }
            if (CDimTools.GetInstance().CompareTwoDoubleValue(partMaxY, mMainBeamMaxY) >= 0)
            {
                if (!CDimTools.GetInstance().IsTwoVectorParallel(normal, new Vector(1, 0, 0)))
                {
                    return;
                }
                if (mRightTopPart == null)
                {
                    mRightTopPart = mrPart;
                }
                else if (partMaxY > mRightTopPart.GetMaxYPoint().Y)
                {
                    mRightTopPart = mrPart;
                }
            }
        }
        /// <summary>
        /// 是否包含该对象;
        /// </summary>
        /// <param name="mrPart"></param>
        /// <returns></returns>
        public MrClipPlatePosType IsHaveThePart(CMrPart mrPart)
        {
            if (mMrTopPart == mrPart)
            {
                return(MrClipPlatePosType.TOP);
            }
            if (mMrMidPart == mrPart)
            {
                return(MrClipPlatePosType.MIDDLE);
            }
            if (mMrBottomPart == mrPart)
            {
                return(MrClipPlatePosType.BOTTOM);
            }

            return(MrClipPlatePosType.NONE);
        }
Esempio n. 23
0
        /// <summary>
        /// 寻找剪切板下面的一块板;
        /// </summary>
        /// <param name="mMidPart"></param>
        /// <param name="mrPartList"></param>
        /// <returns></returns>
        private CMrPart FindBottomPart(CMrPart mMidPart, List <CMrPart> mrPartList)
        {
            Vector midVector = mMidPart.mNormal;

            Point midPartMinYPoint = mMidPart.GetMinYPoint();

            Vector yVector = new Vector(0, 1, 0);

            foreach (CMrPart mrPart in mrPartList)
            {
                if (!CDimTools.GetInstance().IsTwoVectorParallel(mrPart.mNormal, yVector))
                {
                    continue;
                }

                if (mrPart == mMidPart)
                {
                    continue;
                }

                if (mViewType == MrViewType.CylinderTopView)
                {
                    if (mrPart.GetCylinderTopViewInfo().mPostionType != mMidPart.GetCylinderTopViewInfo().mPostionType)
                    {
                        continue;
                    }
                }
                else if (mViewType == MrViewType.CylinderFrontView)
                {
                    if (mrPart.GetCylinderFrontViewInfo().mPostionType != mMidPart.GetCylinderFrontViewInfo().mPostionType)
                    {
                        continue;
                    }
                }

                Point bottomPartMaxYPoint = mrPart.GetMaxYPoint();

                if (CDimTools.GetInstance().CompareTwoDoubleValue(bottomPartMaxYPoint.Y, midPartMinYPoint.Y) == 0)
                {
                    return(mrPart);
                }
            }

            return(null);
        }
        /// <summary>
        /// 判断是否需要在下面进行标注;
        /// </summary>
        /// <returns></returns>
        protected bool IsNeedXDownDimNormal()
        {
            Vector normal = mMrPart.mNormal;

            if (CDimTools.GetInstance().IsTwoVectorParallel(normal, new Vector(0, 0, 1)))
            {
                return(false);
            }

            double partHeight     = Math.Abs(mMrPart.GetMaxYPoint().Y - mMrPart.GetMinYPoint().Y);
            double mainBeamHeight = Math.Abs(CMrMainBeam.GetInstance().GetMaxYPoint().Y - CMrMainBeam.GetInstance().GetMinYPoint().Y);

            CMrPart mBottomBeam = CMrBeamDoorManager.GetInstance().mBottonBeam;

            Point leftBottomPoint  = CMrMainBeam.GetInstance().mLeftTopPoint;
            Point rightBottomPoint = CMrMainBeam.GetInstance().mRightBottomPoint;
            Point partMaxY         = mMrPart.GetMaxYPoint();
            Point partMinY         = mMrPart.GetMinYPoint();

            //(1).如果是零件是左右两侧的板;
            if (mMrPart == CMrBeamDoorManager.GetInstance().mLeftBeam || mMrPart == CMrBeamDoorManager.GetInstance().mRightBeam)
            {
                return(false);
            }
            //(2).如果零件在主梁的下方,并且与地面垂直;
            if (CDimTools.GetInstance().IsThePointOnLine(partMaxY, leftBottomPoint, rightBottomPoint) < 0 &&
                CDimTools.GetInstance().IsTwoVectorParallel(normal, new Vector(1, 0, 0)))
            {
                return(true);
            }
            //(3).如果零件在主梁中间,并且与地面垂直;
            if (CDimTools.GetInstance().IsThePointOnLine(partMaxY, leftBottomPoint, rightBottomPoint) > 0 &&
                CDimTools.GetInstance().IsTwoVectorParallel(normal, new Vector(1, 0, 0)) && partHeight > mainBeamHeight / 2.0)
            {
                return(true);
            }
            //(4).如果零件在主梁下方,并且与地面水平;
            if (mMrPart.GetMinYPoint().Y < mBottomBeam.GetMinYPoint().Y&&
                CDimTools.GetInstance().IsTwoVectorParallel(normal, new Vector(0, 1, 0)))
            {
                return(true);
            }

            return(false);
        }
        /// <summary>
        /// 根据给定的零部件找到上板或者下板;
        /// </summary>
        /// <param name="mrPart"></param>
        /// <param name="mrPartList"></param>
        /// <returns></returns>
        public CMrApronPlate CreateMrApronPlate(CMrPart myNormalPart, List <CMrPart> mrPartList)
        {
            Vector zVector = new Vector(0, 0, 1);

            double minY = myNormalPart.GetMinYPoint().Y;
            double maxY = myNormalPart.GetMaxYPoint().Y;
            double minX = myNormalPart.GetMinXPoint().X;
            double maxX = myNormalPart.GetMaxXPoint().X;

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

                if (!CDimTools.GetInstance().IsTwoVectorParallel(normal, zVector))
                {
                    continue;
                }

                double zNormalMaxY = mrPart.GetMaxYPoint().Y;
                double zNormalMinY = mrPart.GetMinYPoint().Y;
                double zNormalMinX = mrPart.GetMinXPoint().X;
                double zNormalMaxX = mrPart.GetMaxXPoint().X;

                if (CDimTools.GetInstance().CompareTwoDoubleValue(zNormalMaxY, minY) == 0 &&
                    Math.Abs(zNormalMinX - minX) < 5 && Math.Abs(zNormalMaxX - maxX) < 5)
                {
                    CMrApronPlate mrApronPlate = new CMrApronPlate(myNormalPart, mrPart, MrApronPlateType.Type1);

                    mrApronPlate.mIsUp = false;

                    return(mrApronPlate);
                }
                else if (CDimTools.GetInstance().CompareTwoDoubleValue(zNormalMinY, maxY) == 0 &&
                         Math.Abs(zNormalMinX - minX) < 5 && Math.Abs(zNormalMaxX - maxX) < 5)
                {
                    CMrApronPlate mrApronPlate = new CMrApronPlate(myNormalPart, mrPart, MrApronPlateType.Type1);

                    mrApronPlate.mIsUp = true;

                    return(mrApronPlate);
                }
            }
            return(null);
        }
Esempio n. 26
0
        /// <summary>
        /// 是否该零件与剖面中的零部件相同;
        /// </summary>
        /// <param name="mrPart"></param>
        /// <returns></returns>
        private bool IsThePartSameWithSectionParts(CMrPart mrPart)
        {
            foreach (CMrPart mSectionPart in mSectionPartList)
            {
                if (mSectionType == MrSectionType.MrSectionBeam)
                {
                    bool bRes = IsTwoBeamPartSame(mSectionPart, mrPart);

                    if (bRes)
                    {
                        return(true);
                    }
                }
                else if (mSectionType == MrSectionType.MrSectionCylinder)
                {
                    bool bRes = IsTwoCylinderPartSame(mSectionPart, mrPart);

                    if (bRes)
                    {
                        return(true);
                    }
                }
                else if (mSectionType == MrSectionType.MrSectionBeamDoor)
                {
                    bool bRes = IsTwoCylinderPartSame(mSectionPart, mrPart);

                    if (bRes)
                    {
                        return(true);
                    }
                }
                else if (mSectionType == MrSectionType.MrSectionCylinderDoor)
                {
                    bool bRes = IsTwoCylinderPartSame(mSectionPart, mrPart);

                    if (bRes)
                    {
                        return(true);
                    }
                }
            }

            return(false);
        }
Esempio n. 27
0
        /// <summary>
        /// 清除数据;
        /// </summary>
        private void ClearData()
        {
            mRightDimPartList.Clear();
            mXNormalAloneDimPartList.Clear();
            mYNormalMiddlePartList.Clear();

            mMapYNormalPartToMrApronPlate.Clear();
            mMapZNormalPartToMrApronPlate.Clear();

            mYNormalBottomPart  = null;
            mZNormalBottomPart  = null;
            mLeftPart           = null;
            mLeftTopMiddlePart  = null;
            mLeftTopPart        = null;
            mRightPart          = null;
            mRightTopMiddlePart = null;
            mRightTopPart       = null;
            mTopPart            = null;
        }
Esempio n. 28
0
        /// <summary>
        /// 判断左上侧中间的零部件;
        /// </summary>
        /// <param name="mrPart"></param>
        private void JudgeLeftMiddlePart(CMrPart mrPart)
        {
            if (mLeftTopMiddlePart != null)
            {
                return;
            }

            double partMaxX        = mrPart.GetMaxXPoint().X;
            double partMaxY        = mrPart.GetMaxYPoint().Y;
            double leftPartMaxY    = mLeftPart.GetMaxYPoint().Y;
            double leftTopPartMaxY = mLeftTopPart.GetMaxYPoint().Y;
            double leftTopPartMaxX = mLeftTopPart.GetMaxXPoint().X;

            if (partMaxY > leftPartMaxY && partMaxY < leftTopPartMaxY &&
                CDimTools.GetInstance().CompareTwoDoubleValue(partMaxX, leftTopPartMaxX) == 0)
            {
                mLeftTopMiddlePart = mrPart;
            }
        }
        /// <summary>
        /// 判断顶部的零部件,顶部的零部件法向与Y轴平行;
        /// </summary>
        /// <param name="?"></param>
        private void JudgeTopPart(CMrPart mrPart)
        {
            Vector normal = mrPart.mNormal;
            double maxY   = mrPart.GetMaxYPoint().Y;

            if (maxY < mMainBeamMaxY)
            {
                return;
            }

            //1.如果零部件的法向与Y轴的法向相同;
            if (CDimTools.GetInstance().IsTwoVectorParallel(normal, new Vector(0, 1, 0)))
            {
                if (Math.Abs(maxY - CCommonPara.mViewMaxY) < CCommonPara.mDblError)
                {
                    mTopPart = mrPart;
                }
            }
        }
Esempio n. 30
0
        /// <summary>
        /// 判断右上侧中间的零部件;
        /// </summary>
        /// <param name="mrPart"></param>
        private void JudgeRightMiddlePart(CMrPart mrPart)
        {
            if (mRightTopMiddlePart != null)
            {
                return;
            }

            double partMinX         = mrPart.GetMinXPoint().X;
            double partMaxY         = mrPart.GetMaxYPoint().Y;
            double rightPartMaxY    = mRightPart.GetMaxYPoint().Y;
            double rightTopPartMaxY = mRightTopPart.GetMaxYPoint().Y;
            double rightTopPartMinX = mRightTopPart.GetMinXPoint().X;

            if (partMaxY > rightPartMaxY && partMaxY < rightTopPartMaxY &&
                CDimTools.GetInstance().CompareTwoDoubleValue(partMinX, rightTopPartMinX) == 0)
            {
                mRightTopMiddlePart = mrPart;
            }
        }