예제 #1
0
        /// <summary>
        /// 创建柱的门式框架结构顶视图;
        /// </summary>
        public void CreateCylinderDoorTopView()
        {
            ViewBase  topViewBase = null;
            PointList pointList   = new PointList();

            CDimTools.GetInstance().PickPoints(1, ref pointList, ref topViewBase);

            if (topViewBase != null)
            {
                topViewBase.Select();
                TSD.View             topView  = topViewBase as TSD.View;
                CCylinderDoorTopView mTopView = new CCylinderDoorTopView(topView, mModel);

                InitMainPart();
                InitView(topView);
                mTopView.CreateDim();
            }
        }
예제 #2
0
        /// <summary>
        /// 根据视图绘制门式框架结构的图纸;
        /// </summary>
        /// <param name="view"></param>
        /// <param name="mainPart"></param>
        /// <param name="strDimType"></param>
        private void DrawDrawingDoorByView(TSD.View view, TSM.Part mainPart, string strDimType)
        {
            view.Select();

            //创建自定义的主梁对象;
            CMrMainBeam mainBeam = new CMrMainBeam(mainPart, null);

            CMrMainBeam.SetInstance(mainBeam);

            double dblFlangeThickness = 0.0;
            double dblWebThickness    = 0.0;

            mainPart.GetReportProperty("PROFILE.FLANGE_THICKNESS", ref dblFlangeThickness);
            mainPart.GetReportProperty("PROFILE.WEB_THICKNESS", ref dblWebThickness);

            mainBeam.mFlangeThickness = dblFlangeThickness;
            mainBeam.mWebThickness    = dblWebThickness;

            int size = view.GetObjects(new Type[] { typeof(TSD.Part) }).GetSize();

            //如果零部件个数为0或1分别表示空视图和零件图则不进行标注;
            if (size == 0 || size == 1)
            {
                return;
            }

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

            CDimTools.GetInstance().InitMrPart(mainPart, view, mainBeam);
            Vector vector = mainBeam.mNormal;

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

            double mainBeamHeight = Math.Abs(maxY - minY);
            double mainBeamWidth  = Math.Abs(maxX - minX);

            if (strDimType == "梁标注")
            {
                Point  viewMinPoint = view.RestrictionBox.MinPoint;
                Point  viewMaxPoint = view.RestrictionBox.MaxPoint;
                double viewWidth    = Math.Abs(viewMaxPoint.X - viewMinPoint.X);

                //顶视图不需要进行标注;
                if (CDimTools.GetInstance().IsTwoVectorParallel(vector, yVector) &&
                    CDimTools.GetInstance().CompareTwoDoubleValue(viewWidth, mainBeamWidth) >= 0)
                {
                }
                //主视图标注;
                else if (CDimTools.GetInstance().IsTwoVectorParallel(vector, zVector) &&
                         CDimTools.GetInstance().CompareTwoDoubleValue(viewWidth, mainBeamWidth) >= 0)
                {
                    CBeamDoorFrontView mFrontView = new CBeamDoorFrontView(view, mModel);
                    InitView(view);
                    mFrontView.CreateDim();
                }
                //剖视图标注;
                else
                {
                    CBeamDoorSectionView mSectionView = new CBeamDoorSectionView(view, mModel);
                    InitView(view);
                    mSectionView.CreateDim();
                }
            }
            else if (strDimType == "柱标注")
            {
                Point  viewMinPoint = view.RestrictionBox.MinPoint;
                Point  viewMaxPoint = view.RestrictionBox.MaxPoint;
                double viewHeight   = Math.Abs(viewMaxPoint.Y - viewMinPoint.Y);

                //顶视图标注;
                if (CDimTools.GetInstance().IsTwoVectorParallel(vector, xVector) &&
                    CDimTools.GetInstance().CompareTwoDoubleValue(viewHeight, mainBeamHeight) >= 0)
                {
                    CCylinderDoorTopView mTopView = new CCylinderDoorTopView(view, mModel);
                    InitView(view);
                    mTopView.CreateDim();
                }
                //主视图标注;
                else if (CDimTools.GetInstance().IsTwoVectorParallel(vector, zVector) &&
                         CDimTools.GetInstance().CompareTwoDoubleValue(viewHeight, mainBeamHeight) >= 0)
                {
                    CCylinderDoorFrontView mFrontView = new CCylinderDoorFrontView(view, mModel);
                    InitView(view);
                    mFrontView.CreateDim();
                }
                //剖视图标注;
                else
                {
                    CCylinderDoorSectionView mSectionView = new CCylinderDoorSectionView(view, mModel);
                    InitView(view);
                    mSectionView.CreateDim();
                }
            }
        }