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; }
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; }