Example #1
0
        /// <summary>
        /// 框架结构的一键标注;
        /// </summary>
        /// <param name="nType"></param>
        public void DrawDrawingOneKey(string strDimType)
        {
            DrawingHandler drawingHandler = new DrawingHandler();
            Drawing        drawing        = drawingHandler.GetActiveDrawing();

            if (null == drawing)
            {
                return;
            }
            AssemblyDrawing assemblyDrawing = drawing as AssemblyDrawing;

            if (assemblyDrawing == null)
            {
                return;
            }
//             try
//             {
            Assembly assembly = new Assembly
            {
                Identifier = assemblyDrawing.AssemblyIdentifier
            };

            assembly.Select();
            Identifier identifier = assembly.GetMainPart().Identifier;

            TSM.Part modelObject = mModel.SelectModelObject(identifier) as TSM.Part;

            //1.首先创建自动剖面;
            if (CCommonPara.mAutoSectionType == MrAutoSectionType.MrOneKeyDim || CCommonPara.mAutoSectionType == MrAutoSectionType.MrTwoTypeDim)
            {
                CreateAutoSection(strDimType, modelObject, assemblyDrawing);
            }

            //2.对图纸进行标注;
            DrawingObjectEnumerator allViews = assemblyDrawing.GetSheet().GetAllViews();

            while (allViews.MoveNext())
            {
                if (allViews.Current != null)
                {
                    TSD.View view = allViews.Current as TSD.View;

                    if (view != null)
                    {
                        DrawDrawingByView(view, modelObject, strDimType);
                    }
                }
            }
            assemblyDrawing.IsFrozen = true;
            assemblyDrawing.PlaceViews();
            assemblyDrawing.Modify();
//             }
//             catch (System.Exception ex)
//             {
//                 string strName = assemblyDrawing.Name;
//                 MessageBox.Show("图纸" + strName + "标注失败,请确认模型或图纸内是否有问题。异常信息:" + ex.Message);
//             }

            MessageBox.Show("扬州Tekla培训石头哥提示您标注结束,感谢您对智能标注系统的支持。");
        }
Example #2
0
        /// <summary>
        /// 绘制门式框架结构中选择的多张图纸;
        /// </summary>
        public void DrawSelectListDrawingDoor()
        {
            DrawingHandler drawingHandler = new DrawingHandler();

            foreach (CMrAssemblyDrawing mrDrawing in mrAssemblyDrawingList)
            {
                AssemblyDrawing assemblyDrawing = mrDrawing.mAssemblyDring;

                Identifier assemblyDrawingIdentifier = assemblyDrawing.AssemblyIdentifier;

                if (assemblyDrawing == null)
                {
                    continue;
                }
                try
                {
                    Assembly assembly = new Assembly
                    {
                        Identifier = assemblyDrawing.AssemblyIdentifier
                    };

                    assembly.Select();
                    Identifier identifier  = assembly.GetMainPart().Identifier;
                    Beam       modelObject = mModel.SelectModelObject(identifier) as Beam;
                    drawingHandler.SetActiveDrawing(assemblyDrawing, true);
                    DrawingObjectEnumerator allViews = assemblyDrawing.GetSheet().GetAllViews();

                    while (allViews.MoveNext())
                    {
                        if (allViews.Current != null)
                        {
                            TSD.View view = allViews.Current as TSD.View;

                            if (view != null)
                            {
                                DrawDrawingDoorByView(view, modelObject, mrDrawing.mDimType);
                            }
                        }
                    }
                    assemblyDrawing.IsFrozen = true;
                    assemblyDrawing.PlaceViews();
                    assemblyDrawing.Modify();
                    drawingHandler.SaveActiveDrawing();
                    drawingHandler.CloseActiveDrawing();
                }
                catch (System.Exception ex)
                {
                    string strName = assemblyDrawing.Name;

                    MessageBox.Show("图纸" + strName + "标注失败,请确认模型或图纸内是否有问题。异常信息:" + ex.Message);
                    drawingHandler.SaveActiveDrawing();
                    drawingHandler.CloseActiveDrawing();
                    continue;
                }
            }
            MessageBox.Show("扬州Tekla培训石头哥提示您标注结束,感谢您对智能标注系统的支持。");
        }
Example #3
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);
                }
            }
        }
Example #4
0
        /// <summary>
        /// 门式框架结构的一键标注;
        /// </summary>
        /// <param name="nType"></param>
        public void DrawDrawingDoorOneKey(string strDimType)
        {
            DrawingHandler drawingHandler = new DrawingHandler();
            Drawing        drawing        = drawingHandler.GetActiveDrawing();

            if (null == drawing)
            {
                return;
            }
            AssemblyDrawing assemblyDrawing = drawing as AssemblyDrawing;

            if (assemblyDrawing == null)
            {
                return;
            }
            try
            {
                Assembly assembly = new Assembly
                {
                    Identifier = assemblyDrawing.AssemblyIdentifier
                };

                assembly.Select();
                Identifier identifier  = assembly.GetMainPart().Identifier;
                TSM.Part   modelObject = mModel.SelectModelObject(identifier) as TSM.Part;

                if (modelObject == null)
                {
                    MessageBox.Show("标注失败,无法获取主梁对象!");
                    return;
                }

                //1.首先创建门刚的自动剖面;
                //CreateAutoSectionDoor(strDimType, modelObject, assemblyDrawing);

                DrawingObjectEnumerator allViews = assemblyDrawing.GetSheet().GetAllViews();

                while (allViews.MoveNext())
                {
                    if (allViews.Current != null)
                    {
                        TSD.View view = allViews.Current as TSD.View;

                        if (view != null)
                        {
                            DrawDrawingDoorByView(view, modelObject, strDimType);
                        }
                    }
                }
                assemblyDrawing.IsFrozen = true;
                assemblyDrawing.PlaceViews();
                assemblyDrawing.Modify();
            }
            catch (System.Exception ex)
            {
                string strName = assemblyDrawing.Name;

                MessageBox.Show("图纸" + strName + "标注失败,请确认模型或图纸内是否有问题。异常信息:" + ex.Message);
            }

            MessageBox.Show("扬州Tekla培训石头哥提示您标注结束,感谢您对智能标注系统的支持。");
        }
Example #5
0
        /// <summary>
        /// 线程图纸标注函数;
        /// </summary>
        /// <param name="message"></param>
        private void DimDrawingThreadFunc(object message)
        {
            DrawingHandler drawingHandler = new DrawingHandler();

            int nIndex = 0;
            int nCount = mrAssemblyDrawingList.Count;

            mMainForm.SetWholeProgressMax(nCount);

            string strCurrentTips = "";
            string strWholeTips   = "";

            foreach (CMrAssemblyDrawing mrDrawing in mrAssemblyDrawingList)
            {
                nIndex++;
                mMainForm.SetWholeProgressPos(nIndex);
                strWholeTips = "总进度:" + nIndex + "/" + nCount.ToString();
                mMainForm.SetWholeLabelText(strWholeTips);

                int             nViewIndex                = 0;
                AssemblyDrawing assemblyDrawing           = mrDrawing.mAssemblyDring;
                Identifier      assemblyDrawingIdentifier = assemblyDrawing.AssemblyIdentifier;

                if (assemblyDrawing == null)
                {
                    continue;
                }
                try
                {
                    Assembly assembly = new Assembly
                    {
                        Identifier = assemblyDrawing.AssemblyIdentifier
                    };

                    assembly.Select();
                    Identifier identifier  = assembly.GetMainPart().Identifier;
                    Beam       modelObject = mModel.SelectModelObject(identifier) as Beam;
                    drawingHandler.SetActiveDrawing(assemblyDrawing, true);
                    DrawingObjectEnumerator allViews = assemblyDrawing.GetSheet().GetAllViews();

                    //1.判断是否需要创建自动剖面;
                    if (CCommonPara.mAutoSectionType == MrAutoSectionType.MrListDim || CCommonPara.mAutoSectionType == MrAutoSectionType.MrTwoTypeDim)
                    {
                        CreateAutoSection(mrDrawing.mDimType, modelObject, assemblyDrawing);
                    }

                    int nViewCount = allViews.GetSize();
                    mMainForm.SetCurrentProgressMax(nViewCount);

                    while (allViews.MoveNext())
                    {
                        if (allViews.Current != null)
                        {
                            nViewIndex++;
                            mMainForm.SetCurrentProgressPos(nViewIndex);
                            strCurrentTips = "当前进度:" + nViewIndex + "/" + nViewCount.ToString();
                            mMainForm.SetCurrentLabelText(strCurrentTips);

                            TSD.View view = allViews.Current as TSD.View;
                            if (view != null)
                            {
                                DrawDrawingByView(view, modelObject, mrDrawing.mDimType);
                            }
                        }
                    }
                    assemblyDrawing.IsFrozen = true;
                    assemblyDrawing.PlaceViews();
                    assemblyDrawing.Modify();
                    drawingHandler.SaveActiveDrawing();
                    drawingHandler.CloseActiveDrawing();
                }
                catch (System.Exception ex)
                {
                    string strName = assemblyDrawing.Name;
                    MessageBox.Show("图纸" + strName + "标注失败,请确认模型或图纸内是否有问题。异常信息:" + ex.Message);
                    drawingHandler.SaveActiveDrawing();
                    drawingHandler.CloseActiveDrawing();

                    nIndex++;
                    mMainForm.SetWholeProgressPos(nIndex);
                    strWholeTips = "总进度:" + nIndex + "/" + nCount.ToString();
                    mMainForm.SetWholeLabelText(strWholeTips);
                    continue;
                }
            }

            MessageBox.Show("扬州Tekla培训石头哥提示您标注结束,感谢您对智能标注系统的支持。");
        }