// Делаем снимок с помощью секущей плоскости
using (Transaction tr = db.TransactionManager.StartTransaction())
{
SectionType st = SectionType.Section2d;
Extents3d ext = source.GeometricExtents;
Point3dCollection pts = new Point3dCollection();
double planeElev = Round(ext.MaxPoint.Z + 5, 0);
pts.Add(new Point3d(ext.MaxPoint.X, ext.MaxPoint.Y, planeElev));
pts.Add(new Point3d(ext.MinPoint.X, ext.MinPoint.Y, planeElev));
BlockTableRecord model = db.GetModel(tr);
if (model == null) return false;
Section sec = new Section(pts, Vector3d.YAxis, Vector3d.ZAxis.Negate());
sec.State = SectionState.Plane;
model.AppendEntity(sec);
tr.AddNewlyCreatedDBObject(sec, true);
sec.SetHeight(SectionHeight.HeightAboveSectionLine, 3.0);
sec.SetHeight(SectionHeight.HeightBelowSectionLine, 1.0);
SectionSettings ss = (SectionSettings)tr.GetObject(sec.Settings, OpenMode.ForWrite);
ss.CurrentSectionType = st;
ObjectIdCollection oic = new ObjectIdCollection();
oic.Add(source.ObjectId);
ss.SetSourceObjects(st, oic);
ss.SetVisibility(st, SectionGeometry.BackgroundGeometry, true);
ss.SetHiddenLine(st, SectionGeometry.BackgroundGeometry, false);
ss.SetGenerationOptions(st, SectionGeneration.SourceSelectedObjects | SectionGeneration.DestinationFile);
sec.GenerateSectionGeometry(source, out Array flEnts, out Array bgEnts, out Array foregEntities, out Array ftEnts, out Array ctEnts);
foreach (Entity e in flEnts)
e.Dispose();
foreach (Entity e in bgEnts)
e.Dispose();
foreach (Entity e in ftEnts)
e.Dispose();
foreach (Entity e in ctEnts)
e.Dispose();
foreground = foregEntities.Cast<Entity>().ToList();
foreach (Entity fore in foreground)
fore.TransformBy(Matrix3d.Displacement(new Vector3d(0, 0, 0 - planeElev)));
ss.SetVisibility(st, SectionGeometry.BackgroundGeometry, false);
ss.SetVisibility(st, SectionGeometry.CurveTangencyLines, false);
ss.SetHiddenLine(st, SectionGeometry.BackgroundGeometry, true);
sec.GenerateSectionGeometry(source, out flEnts, out bgEnts, out foregEntities, out ftEnts, out ctEnts);
foreach (Entity e in flEnts)
e.Dispose();
foreach (Entity e in bgEnts)
e.Dispose();
foreach (Entity e in ftEnts)
e.Dispose();
foreach (Entity e in ctEnts)
e.Dispose();
background = foregEntities.Cast<Entity>().ToList();
foreach (Entity back in background)
back.TransformBy(Matrix3d.Displacement(new Vector3d(0, 0, 0 - planeElev)));
tr.Abort(); // сотрем из БД сечения
}