public static dynamic GetTSObject(GADrawing dynObject)
 {
     if (dynObject is null)
     {
         return(null);
     }
     return(dynObject.teklaObject);
 }
Ejemplo n.º 2
0
        private void button1_Click(object sender, EventArgs e)
        {
            DrawingHandler drawingHandler = new DrawingHandler();
            Drawing        drawing        = drawingHandler.GetActiveDrawing();

            if (drawing == null)
            {
                int number = int.Parse(textBox1.Text);
                for (int i = 1; i <= number; i++)
                {
                    Tekla.Structures.Drawing.Size    size         = new Tekla.Structures.Drawing.Size(410, 287);
                    Tekla.Structures.Drawing.Drawing newGADrawing = new GADrawing("standard", size);
                    newGADrawing.Insert();
                }
            }
            else
            {
                MessageBox.Show("Close active drawing first");
            }
        }
Ejemplo n.º 3
0
 private void btnDibujar_Click(object sender, EventArgs e)
 {
     DrawingHandler drawingHandler = new DrawingHandler();
     GADrawing      drawing        = new GADrawing();
 }
Ejemplo n.º 4
0
        private void button1_Click(object sender, EventArgs e)
        {
            TransformationPlane current = Model.GetWorkPlaneHandler().GetCurrentTransformationPlane(); //Глобальная плоскость

            try
            {
                Model.GetWorkPlaneHandler().SetCurrentTransformationPlane(new TransformationPlane());
                ModelObjectEnumerator selectedModelObjects = new Tekla.Structures.Model.UI.ModelObjectSelector().GetSelectedObjects();

                GADrawing MyDrawing = null;
                while (selectedModelObjects.MoveNext())
                {
                    Tekla.Structures.Geometry3d.CoordinateSystem ModelObjectCoordSys;
                    string ModelObjectName;

                    GetCoordinateSystemAndNameOfSelectedObject(selectedModelObjects, out ModelObjectCoordSys, out ModelObjectName);

                    //создание нового общего чертежа
                    string DrawingName = "PartBasicViews" + (selectedModelObjects.Current as Tekla.Structures.Model.ModelObject).Identifier;
                    MyDrawing = new GADrawing(DrawingName, "standard");
                    MyDrawing.Insert();

                    if (openDrawings.Checked)
                    {
                        DrawingHandler.SetActiveDrawing(MyDrawing, true); //Открытие чертежа в редакторе
                    }
                    else
                    {
                        DrawingHandler.SetActiveDrawing(MyDrawing, false); //Открытие чертежа в невидимом режиме
                    }
                    ArrayList Parts = new ArrayList();

                    if (selectedModelObjects.Current is Tekla.Structures.Model.Part)
                    {
                        Parts.Add(selectedModelObjects.Current.Identifier);
                    }
                    else if (selectedModelObjects.Current is Tekla.Structures.Model.Assembly)
                    {
                        Parts = GetAssemblyParts(selectedModelObjects.Current as Tekla.Structures.Model.Assembly);
                    }
                    else if (selectedModelObjects.Current is Tekla.Structures.Model.BaseComponent)
                    {
                        Parts = GetComponentParts(selectedModelObjects.Current as Tekla.Structures.Model.BaseComponent);
                    }

                    CreateViews(ModelObjectCoordSys, ModelObjectName, MyDrawing, Parts);
                    MyDrawing.PlaceViews();

                    DrawingHandler.CloseActiveDrawing(true); //Сохранение и закрытие активного окна
                }

                if (MyDrawing != null && openDrawings.Checked)
                {
                    DrawingHandler.SetActiveDrawing(MyDrawing);
                }

                Model.GetWorkPlaneHandler().SetCurrentTransformationPlane(current); //возврат исходной плоскости
            }
            catch (Exception exception)
            {
                Model.GetWorkPlaneHandler().SetCurrentTransformationPlane(current);
                MessageBox.Show(exception.ToString());
            }
        }
Ejemplo n.º 5
0
 private void CreateViews(Tekla.Structures.Geometry3d.CoordinateSystem ModelObjectCoordSys, string ModelObjectName, GADrawing MyDrawing, ArrayList Parts)
 {
     if (createFrontView.Checked)
     {
         AddViews("Front View of" + ModelObjectName, MyDrawing, Parts, GetBasicViewsCoordinateSystemForFrontView(ModelObjectCoordSys));
     }
     if (createTopView.Checked)
     {
         AddViews("Top View of" + ModelObjectName, MyDrawing, Parts, GetBasicViewsCoordinateSystemForTopView(ModelObjectCoordSys));
     }
     if (createEndView.Checked)
     {
         AddViews("End View of" + ModelObjectName, MyDrawing, Parts, GetBasicViewsCoordinateSystemForEndView(ModelObjectCoordSys));
     }
     if (create3dView.Checked)
     {
         AddViews("3d View of" + ModelObjectName, MyDrawing, Parts, GetBasicViewsCoordinateSystemForFrontView(ModelObjectCoordSys));
     }
 }