Example #1
0
        public override bool Run(List <InputDefinition> Input)
        {
            try
            {
                GetData();

                ViewBase    view        = InputDefinitionFactory.GetView(Input[0]);
                ModelObject modelObject = (ModelObject)InputDefinitionFactory.GetDrawingObject(Input[0]);

                Model myModel = new Model();

                Point partMiddleStart = null, partMiddleEnd = null, partCenterPoint = null;
                GetPartPoints(myModel, view, modelObject, out partMiddleStart, out partMiddleEnd, out partCenterPoint);

                Mark mark = new Mark(modelObject);
                mark.Attributes.Content.Clear();
                mark.Attributes.Content.Add(new TextElement(Data.Text));
                mark.Attributes.Content.Add(new UserDefinedElement("PROFILE"));

                mark.Placing        = new AlongLinePlacing(partMiddleStart, partMiddleEnd);
                mark.InsertionPoint = partCenterPoint;
                mark.Insert();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
            return(true);
        }
        public override List <InputDefinition> DefineInput()
        {
            //
            // This is an example for selecting two points; change this to suit your needs.
            //
            List <InputDefinition> inputs         = new List <InputDefinition>();
            DrawingHandler         drawingHandler = new DrawingHandler();

            if (drawingHandler.GetConnectionStatus())
            {
                Picker picker = drawingHandler.GetPicker();

                ViewBase  view   = null;
                PointList points = new PointList();

                StringList prompts = new StringList();
                prompts.Add("Pick first point");
                prompts.Add("Pick second point");

                picker.PickPoints(2, prompts, out points, out view);
                inputs.Add(InputDefinitionFactory.CreateInputDefinition(view, points));
            }

            return(inputs);
        }
        public override List <InputDefinition> DefineInput()
        {
            var drawingHandler = new DrawingHandler();
            var picker         = drawingHandler.GetPicker();
            var pick           = picker.PickPoint("Pick a point");

            return(new List <InputDefinition>()
            {
                InputDefinitionFactory.CreateInputDefinition(pick)
            });
        }
        public override bool Run(List <InputDefinition> input)
        {
            try
            {
                var view  = InputDefinitionFactory.GetView(input[0]);
                var point = InputDefinitionFactory.GetPoint(input[0]);

                var frame = new Frame(FrameTypes.Rectangular, (DrawingColors)0);

                var text = new Text(view, point, $"{_data.SampleText}",
                                    new PointPlacing())
                {
                    Attributes =
                    {
                        Frame     = frame,
                        Angle     =                0.0,
                        Font      = { Color = (DrawingColors)0 },
                        Alignment = TextAlignment.Left,
                    }
                };

                text.Insert();
            }
            catch (Exception ex)
            {
            }

            try
            {
                var view  = InputDefinitionFactory.GetView(input[0]);
                var point = InputDefinitionFactory.GetPoint(input[0]);

                var imagePoint = new Point(point);
                imagePoint.Y += 10;

                var image = new Image(view, imagePoint, _data.ImageFilename)
                {
                    Attributes =
                    {
                        Frame = new EmbeddedObjectFrame(LineTypes.UndefinedLine, DrawingColors.Invisible)
                    }
                };

                image.Insert();
            }
            catch (Exception ex)
            {
            }

            return(true);
        }
Example #5
0
        public override bool Run(List <InputDefinition> inputs)
        {
            ViewBase  view   = InputDefinitionFactory.GetView(inputs[0]);
            PointList points = InputDefinitionFactory.GetPoints(inputs[0]);

            if (Distance.PointToPoint(points[0], points[1]) <= Point.EPSILON_SQUARED)
            {
                return(false);
            }

            Data.CheckDefaults(this);
            EllipsePluginShapes.DrawAnEllipse(view, points[0], points[1], Data.MajorAxis, Data.MinorAxis, Data.Precision);
            return(true);
        }
Example #6
0
        public override List <InputDefinition> DefineInput()
        {
            List <InputDefinition> input          = new List <InputDefinition>();
            DrawingHandler         drawingHandler = new DrawingHandler();

            if (drawingHandler.GetConnectionStatus())
            {
                Picker picker = drawingHandler.GetPicker();

                ViewBase      view       = null;
                DrawingObject pickedPart = null;

                picker.PickObject("Pick part", out pickedPart, out view);

                input.Add(InputDefinitionFactory.CreateInputDefinition(view, pickedPart));
            }

            return(input);
        }
        public override bool Run(List <InputDefinition> inputs)
        {
            try
            {
                //
                // This is an example for selecting two points; change this to suit your needs.
                //
                ViewBase  view   = InputDefinitionFactory.GetView(inputs[0]);
                PointList points = InputDefinitionFactory.GetPoints(inputs[0]);

                //
                // Write your code here; better yet, create private methods and call them from here.
                //
            }
            catch (Exception Exc)
            {
                MessageBox.Show(Exc.ToString());
            }

            return(true);
        }
Example #8
0
        public override List <InputDefinition> DefineInput()
        {
            List <InputDefinition> inputs         = new List <InputDefinition>();
            DrawingHandler         drawingHandler = new DrawingHandler();

            if (drawingHandler.GetConnectionStatus())
            {
                Picker picker = drawingHandler.GetPicker();

                ViewBase  view   = null;
                PointList points = new PointList();

                StringList prompts = new StringList();
                prompts.Add("Pick first point");
                prompts.Add("Pick second point");

                picker.PickPoints(2, prompts, out points, out view);
                inputs.Add(InputDefinitionFactory.CreateInputDefinition(view, points));
            }

            return(inputs);
        }
Example #9
0
        public override List <InputDefinition> DefineInput()
        {
            List <InputDefinition> inputs         = new List <InputDefinition>();
            DrawingHandler         drawingHandler = new DrawingHandler();

            if (drawingHandler.GetConnectionStatus())
            {
                Picker picker = drawingHandler.GetPicker();

                ViewBase  view;
                PointList pointList;

                StringList promts = new StringList();
                promts.Add("able_Pick_center_point");
                promts.Add("able_Pick_major_point");

                picker.PickPoints(2, promts, out pointList, out view);
                inputs.Add(InputDefinitionFactory.CreateInputDefinition(view, pointList));
            }

            return(inputs);
        }
Example #10
0
        public override bool Run(List <InputDefinition> inputs)
        {
            try
            {
                ViewBase  view   = InputDefinitionFactory.GetView(inputs[0]);
                PointList points = InputDefinitionFactory.GetPoints(inputs[0]);

                tsg.Point p1 = points[0] as tsg.Point;
                tsg.Point p2 = points[1] as tsg.Point;

                // default data
                #region Default data

                if (!IsDefaultValue(data.height))
                {
                    height = data.height;
                }
                if (!IsDefaultValue(data.shop))
                {
                    height = data.shop;
                }
                if (!IsDefaultValue(data.tw))
                {
                    try
                    {
                        tw = (TypeWeld)Enum.Parse(typeof(TypeWeld), data.tw);
                    }
                    catch { }
                }

                #endregion

                #region Drawing

                double dx = (shop == 1 ? 5 : 8);


                Line lineArrow = RLine(view, p1, p2, true);
                lineArrow.Insert();
                Line lineCen = RLine(view, p2, new tsg.Point((p2).X + dx, (p2).Y));
                lineCen.Insert();

                Line lineTop = RLine(view, new tsg.Point((p2).X + dx, (p2).Y), new tsg.Point((p2).X + dx + height, (p2).Y + height));
                lineTop.Insert();
                Line lineBottom = RLine(view, new tsg.Point((p2).X + dx, (p2).Y), new tsg.Point((p2).X + dx + height, (p2).Y - height));
                lineBottom.Insert();

                Text t = new Text(view, new tsg.Point((p2).X + dx + 5, (p2).Y), tw.ToString());
                t.Attributes.Alignment               = TextAlignment.Left;
                t.Attributes.ArrowHead.Head          = ArrowheadTypes.NoArrow;
                t.Attributes.ArrowHead.ArrowPosition = ArrowheadPositions.None;
                t.Attributes.ArrowHead.Height        = 0;
                t.Attributes.ArrowHead.Width         = 0;
                t.Placing = PlacingTypes.PointPlacing();
                t.Attributes.Frame.Type  = FrameTypes.None;
                t.Attributes.Font.Color  = col;
                t.Attributes.Font.Height = height;
                t.Insert();

                if (shop != 0)
                {
                    Line LineErection = RLine(view, p2, new tsg.Point((p2).X, (p2).Y + 5));
                    LineErection.Insert();
                    PointList pl = new PointList();
                    pl.Add(LineErection.EndPoint);
                    pl.Add(new tsg.Point(LineErection.EndPoint.X + height, LineErection.EndPoint.Y - 0.5));
                    pl.Add(new tsg.Point(LineErection.EndPoint.X, LineErection.EndPoint.Y - 1));
                    Polygon Erection = GetTriangle(view, pl, true);
                    Erection.Insert();
                }

                #region Type Weld
                Polygon triangle_top    = GetTriangle(view, new tsg.Point(lineCen.StartPoint.X + (dx - 4), lineCen.StartPoint.Y));
                Polygon triangle_bottom = GetTriangle(view, new tsg.Point(lineCen.StartPoint.X + (dx - 4), lineCen.StartPoint.Y), true);

                Line doule_line_1 = RLine(view,
                                          new tsg.Point(lineCen.StartPoint.X + (dx - 4), lineCen.StartPoint.Y),
                                          new tsg.Point(lineCen.StartPoint.X + (dx - 4), lineCen.StartPoint.Y + height));

                Line doule_line_2 = RLine(view,
                                          new tsg.Point(lineCen.StartPoint.X + (dx - 4) + 1.5, lineCen.StartPoint.Y),
                                          new tsg.Point(lineCen.StartPoint.X + (dx - 4) + 1.5, lineCen.StartPoint.Y + height));

                Line dl_line_45 = RLine(view,
                                        new tsg.Point(lineCen.StartPoint.X + (dx - 4), lineCen.StartPoint.Y),
                                        new tsg.Point(lineCen.StartPoint.X + (dx - 4) + height, lineCen.StartPoint.Y + height));

                Arc arc = new Arc(view, new tsg.Point(lineCen.StartPoint.X + height, lineCen.StartPoint.Y), lineCen.StartPoint, height * 0.5);
                arc.Attributes.Line.Color = col;
                arc.Attributes.Arrowhead.ArrowPosition = ArrowheadPositions.None;
                arc.Attributes.Line.Type = LineTypes.SolidLine;

                if (tw == TypeWeld.T1 || tw == TypeWeld.U4 || tw == TypeWeld.H1)
                {
                    triangle_top.Insert();
                }
                else if (tw == TypeWeld.T3 || tw == TypeWeld.H2)
                {
                    triangle_top.Insert();
                    triangle_bottom.Insert();
                }
                else if (tw == TypeWeld.C2)
                {
                    doule_line_1.Insert();
                    doule_line_2.Insert();
                }
                else if (tw == TypeWeld.T6 || tw == TypeWeld.U6)
                {
                    doule_line_1.Insert();
                    dl_line_45.Insert();
                }
                else if (tw == TypeWeld.T7 || tw == TypeWeld.U7)
                {
                    doule_line_1.Insert();
                    dl_line_45.Insert();
                    arc.Insert();
                }

                #endregion
                #endregion
            }
            catch (Exception Exc)
            {
                MessageBox.Show(Exc.ToString());
            }

            return(true);
        }