예제 #1
0
        public override void Input(List <Entity> objects)
        {
            base.Input(objects);
            double sum = 0;

            foreach (Entity ent in objects)
            {
                sum += UT.EntityLength(ent);
            }
            while (iio.SumCountInput)
            {
                var sset = Inp.Objects("Введите дополнительный набор стержней");
                if (Inp.StatusBad)
                {
                    break;
                }

                using (TransactionHelper th = new TransactionHelper())
                {
                    objects = th.ReadObjects(sset);
                    foreach (Entity ent in objects)
                    {
                        sum += UT.EntityLength(ent);
                    }
                }
            }

            segments.Add(new StraitItemSegment(sum));
            count = 1;

            status = true;
        }
예제 #2
0
        public RadiusItemSegment(Arc arc)
        {
            length_data = new double[1] {
                UT.EntityLength(arc)
            };
            radius = arc.Radius;

            start = arc.StartPoint;
            end   = arc.EndPoint;
        }
예제 #3
0
        /// <summary>
        /// Создание сегмента-загиба по радиусу
        /// </summary>
        /// <param name="arc"></param>
        public ItemSegment(Arc arc)
        {
            length_data    = new double[1];
            length_data[0] = UT.EntityLength(arc);
            i_s_type       = ItemSegmentType.Radius;
            radius         = arc.Radius;

            start = arc.StartPoint;
            end   = arc.EndPoint;
        }
예제 #4
0
        /// <summary>
        /// Суммарная длина
        /// </summary>
        /// <param name="ent"></param>
        /// <param name="alllength"></param>
        public Item(List <Entity> data, bool alllength)
        {
            segments = new List <ItemSegment>();

            double sum = 0;

            foreach (Entity ent in data)
            {
                sum += UT.EntityLength(ent);
            }

            segments.Add(new ItemSegment(sum, true));
        }
예제 #5
0
        void InputConstant()
        {
            iim = ItemInputMode.Constant;
            pos.segments.Add(new ItemSegment(UT.EntityLength(objects[0])));

            if (objects.Count == 1)
            {
                pos.count = ItemCount();
            }
            else
            {
                pos.count = Convert.ToUInt32(objects.Count);
            }
        }
예제 #6
0
        public override void Input(List <Entity> firstinput)
        {
            base.Input(firstinput);
            segments.Add(new StraitItemSegment(UT.EntityLength(firstinput[0])));

            if (firstinput.Count == 1)
            {
                count = ItemInput.ItemCount();
            }
            else
            {
                count = Convert.ToUInt32(firstinput.Count);
            }

            status = true;
        }
예제 #7
0
        public void LengthList()
        {
            base.Execute();

            if (delimiter == "\n")
            {
                Tweet("Вертикальная группировка");
            }
            else if (delimiter == "\t")
            {
                Tweet("Горизонтальная группировка");
            }

            var list = new List <string>();
            var sset = Input.Objects("Выберите объекты", new [] { "Mode", "РЕжим" }, (s, e) =>
            {
                if (delimiter == "\t")
                {
                    delimiter = "\n";
                    Tweet("Вертикальная группировка");
                }
                else if (delimiter == "\n")
                {
                    delimiter = "\t";
                    Tweet("Горизонтальная группировка");
                }
            }
                                     ); if (Input.StatusBad)

            {
                return;
            }

            using (var th = new TransactionHelper())
            {
                objects = th.ReadObjects(sset);

                foreach (var o in objects)
                {
                    list.Add(String.Format("{0:F0}", UT.EntityLength(o)));
                }
            }

            Clipboard.SetText(list.Aggregate((s1, s2) => s1 + delimiter + s2));
        }
예제 #8
0
        void InputBend()
        {
            iim = ItemInputMode.Bend;
            if (objects.Count == 2)
            {
                pos.segments.Add(new ItemSegment(UT.EntityLength(objects[0]), UT.EntityLength(objects[1])));
            }
            else
            {
                double[] lengthdata = new double[objects.Count];

                for (int i = 0; i < objects.Count; i++)
                {
                    lengthdata[i] = UT.EntityLength(objects[i]);
                }
                pos.segments.Add(new ItemSegment(lengthdata));
            }
        }
예제 #9
0
        public double GetLengthSum()
        {
            double sum  = 0;
            var    sset = Input.Objects("Выберите объекты для подсчета");

            if (Input.StatusBad)
            {
                return(0);
            }

            using (TransactionHelper th = new TransactionHelper())
            {
                objects = th.ReadObjects(sset);
                foreach (Entity ent in objects)
                {
                    sum += UT.EntityLength(ent);
                }
            }
            return(sum);
        }
예제 #10
0
        public override void Input(List <Entity> firstinput)
        {
            base.Input(firstinput);
            if (firstinput.Count == 2)
            {
                segments.Add(new VariableItemSegment(UT.EntityLength(firstinput[0]), UT.EntityLength(firstinput[1])));
            }
            else
            {
                double[] lengthdata = new double[firstinput.Count];

                for (int i = 0; i < firstinput.Count; i++)
                {
                    lengthdata[i] = UT.EntityLength(firstinput[i]);
                }
                segments.Add(new VariableItemSegment(lengthdata));
            }
            base.count = ItemInput.ItemCount();
            status     = true;
        }
예제 #11
0
        void InputBendVar()
        {
            iim = ItemInputMode.BendVar;


            bool doinput = true;

            while (doinput)
            {
                Entity base_ent;
                //ввод базы


                ObjectsInput OIbase = new ObjectsInput()
                {
                    Message = "\nВыберите объект на проекции, представляющий базу",
                };
                OIbase.Input();
                if (OIbase.StatusBad)
                {
                    continue;
                }
                if (OIbase.SSet.Count != 1)
                {
                    Alert("Введите один объект!");
                    continue;
                }

                using (TransactionHelper th = new TransactionHelper())
                {
                    base_ent = th.ReadObject(OIbase.SSet[0].ObjectId) as Entity;
                }

                ObjectsInput OIvar = new ObjectsInput()
                {
                    Message = "\nВыберите переменные длины",
                };
                OIvar.Input();
                if (OIvar.StatusBad)
                {
                    return;
                }
                using (TransactionHelper th = new TransactionHelper())
                {
                    objects_var = th.ReadObjects(OIvar.SSet);
                }

                double baselength = UT.EntityLength(base_ent) - UT.EntityLength(objects_var[0]);

                double[] lengthdata = new double[objects_var.Count];

                for (int i = 0; i < objects_var.Count; i++)
                {
                    lengthdata[i] = UT.EntityLength(objects_var[i]) + baselength;
                }

                pos.segments.Add(new ItemSegment(lengthdata));
                doinput = false;
            }
            //добавляем остальные сегменты

            foreach (Entity ent in objects)
            {
                if (ent is Line)
                {
                    pos.segments.Add(new ItemSegment(((Line)ent).Length));
                }
                else if (ent is Arc)
                {
                    pos.segments.Add(new ItemSegment(ent as Arc));
                }
                else if (ent is Polyline)
                {
                    Polyline pl = ent as Polyline;
                    int      count;
                    if (pl.Closed)
                    {
                        count = pl.NumberOfVertices;
                    }
                    else
                    {
                        count = pl.NumberOfVertices - 1;
                    }

                    for (int j = 0; j < count; j++)
                    {
                        SegmentType st = pl.GetSegmentType(j);
                        if (st == SegmentType.Line)
                        {
                            LineSegment2d lsd = pl.GetLineSegment2dAt(j);
                            pos.segments.Add(new ItemSegment(lsd.Length));
                        }
                        else if (st == SegmentType.Arc)
                        {
                            CircularArc2d arc_s = pl.GetArcSegment2dAt(j);
                            Plane         pn    = new Plane(Point3d.Origin, Vector3d.XAxis, Vector3d.YAxis);
                            Arc           arc   = new Arc(new Point3d(pn, arc_s.Center), Vector3d.ZAxis, arc_s.Radius, arc_s.StartAngle, arc_s.EndAngle);
                            pos.segments.Add(new ItemSegment(arc));
                        }
                    }
                }
            }

            pos.count = ItemCount();
        }
예제 #12
0
        public override void Input(List <Entity> objects)
        {
            base.Input(objects);
            bool doinput = true;

            while (doinput)
            {
                Entity base_ent;
                //ввод базы


                var Ssetbase = Inp.Objects("Выберите объект на проекции, представляющий базу");
                if (Inp.StatusBad)
                {
                    continue;
                }
                if (Ssetbase.Count != 1)
                {
                    Alert("Введите один объект!");
                    continue;
                }

                using (TransactionHelper th = new TransactionHelper())
                {
                    base_ent = th.ReadObject(Ssetbase[0].ObjectId) as Entity;
                }

                var Ssetvar = Inp.Objects("nВыберите переменные длины");
                if (Inp.StatusBad)
                {
                    return;
                }

                using (TransactionHelper th = new TransactionHelper())
                {
                    objects_var = th.ReadObjects(Ssetvar);
                }

                double baselength = UT.EntityLength(base_ent) - UT.EntityLength(objects_var[0]);

                double[] lengthdata = new double[objects_var.Count];

                for (int i = 0; i < objects_var.Count; i++)
                {
                    lengthdata[i] = UT.EntityLength(objects_var[i]) + baselength;
                }

                segments.Add(new VariableItemSegment(lengthdata));
                doinput = false;
            }
            //добавляем остальные сегменты

            foreach (Entity ent in objects)
            {
                if (ent is Line)
                {
                    segments.Add(new StraitItemSegment(((Line)ent).Length));
                }
                else if (ent is Arc)
                {
                    segments.Add(new RadiusItemSegment(ent as Arc));
                }
                else if (ent is Polyline)
                {
                    Polyline pl = ent as Polyline;
                    int      count;
                    if (pl.Closed)
                    {
                        count = pl.NumberOfVertices;
                    }
                    else
                    {
                        count = pl.NumberOfVertices - 1;
                    }

                    for (int j = 0; j < count; j++)
                    {
                        SegmentType st = pl.GetSegmentType(j);
                        if (st == SegmentType.Line)
                        {
                            LineSegment2d lsd = pl.GetLineSegment2dAt(j);
                            segments.Add(new StraitItemSegment(lsd.Length));
                        }
                        else if (st == SegmentType.Arc)
                        {
                            CircularArc2d arc_s = pl.GetArcSegment2dAt(j);
                            Plane         pn    = new Plane(Point3d.Origin, Vector3d.XAxis, Vector3d.YAxis);
                            Arc           arc   = new Arc(new Point3d(pn, arc_s.Center), Vector3d.ZAxis, arc_s.Radius, arc_s.StartAngle, arc_s.EndAngle);
                            segments.Add(new RadiusItemSegment(arc));
                        }
                    }
                }
            }
            base.count = ItemInput.ItemCount();
            status     = true;
        }