Пример #1
0
        private Tuple <TSG.Point, TSDrg.View> getPointFromUser()
        {
            TSDrg.DrawingHandler myDrawingHandler = new TSDrg.DrawingHandler();
            TSDrg.UI.Picker      pointPicker      = myDrawingHandler.GetPicker();
            TSG.Point            myPoint          = null;
            TSDrg.ViewBase       myViewBase       = null;
            TSDrg.View           myView           = myViewBase as TSDrg.View;

            try
            {
                pointPicker.PickPoint("Pick a point to insert an FCR note", out myPoint, out myViewBase);
                myView = myViewBase as TSDrg.View;

                while (myView == null)
                {
                    pointPicker.PickPoint("Selected point is not inside a view. Pick a point to insert an FCR note", out myPoint, out myViewBase);
                    myView = myViewBase as TSDrg.View;
                }

                return(new Tuple <TSG.Point, TSDrg.View>(myPoint, myView));
            }

            catch (Tekla.Structures.Drawing.PickerInterruptedException interrupted)
            {
                //Tekla.Structures.Model.Operations.Operation.DisplayPrompt("THIS METHOD NOT WORKING BECAUSE TEKLA API IS THE WORST THING I HAVE EVER WORKED WITH");
                lbl_info.Text = "User interrupted action.";
                return(new Tuple <TSG.Point, TSDrg.View>(myPoint, myView));
            }
        }
Пример #2
0
        private static void getPoint(__DrawingData drawing)
        {
            TSD.DrawingHandler drawingHandler = new TSD.DrawingHandler();

            if (drawingHandler.GetConnectionStatus())
            {
                TSD.ContainerView sheet = drawingHandler.GetActiveDrawing().GetSheet();

                TSD.UI.Picker picker       = drawingHandler.GetPicker();
                T3D.Point     viewPoint    = null;
                TSD.ViewBase  selectedView = null;

                MainForm._form.add_text("Select origin point in drawing view");
                picker.PickPoint("Pick one point", out viewPoint, out selectedView);
                T3D.Point sheetPoint = TSD.Tools.DrawingCoordinateConverter.Convert(selectedView, sheet, viewPoint);

                if (selectedView != null)
                {
                    if (selectedView is TSD.View)
                    {
                        drawing.setView(selectedView as TSD.View);
                    }
                }

                drawing.setSheet(sheet);
                drawing.setPoints(viewPoint, sheetPoint);
            }
        }
Пример #3
0
        private void PasteObjects_Click(object sender, EventArgs e)
        {
            try
            {
                Drawing drawing = drawingHandler.GetActiveDrawing();

                if (selectedPartsArray.Count > 0)
                {
                    Tekla.Structures.Drawing.View view = new Tekla.Structures.Drawing.View(drawing.GetSheet(), v.ViewCoordinateSystem, v.DisplayCoordinateSystem, selectedPartsArray);
                    view.Insert();
                }

                if (selectedViewsArray.Count > 0)
                {
                    foreach (Tekla.Structures.Drawing.View oView in selectedViewsArray)
                    {
                        Tekla.Structures.Drawing.View view = new Tekla.Structures.Drawing.View(drawing.GetSheet(), oView.ViewCoordinateSystem, oView.DisplayCoordinateSystem, oView.RestrictionBox);
                        view = oView;
                        view.Insert();
                    }
                }

                if (selectedObjectsArray.Count > 0)
                {
                    Tekla.Structures.Drawing.UI.Picker picker = drawingHandler.GetPicker();
                    Tekla.Structures.Geometry3d.Point  point  = null;
                    ViewBase selectedView = null;
                    picker.PickPoint("Pick View", out point, out selectedView);

                    foreach (DrawingObject drawingObject in selectedObjectsArray)
                    {
                        if (drawingObject is Tekla.Structures.Drawing.Text)
                        {
                            Tekla.Structures.Drawing.Text oText = (Tekla.Structures.Drawing.Text)drawingObject;
                            Tekla.Structures.Drawing.Text text  = new Tekla.Structures.Drawing.Text(selectedView, oText.InsertionPoint, oText.TextString, oText.Attributes);

                            if (oText.Placing is Tekla.Structures.Drawing.LeaderLinePlacing)
                            {
                                Tekla.Structures.Drawing.LeaderLinePlacing l = (Tekla.Structures.Drawing.LeaderLinePlacing)oText.Placing;
                                text = new Tekla.Structures.Drawing.Text(selectedView, oText.InsertionPoint, oText.TextString, new LeaderLinePlacing(l.StartPoint), oText.Attributes);
                                text.Insert();
                            }
                            else
                            {
                                text = new Tekla.Structures.Drawing.Text(selectedView, oText.InsertionPoint, oText.TextString, oText.Attributes);
                                text.Insert();
                            }
                        }

                        if (drawingObject is Tekla.Structures.Drawing.Line)
                        {
                            Tekla.Structures.Drawing.Line oLine = (Tekla.Structures.Drawing.Line)drawingObject;
                            Tekla.Structures.Drawing.Line line  = new Tekla.Structures.Drawing.Line(selectedView, oLine.StartPoint, oLine.EndPoint, oLine.Bulge, oLine.Attributes);
                            line.Insert();
                        }

                        if (drawingObject is Tekla.Structures.Drawing.Arc)
                        {
                            Tekla.Structures.Drawing.Arc oArc = (Tekla.Structures.Drawing.Arc)drawingObject;
                            Tekla.Structures.Drawing.Arc arc  = new Arc(selectedView, oArc.StartPoint, oArc.EndPoint, oArc.Radius, oArc.Attributes);
                            arc.Insert();
                        }

                        if (drawingObject is Tekla.Structures.Drawing.Polyline)
                        {
                            Tekla.Structures.Drawing.Polyline oPolyline = (Tekla.Structures.Drawing.Polyline)drawingObject;
                            Tekla.Structures.Drawing.Polyline polyline  = new Polyline(selectedView, oPolyline.Points, oPolyline.Attributes);
                            polyline.Bulge = oPolyline.Bulge;
                            polyline.Insert();
                        }

                        if (drawingObject is Tekla.Structures.Drawing.Rectangle)
                        {
                            Tekla.Structures.Drawing.Rectangle oRectangle = (Tekla.Structures.Drawing.Rectangle)drawingObject;
                            Tekla.Structures.Drawing.Rectangle rectangle  = new Tekla.Structures.Drawing.Rectangle(selectedView, oRectangle.StartPoint, oRectangle.Width, oRectangle.Height, oRectangle.Attributes);
                            rectangle.Angle = oRectangle.Angle;
                            rectangle.Insert();
                        }

                        if (drawingObject is Tekla.Structures.Drawing.Circle)
                        {
                            Tekla.Structures.Drawing.Circle oCircle = (Tekla.Structures.Drawing.Circle)drawingObject;
                            Tekla.Structures.Drawing.Circle circle  = new Circle(selectedView, oCircle.CenterPoint, oCircle.Radius, oCircle.Attributes);
                            circle.Insert();
                        }

                        if (drawingObject is Tekla.Structures.Drawing.Polygon)
                        {
                            Tekla.Structures.Drawing.Polygon oPolygon = (Tekla.Structures.Drawing.Polygon)drawingObject;
                            Tekla.Structures.Drawing.Polygon polygon  = new Tekla.Structures.Drawing.Polygon(selectedView, oPolygon.Points, oPolygon.Attributes);;
                            polygon.Bulge = oPolygon.Bulge;
                            polygon.Insert();
                        }
                    }
                }
                statusLabel.Text = "Objects pasted in drawing " + drawing.Mark.Substring(1, drawing.Mark.Length - 2);
            }
            catch (Exception ex)
            {
                statusLabel.Text = ex.Message;
            }
        }