예제 #1
0
        /// <summary>
        /// 获取图纸中的视图信息;
        /// </summary>
        private void GetDrawingViewInfo()
        {
            DrawingObjectEnumerator allViews = mAssemblyDrawing.GetSheet().GetAllViews();

            while (allViews.MoveNext())
            {
                if (allViews.Current == null)
                {
                    continue;
                }

                TSD.View view = allViews.Current as TSD.View;

                if (view == null)
                {
                    continue;
                }

                view.Select();

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

                double dblFlangeThickness = 0.0;
                double dblWebThickness    = 0.0;

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

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

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

                if (size == 0 || size == 1)
                {
                    continue;
                }

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

                CDimTools.GetInstance().InitMrPart(mMainPart, view, mainBeam);

                Vector vector         = mainBeam.mNormal;
                double minY           = mainBeam.GetMinYPoint().Y;
                double maxY           = mainBeam.GetMaxYPoint().Y;
                double mainBeamHeight = Math.Abs(maxY - minY);

                //顶视图标注;
                if (CDimTools.GetInstance().IsTwoVectorParallel(vector, xVector))
                {
                    Point viewMinPoint = view.RestrictionBox.MinPoint;
                    Point viewMaxPoint = view.RestrictionBox.MaxPoint;

                    double viewHeight = Math.Abs(viewMaxPoint.Y - viewMinPoint.Y);

                    if (CDimTools.GetInstance().CompareTwoDoubleValue(viewHeight, mainBeamHeight) >= 0)
                    {
                        continue;
                    }
                    else
                    {
                        mAllSectionViewList.Add(view);
                    }
                }
                //前视图标注;
                else if (CDimTools.GetInstance().IsTwoVectorParallel(vector, zVector))
                {
                    Point viewMinPoint = view.RestrictionBox.MinPoint;
                    Point viewMaxPoint = view.RestrictionBox.MaxPoint;

                    double viewHeight = Math.Abs(viewMaxPoint.Y - viewMinPoint.Y);

                    if (CDimTools.GetInstance().CompareTwoDoubleValue(viewHeight, mainBeamHeight) >= 0)
                    {
                        mFrontView = view;
                    }
                    else
                    {
                        mAllSectionViewList.Add(view);
                    }
                }
                //剖视图标注;
                else
                {
                    mAllSectionViewList.Add(view);
                }
            }
        }
예제 #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();
                }
            }
        }