/// <summary> /// Determine if an element lies /// within the volume of the Space /// </summary> public bool IsInSpace(Element element) { DB.FamilyInstance familyInstance = element.InternalElement as DB.FamilyInstance; if (familyInstance != null) { if (familyInstance.HasSpatialElementCalculationPoint) { DB.XYZ insertionPoint = familyInstance.GetSpatialElementCalculationPoint(); if (InternalSpace.IsPointInSpace(insertionPoint)) { return(true); } else { return(false); } } } DB.LocationPoint insertionLocationPoint = element.InternalElement.Location as DB.LocationPoint; if (insertionLocationPoint != null) { DB.XYZ insertionPoint = insertionLocationPoint.Point; if (InternalSpace.IsPointInSpace(insertionPoint)) { return(true); } } return(false); }