public ObjectIdCollection FindCones(ObjectId edgeId)
{
Document doc = Application.DocumentManager.MdiActiveDocument;
Database db = doc.Database;
Transaction tr = db.TransactionManager.StartTransaction();
ObjectIdCollection boundaries = new ObjectIdCollection();
using (tr)
{
Line edge = (Line)tr.GetObject(edgeId, OpenMode.ForRead);
Point3dCollection ptcol = new Point3dCollection();
BlockTable bt = (BlockTable)tr.GetObject(db.BlockTableId, OpenMode.ForRead, false, false);
BlockTableRecord btr = (BlockTableRecord)tr.GetObject(bt[BlockTableRecord.ModelSpace], OpenMode.ForRead);
foreach (ObjectId item in btr)
{
Entity ent = (Entity)tr.GetObject(item, OpenMode.ForRead);
if (ent is Solid3d)
{
LineSegment3d target = new LineSegment3d(edge.StartPoint, edge.EndPoint);
Brep brepEntity = new Brep(ent);
Hit[] hits = brepEntity.GetLineContainment(target, 1);
if (hits.Length>0)
{
boundaries.Add(ent.ObjectId);
}
}
}
tr.Commit();
}
return boundaries;
}