Exemplo n.º 1
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培训石头哥提示您标注结束,感谢您对智能标注系统的支持。");
        }
Exemplo n.º 2
0
        private void WorkerThread_DoWork(object sender, DoWorkEventArgs e)
        {
            DrawingHandler dh       = new DrawingHandler();
            List <Drawing> drawings = Com.EnumtoArrayDr(dh.GetDrawingSelector().GetSelected()).OfType <TSD.Drawing>().ToList().OrderBy(x => x.Title1).ToList();
            int            count    = 1;

            foreach (TSD.Drawing Dr in drawings)
            {
                string msg = "Total Drawings" + " - Total : " + drawings.Count.ToString() + " Remaining : " + (drawings.Count - count);

                workerThread.ReportProgress(count, msg);
                if (workerThread.CancellationPending)
                {
                    e.Cancel = true;
                    break;
                }

                try
                {
                    if (dh.SetActiveDrawing(Dr, true))
                    {
                        CD.ProceedDrawing(Dr, chkDeleteDim.Checked, lbCode);
                        dh.SaveActiveDrawing();
                        dh.CloseActiveDrawing(true);
                    }
                }
                catch (Exception ex)
                { }
                count++;
            }
        }
Exemplo n.º 3
0
        public static void Run(Tekla.Technology.Akit.IScript akit)
        {
            DrawingHandler    DrawingHandler = new DrawingHandler();
            DrawingEnumerator DrawingEnum    = DrawingHandler.GetDrawingSelector().GetSelected();

            if (DrawingEnum.GetSize() == 0)
            {
                // No drawings selected
                MessageBox.Show("No Drawings Selected");
                return;
            }

            while (DrawingEnum.MoveNext())
            {
                Drawing Drawing = DrawingEnum.Current;
                DrawingHandler.SetActiveDrawing(Drawing, false);
                DrawingObjectEnumerator DrawingObjEnum = Drawing.GetSheet().GetAllObjects();
                ArrayList MarkArray = new ArrayList();
                ArrayList PartArray = new ArrayList();
                while (DrawingObjEnum.MoveNext())
                {
                    if (DrawingObjEnum.Current is MarkBase)
                    {
                        MarkArray.Add(DrawingObjEnum.Current);
                    }

                    if (DrawingObjEnum.Current is Tekla.Structures.Drawing.Part || DrawingObjEnum.Current is Tekla.Structures.Drawing.Bolt)
                    {
                        PartArray.Add(DrawingObjEnum.Current);
                    }
                }
                DrawingHandler.GetDrawingObjectSelector().SelectObjects(MarkArray, true);

                // part mark properties
                akit.Callback("acmd_display_selected_drawing_object_dialog", "", "main_frame");
                akit.TabChange("pmark_dial", "Container_2", "gr_mark_general_tab");
                akit.PushButton("gr_pmark_place", "pmark_dial");
                akit.ValueChange("pmpl_dial", "text_placing_mode", "1");
                akit.PushButton("txpl_modify", "pmpl_dial");
                akit.PushButton("txpl_cancel", "pmpl_dial");
                akit.PushButton("pmark_cancel", "pmark_dial");

                // bolt mark properties
                akit.Callback("acmd_display_attr_dialog", "smark_dial", "main_frame");
                akit.TabChange("smark_dial", "Container_217", "gr_mark_general_tab");
                akit.PushButton("gr_smark_place", "smark_dial");
                akit.ValueChange("smpl_dial", "text_placing_mode", "1");
                akit.PushButton("txpl_modify", "smpl_dial");
                akit.PushButton("txpl_cancel", "smpl_dial");
                akit.PushButton("smark_cancel", "smark_dial");

                // connection mark properties
                akit.Callback("acmd_display_attr_dialog", "jmark_dial", "main_frame");
                akit.TabChange("jmark_dial", "Container_217", "gr_mark_general_tab");
                akit.PushButton("gr_jmark_place", "jmark_dial");
                akit.ValueChange("jmpl_dial", "text_placing_mode", "1");
                akit.PushButton("txpl_modify", "jmpl_dial");
                akit.PushButton("txpl_cancel", "jmpl_dial");
                akit.PushButton("jmark_cancel", "jmark_dial");

                DrawingHandler.GetDrawingObjectSelector().UnselectAllObjects();
                DrawingHandler.GetDrawingObjectSelector().SelectObjects(PartArray, true);
                akit.Callback("acmd_update_marks_selected", "", "main_frame");

                DrawingHandler.SaveActiveDrawing();
                DrawingHandler.CloseActiveDrawing();
            }
        }
Exemplo n.º 4
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培训石头哥提示您标注结束,感谢您对智能标注系统的支持。");
        }