public void SelectPolyline() { _document = Application.DocumentManager.MdiActiveDocument; _database = _document.Database; ISet <ObjectId> ids = _fencesAcad.GetSelectedFenceIds(); foreach (Polyline pl in _fencesAcad.GetFences(ids)) { GetNumFloor(); List <Point2d> points = new List <Point2d>(); for (int j = 0; j < pl.NumberOfVertices; j++) { Point2d pt = pl.GetPoint2dAt(j); points.Add(pt); } Fence fence = new Fence(); for (int i = 0; i < points.Count - 1; i++) { int[] segments = PositionCalculator.Divide((int)points[i].GetDistanceTo(points[i + 1]), i, points.Count - 1); int dist = 0; Point2d[] pills = new Point2d[segments.Length - 1]; for (int k = 0; k < segments.Length - 1; k++) { dist += segments[k]; pills[k] = MovePoint(points[i], points[i + 1], dist); DrawBar(pills[k], points[i].GetVectorTo(points[i + 1]).Angle); } FenceEntry entry = new FenceEntry(new LineSegment2d(points[i], points[i + 1]), pills); fence.AddEntry(entry); _numbars += segments.Length - 1; } using (Transaction transaction = _database.TransactionManager.StartTransaction()) { Layer.ChangeLayer(transaction, Layer.CreateLayer("КМ-РАЗМ", Color.FromColorIndex(ColorMethod.ByAci, 1), LineWeight.LineWeight020), _database); transaction.Commit(); } foreach (FenceEntry entry in fence.GetEntries()) { foreach (LineSegment2d segment in entry.SplitByPills()) { Dimension.Dim(segment); } } _fileDatabase.SaveToDB(pl.ObjectId, _guessnum, _numbars); Settings.Default.NumEnd += 2 * _guessnum; _numbars = 0; } }
public void AddEntry(FenceEntry entry) { _entries.Add(entry); }