示例#1
0
        /// <summary>
        /// 柱的剖视图标注;
        /// </summary>
        public void CreateCylinderSectionView()
        {
            ViewBase  sectionViewBase = null;
            PointList pointList       = new PointList();

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

            if (sectionViewBase != null)
            {
                sectionViewBase.Select();
                TSD.View             sectionView  = sectionViewBase as TSD.View;
                CCylinderSectionView mSectionView = new CCylinderSectionView(sectionView, mModel);

                InitMainPart();
                InitView(sectionView);
                mSectionView.CreateDim();
            }
        }
示例#2
0
        /// <summary>
        /// 根据选择的View来进行标注;
        /// </summary>
        private void DrawDrawingByView(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)
                {
                    CBeamTopView mTopView = new CBeamTopView(view, mModel);
                    InitView(view);
                    mTopView.CreateDim();
                }
                //主视图标注;
                else if (CDimTools.GetInstance().IsTwoVectorParallel(vector, zVector) &&
                         CDimTools.GetInstance().CompareTwoDoubleValue(viewWidth, mainBeamWidth) >= 0)
                {
                    CBeamFrontView mFrontView = new CBeamFrontView(view, mModel);
                    InitView(view);
                    mFrontView.CreateDim();
                }
                //剖视图标注;
                else
                {
                    CBeamSectionView mSectionView = new CBeamSectionView(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)
                {
                    CCylinderTopView mTopView = new CCylinderTopView(view, mModel);
                    InitView(view);
                    mTopView.CreateDim();
                }
                //主视图标注;
                else if (CDimTools.GetInstance().IsTwoVectorParallel(vector, zVector) &&
                         CDimTools.GetInstance().CompareTwoDoubleValue(viewHeight, mainBeamHeight) >= 0)
                {
                    CCylinderFrontView mFrontView = new CCylinderFrontView(view, mModel);
                    InitView(view);
                    mFrontView.CreateDim();
                }
                //剖视图标注;
                else
                {
                    CCylinderSectionView mSectionView = new CCylinderSectionView(view, mModel);
                    InitView(view);
                    mSectionView.CreateDim();
                }
            }
        }