Example #1
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);
        }
        /// <summary>
        /// 判断当上翼板向两边弯时该板是否需要进行标注;
        /// </summary>
        /// <returns></returns>
        protected bool IsNeedXDownDimMiddle()
        {
            Vector normal = mMrPart.mNormal;

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

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

            //(1).如果是零件是左右两侧的板;
            if (mMrPart == CMrBeamDoorManager.GetInstance().mLeftBeam ||
                mMrPart == CMrBeamDoorManager.GetInstance().mRightBeam)
            {
                return(false);
            }
            //(2).如果是下面的左右侧的板;
            if (mMrPart == CMrBeamDoorManager.GetInstance().mLeftBottomBeam ||
                mMrPart == CMrBeamDoorManager.GetInstance().mRightBottomBeam)
            {
                return(true);
            }
            //(2).如果零件与地面垂直;
            if (CDimTools.GetInstance().IsTwoVectorParallel(normal, new Vector(1, 0, 0)))
            {
                return(true);
            }
            return(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);
        }
        /// <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="mrPartList"></param>
        public void BuildCylinderDoorTopTopo(List <CMrPart> mrPartList)
        {
            ClearData();

            mMainBeamMinX = CMrMainBeam.GetInstance().GetMinXPoint().X;
            mMainBeamMaxX = CMrMainBeam.GetInstance().GetMaxXPoint().X;
            mMainBeamMinY = CMrMainBeam.GetInstance().GetMinYPoint().Y;
            mMainBeamMaxY = CMrMainBeam.GetInstance().GetMaxYPoint().Y;

            //判断零部件;
            foreach (CMrPart mrPart in mrPartList)
            {
                JudgeYNormalBottomPart(mrPart);
                JudgeTopPart(mrPart);
            }

            //构建檩托板的映射表;
            BuildMrApronPlate(mrPartList);
        }
Example #6
0
        /// <summary>
        /// 判断零件是否是外围板;
        /// </summary>
        /// <param name="mrPart"></param>
        /// <returns></returns>
        private bool IsOutsidePlate(CMrPart mrPart)
        {
            Vector normal = mrPart.mNormal;
            double minZ   = mrPart.GetMinZPoint().Z;
            double maxZ   = mrPart.GetMaxZPoint().Z;

            double mainBeamMinZ = CMrMainBeam.GetInstance().GetMinZPoint().Z;
            double mainBeamMaxZ = CMrMainBeam.GetInstance().GetMaxZPoint().Z;

            if (CDimTools.GetInstance().CompareTwoDoubleValue(minZ, mainBeamMaxZ) >= 0)
            {
                return(true);
            }
            if (CDimTools.GetInstance().CompareTwoDoubleValue(maxZ, mainBeamMinZ) <= 0)
            {
                return(true);
            }

            return(false);
        }
Example #7
0
        /// <summary>
        /// 构建类型2的檩托板;
        /// </summary>
        /// <param name="mrPartList"></param>
        public void BuildMrApronPlateType2(List <CMrPart> mrPartList)
        {
            CDimTools.GetInstance().SortMrPartByMinY(mrPartList);

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

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

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

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

                double partMinX = mrPart.GetMinXPoint().X;
                double partMaxX = mrPart.GetMaxXPoint().X;

                if (!(CDimTools.GetInstance().CompareTwoDoubleValue(partMinX, mainBeamMinX) > 0 &&
                      CDimTools.GetInstance().CompareTwoDoubleValue(partMaxX, mainBeamMaxX) < 0))
                {
                    continue;
                }

                CMrApronPlate mrApronPlate = CreateMrApronPlateType2(mrPart, mrPartList);

                if (mrApronPlate == null)
                {
                    continue;
                }

                if (!mMapYNormalPartToMrApronPlate2.ContainsKey(mrPart))
                {
                    mMapYNormalPartToMrApronPlate2.Add(mrPart, mrApronPlate);
                }
            }
        }
Example #8
0
        /// <summary>
        /// 构建门式框架梁的拓扑结构;
        /// </summary>
        public void BuildBeamDoorTopo(List <CMrPart> mrPartList)
        {
            ClearData();

            //先赋值主梁;
            mMainBeam = CMrMainBeam.GetInstance();

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

                JudgeLeftBeam(mrPart);
                JudgeRightBeam(mrPart);
                JudgeTopBeam(mrPart);
                JudgeBottomBeam(mrPart);
                JudgeLeftAndRightBottomBeam(mrPart);
            }
            if (mBottonBeam == mTopBeam && mLeftBottomBeam != null && mRightBottomBeam != null)
            {//这个是一块板的形式;
                mBottonBeam = null;

                UpdatePartBoxPoint(mLeftBottomBeam);
                UpdatePartBoxPoint(mRightBottomBeam);

                ComputeTypeMiddleParas();
            }
            else
            {//这个是三块板的形式,下翼缘part不为空;
                mType = MrBeamDoorType.TypeNormal;

                UpdatePartBoxPoint(mTopBeam);
                UpdatePartBoxPoint(mBottonBeam);
                UpdatePartBoxPoint(mMainBeam);
            }
        }
Example #9
0
        /// <summary>
        /// 构建门式框架结构前视图中的拓扑结构;
        /// </summary>
        /// <param name="mrPartList"></param>
        public void BuildCylinderDoorFrontTopo(List <CMrPart> mrPartList)
        {
            ClearData();

            mMainBeamMinX = CMrMainBeam.GetInstance().GetMinXPoint().X;
            mMainBeamMaxX = CMrMainBeam.GetInstance().GetMaxXPoint().X;
            mMainBeamMinY = CMrMainBeam.GetInstance().GetMinYPoint().Y;
            mMainBeamMaxY = CMrMainBeam.GetInstance().GetMaxYPoint().Y;

            //判断零部件;
            foreach (CMrPart mrPart in mrPartList)
            {
                JudgeZNormalBottomPart(mrPart);
                JudgeYNormalBottomPart(mrPart);
                JudgeLeftAndLeftTopPart(mrPart);
                JudgeRightAndRightTopPart(mrPart);
            }

            //判断左侧中间以及右侧中间的零部件;
            foreach (CMrPart mrPart in mrPartList)
            {
                if (mLeftTopPart != null)
                {
                    JudgeLeftMiddlePart(mrPart);
                }
                if (mRightTopPart != null)
                {
                    JudgeRightMiddlePart(mrPart);
                }
                JudgeTopPart(mrPart);
            }

            //构建类型1的檩托板映射表;
            BuildMrApronPlateType1(mrPartList);

            //构建类型2的檩托板映射表;
            BuildMrApronPlateType2(mrPartList);
        }
Example #10
0
        /// <summary>
        /// 获取主梁右侧的标注集合;
        /// </summary>
        /// <returns></returns>
        public CMrDimSet GetYPartMainRightDimSet()
        {
            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);

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

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

            if (partMaxX < CCommonPara.mDblError)
            {
                return(null);
            }

            CMrPart mrRightPart          = CMrCylinderDoorFrontManager.GetInstance().mRightPart;
            CMrPart mrRightTopPart       = CMrCylinderDoorFrontManager.GetInstance().mRightTopPart;
            CMrPart mrRightTopMiddlePart = CMrCylinderDoorFrontManager.GetInstance().mRightTopMiddlePart;

            CMrPart mrTopPart           = CMrCylinderDoorFrontManager.GetInstance().mTopPart;
            CMrPart mrZNormalBottomPart = CMrCylinderDoorFrontManager.GetInstance().mZNormalBottomPart;
            CMrPart mrYNormalBottomPart = CMrCylinderDoorFrontManager.GetInstance().mYNormalBottomPart;

            Vector normal = mMrPart.mNormal;

            //1.如果是左下侧法向与z轴平行的零部件;
            if (mMrPart == mrZNormalBottomPart)
            {
                mrDimSet.AddPoint(mMrPart.GetMaxXMinYPoint());
                return(mrDimSet);
            }
            //2.如果是右上侧的零部件;
            if (mMrPart == mrRightTopPart)
            {
                if (CDimTools.GetInstance().CompareTwoDoubleValue(partMaxX, mainBeamMaxX) < 0)
                {
                    return(null);
                }
                else
                {
                    mrDimSet.AddPoint(mMrPart.GetMaxXMinYPoint());
                    return(mrDimSet);
                }
            }
            //3.如果是右上侧中间的零部件;
            if (mMrPart == mrRightTopMiddlePart)
            {
                mrDimSet.AddPoint(mMrPart.GetMaxXMaxYPoint());
                return(mrDimSet);
            }
            //4.如果是下侧法向与Y轴平行的零部件;
            if (mMrPart == mrYNormalBottomPart)
            {
                mrDimSet.AddPoint(mrYNormalBottomPart.GetMaxXMaxYPoint());
                mrDimSet.AddPoint(mrYNormalBottomPart.GetMaxXMinYPoint());

                return(mrDimSet);
            }
            //5.如果是上侧的零部件;
            if (mMrPart == mrTopPart)
            {
                //A.如果上侧零件的法向与Y轴平行;
                if (CDimTools.GetInstance().IsTwoVectorParallel(normal, yVector))
                {
                    mrDimSet.AddPoint(mrTopPart.GetMaxXMaxYPoint());
                    mrDimSet.AddPoint(mrTopPart.GetMaxXMinYPoint());
                    return(mrDimSet);
                }
                //B.如果法向不与Y轴平行;
                else if (CDimTools.GetInstance().IsVectorInXYPlane(normal))
                {
                    Point minYPoint = mMrPart.GetMinYPoint();
                    Point maxYPoint = mMrPart.GetMaxYPoint();

                    MrSlopeType mrSlopeType = CDimTools.GetInstance().JudgeLineSlope(minYPoint, maxYPoint);

                    if (mrSlopeType == MrSlopeType.LESSTHAN_ZERO)
                    {
                        mrDimSet.AddPoint(mMrPart.GetMaxYPoint());
                        mrDimSet.AddPoint(mMrPart.GetMaxXPoint());
                        return(mrDimSet);
                    }
                }
            }
            //6.如果向量与X轴平行,并且该零部件贴在右侧板上或右上侧板上的;
            if (CDimTools.GetInstance().IsTwoVectorParallel(normal, xVector))
            {
                //A.如果右上侧的零件不为空,并且该零件的左侧就是右上侧的板;
                if (mrRightTopPart != null && mrRightTopPart.GetMaxXMinYPoint().Y < mMrPart.GetMaxYPoint().Y)
                {
                    double rightTopMaxX = mrRightTopPart.GetMaxXPoint().X;

                    if (Math.Abs(partMinX - rightTopMaxX) < CCommonPara.mDblError)
                    {
                        mrDimSet.AddPoint(mMrPart.GetMaxXMinYPoint());

                        CMrCylinderDoorFrontManager.GetInstance().AppendRightDimPart(mMrPart);

                        return(mrDimSet);
                    }
                    else if (partMinX > rightTopMaxX)
                    {
                        CMrCylinderDoorFrontManager.GetInstance().AppendXNormalAloneDimPart(mMrPart);
                    }
                }
                //B.如果右上侧中间的零件不为空,并且该零件的左侧就是右上侧中间的板;
                if (mrRightTopMiddlePart != null && mrRightTopMiddlePart.GetMaxXMinYPoint().Y < mMrPart.GetMaxYPoint().Y)
                {
                    double rightTopMiddleMaxX = mrRightTopMiddlePart.GetMaxXPoint().X;

                    if (Math.Abs(partMinX - rightTopMiddleMaxX) < CCommonPara.mDblError)
                    {
                        mrDimSet.AddPoint(mMrPart.GetMaxXMinYPoint());

                        CMrCylinderDoorFrontManager.GetInstance().AppendRightDimPart(mMrPart);

                        return(mrDimSet);
                    }
                    else if (partMinX > rightTopMiddleMaxX)
                    {
                        CMrCylinderDoorFrontManager.GetInstance().AppendXNormalAloneDimPart(mMrPart);
                    }
                }
                //C.如果零件的左侧不是右上侧板;
                else
                {
                    double rightMaxX = mrRightPart.GetMaxXPoint().X;

                    if (Math.Abs(partMinX - rightMaxX) < CCommonPara.mDblError)
                    {
                        mrDimSet.AddPoint(mMrPart.GetMaxXMinYPoint());

                        CMrCylinderDoorFrontManager.GetInstance().AppendRightDimPart(mMrPart);

                        return(mrDimSet);
                    }
                    else if (partMinX > rightMaxX)
                    {
                        CMrCylinderDoorFrontManager.GetInstance().AppendXNormalAloneDimPart(mMrPart);
                    }
                }
            }
            //7.如果向量与Y轴平行;
            else if (CDimTools.GetInstance().IsTwoVectorParallel(normal, yVector))
            {
                double rightMaxX = mrRightPart.GetMaxXPoint().X;

                if (CDimTools.GetInstance().CompareTwoDoubleValue(partMaxX, rightMaxX) > 0 &&
                    CDimTools.GetInstance().CompareTwoDoubleValue(partMinX, rightMaxX) <= 0)
                {
                    CMrApronPlate mrApronPlate = CMrCylinderDoorFrontManager.GetInstance().FindMrApronPlateByYNormalPart(mMrPart);

                    if (mrApronPlate != null)
                    {
                        if (mrApronPlate.mIsUp == true)
                        {
                            mrDimSet.AddPoint(mMrPart.GetMaxXMinYPoint());
                        }
                        else
                        {
                            mrDimSet.AddPoint(mMrPart.GetMaxXMaxYPoint());
                        }
                    }
                    else
                    {
                        mrDimSet.AddPoint(mMrPart.GetMaxXMaxYPoint());
                    }

                    CMrCylinderDoorFrontManager.GetInstance().AppendRightDimPart(mMrPart);
                }
                else if (IsYNormalPartInMainBeamMiddle(mMrPart))
                {
                    CMrCylinderDoorFrontManager.GetInstance().AppendYNormalMiddleDimPart(mMrPart);

                    return(null);
                }
            }
            return(mrDimSet);
        }
Example #11
0
        /// <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);
        }
Example #12
0
        /// <summary>
        /// 获取主梁左侧的标注集合;
        /// </summary>
        /// <returns></returns>
        public CMrDimSet GetYPartMainLeftDimSet()
        {
            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);

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

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

            CMrPart mrLeftPart          = CMrCylinderDoorFrontManager.GetInstance().mLeftPart;
            CMrPart mrLeftTopPart       = CMrCylinderDoorFrontManager.GetInstance().mLeftTopPart;
            CMrPart mrLeftTopMiddlePart = CMrCylinderDoorFrontManager.GetInstance().mLeftTopMiddlePart;
            CMrPart mrZNormalBottomPart = CMrCylinderDoorFrontManager.GetInstance().mZNormalBottomPart;
            CMrPart mrYNormalBottomPart = CMrCylinderDoorFrontManager.GetInstance().mYNormalBottomPart;
            CMrPart mrTopPart           = CMrCylinderDoorFrontManager.GetInstance().mTopPart;
            CMrPart mrRightPart         = CMrCylinderDoorFrontManager.GetInstance().mRightPart;

            Vector normal = mMrPart.mNormal;

            //1.如果是左下侧法向与z轴平行的零部件;
            if (mMrPart == mrZNormalBottomPart)
            {
                mrDimSet.AddPoint(mMrPart.GetMinXMinYPoint());
                return(mrDimSet);
            }
            //2.如果是左侧上方的零部件;
            if (mMrPart == mrLeftTopPart)
            {
                if (CDimTools.GetInstance().CompareTwoDoubleValue(partMinX, mainBeamMinX) > 0)
                {
                    return(null);
                }
                else
                {
                    mrDimSet.AddPoint(mMrPart.GetMinXMinYPoint());
                    return(mrDimSet);
                }
            }
            //3.如果是左上侧上方中间的零部件;
            if (mMrPart == mrLeftTopMiddlePart)
            {
                mrDimSet.AddPoint(mMrPart.GetMinXMaxYPoint());
                return(mrDimSet);
            }
            //4.如果是下侧法向与Y轴平行的零部件;
            if (mMrPart == mrYNormalBottomPart)
            {
                mrDimSet.AddPoint(mrYNormalBottomPart.GetMinXMaxYPoint());
                mrDimSet.AddPoint(mrYNormalBottomPart.GetMinXMinYPoint());
                return(mrDimSet);
            }
            //5.如果是上侧的零部件;
            if (mMrPart == mrTopPart)
            {
                //如果上侧零件的法向与Y轴平行;
                if (CDimTools.GetInstance().IsTwoVectorParallel(normal, yVector))
                {
                    mrDimSet.AddPoint(mrTopPart.GetMinXMaxYPoint());
                    mrDimSet.AddPoint(mrTopPart.GetMinXMinYPoint());
                    return(mrDimSet);
                }
                //如果法向不与Y轴平行;
                else if (CDimTools.GetInstance().IsVectorInXYPlane(normal))
                {
                    Point maxYPoint = mMrPart.GetMaxYPoint();
                    Point minYPoint = mMrPart.GetMinYPoint();

                    MrSlopeType mrSlopeType = CDimTools.GetInstance().JudgeLineSlope(minYPoint, maxYPoint);

                    if (mrSlopeType == MrSlopeType.MORETHAN_ZERO)
                    {
                        mrDimSet.AddPoint(mMrPart.GetMaxYPoint());
                        mrDimSet.AddPoint(mMrPart.GetMinXPoint());
                        return(mrDimSet);
                    }
                }
            }

            double leftMinX = mrLeftPart.GetMinXPoint().X;

            //6.如果向量与X轴平行,并且该零部件贴在左侧板上;
            if (CDimTools.GetInstance().IsTwoVectorParallel(normal, xVector))
            {
                //A:如果左上侧零部件不为空;
                if (mrLeftTopPart != null && mrLeftTopPart.GetMinXMinYPoint().Y < mMrPart.GetMaxYPoint().Y)
                {
                    double leftTopMinX = mrLeftTopPart.GetMinXPoint().X;

                    if (Math.Abs(partMaxX - leftTopMinX) < CCommonPara.mDblError)
                    {
                        mrDimSet.AddPoint(mMrPart.GetMinXMinYPoint());

                        return(mrDimSet);
                    }
                    else if (partMaxX < leftTopMinX)
                    {
                        CMrCylinderDoorFrontManager.GetInstance().AppendXNormalAloneDimPart(mMrPart);
                    }
                }
                //B:如果左上侧中间零件不为空;
                if (mrLeftTopMiddlePart != null && mrLeftTopMiddlePart.GetMinXMinYPoint().Y < mMrPart.GetMaxYPoint().Y)
                {
                    double leftTopMiddleMinX = mrLeftTopMiddlePart.GetMinXPoint().X;

                    if (Math.Abs(partMaxX - leftTopMiddleMinX) < CCommonPara.mDblError)
                    {
                        mrDimSet.AddPoint(mMrPart.GetMinXMinYPoint());

                        return(mrDimSet);
                    }
                    else if (partMaxX < leftTopMiddleMinX)
                    {
                        CMrCylinderDoorFrontManager.GetInstance().AppendXNormalAloneDimPart(mMrPart);
                    }
                }
                else
                {
                    if (Math.Abs(partMaxX - leftMinX) < CCommonPara.mDblError)
                    {
                        mrDimSet.AddPoint(mMrPart.GetMinXMinYPoint());

                        return(mrDimSet);
                    }
                    else if (partMaxX < leftMinX)
                    {
                        CMrCylinderDoorFrontManager.GetInstance().AppendXNormalAloneDimPart(mMrPart);
                    }
                }
            }
            //7.如果向量与Y轴平行;
            else if (CDimTools.GetInstance().IsTwoVectorParallel(normal, yVector))
            {
                if (CDimTools.GetInstance().CompareTwoDoubleValue(partMinX, leftMinX) < 0 &&
                    CDimTools.GetInstance().CompareTwoDoubleValue(partMaxX, leftMinX) >= 0)
                {
                    CMrApronPlate mrApronPlate = CMrCylinderDoorFrontManager.GetInstance().FindMrApronPlateByYNormalPart(mMrPart);

                    if (mrApronPlate != null)
                    {
                        if (mrApronPlate.mIsUp == true)
                        {
                            mrDimSet.AddPoint(mMrPart.GetMaxXMinYPoint());
                        }
                        else
                        {
                            mrDimSet.AddPoint(mMrPart.GetMinXMaxYPoint());
                        }
                    }
                    else
                    {
                        mrDimSet.AddPoint(mMrPart.GetMinXMaxYPoint());
                    }
                }
            }
            return(mrDimSet);
        }
 /// <summary>
 /// 设置实例;
 /// </summary>
 /// <param name="instance"></param>
 public static void SetInstance(CMrMainBeam instance)
 {
     mInstance = instance;
 }