示例#1
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;
        }
示例#2
0
        public override void Input(List <Entity> objects)
        {
            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;
        }
示例#3
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;
        }
示例#4
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;
        }