private IEnumerable<Handle> CreateOffsetLines() { List<Handle> handles = new List<Handle>(); Point3d pointOnLine = firstBarLine.GetClosestPointTo(spanPoint.Value, true); if (pointOnLine.DistanceTo(spanPoint.Value) == 0) { Handle handle = DrawBarLine(new Line(firstBarLine.StartPoint, firstBarLine.EndPoint)); handles.Add(handle); return handles; } Line perpendincularLine = new Line(pointOnLine, spanPoint.Value); int barLinesAmount = (int)(perpendincularLine.Length / spanStep.Value); Transaction trans = db.TransactionManager.StartTransaction(); using (trans) { BlockTableRecord btr = trans.GetObject(db.CurrentSpaceId, OpenMode.ForWrite) as BlockTableRecord; for (int i = 0; i <= barLinesAmount; i++) { lastBarLine = CreateFirstBarLine(); Point3d additionalPoint = perpendincularLine.GetPointAtDist(spanStep.Value * i); Vector3d offsetVector = pointOnLine.GetVectorTo(additionalPoint); btr.AppendEntity(lastBarLine); lastBarLine.TransformBy(Matrix3d.Displacement(offsetVector)); handles.Add(lastBarLine.Handle); trans.AddNewlyCreatedDBObject(lastBarLine, true); } trans.Commit(); } return handles; }