Options options = new Options
{
ComputeReferences = true,
View = _uiApplication.ActiveUIDocument.Document.ActiveView,
IncludeNonVisibleObjects = true
};
var geometry = grid.get_Geometry(options);
foreach (GeometryObject geometryObject in geometry)
{
if (geometryObject is Line line)
{
if (getVerticals && line.IsVertical() && line.Reference != null)
if (line.IntersectToByMovingZ(workLine))
references.Add(line.Reference);
if (getHorizontals && line.IsHorizontal() && line.Reference != null)
if (line.IntersectToByMovingZ(workLine))
references.Add(line.Reference);
}
}