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); } }
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)); } }
void KeywordInput(object s, SelectionTextInputEventArgs e) { //анализ ключевых слов if (e.Input == "Strait") { iim = ItemInputMode.Constant; } else if (e.Input == "BEnd") { iim = ItemInputMode.Bend; } else if (e.Input == "VBend") { iim = ItemInputMode.BendVar; } else if (e.Input == "Middle") { iim = ItemInputMode.Variable; } else if (e.Input == "ALllength") { iim = ItemInputMode.All; } else if (e.Input == "OUtput") { Output(); } else if (e.Input == "CLear") { ClearItems(); } else if (e.Input == "PArams") { SetParams(); } else if (e.Input == "EDit") { iio.EditingMode = !iio.EditingMode; } }
void InputAll() { iim = ItemInputMode.All; }
void InputVariable() { iim = ItemInputMode.Variable; }
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(); }