/***************************************************/ /**** Public Methods ****/ /***************************************************/ public static List <IPersistEntity> IfcEntities(this Xbim.Ifc.IfcStore model, FilterRequest request) { if (model == null || request?.Type == null) { return(null); } if (!typeof(IBHoMObject).IsAssignableFrom(request.Type)) { BH.Engine.Reflection.Compute.RecordError($"Input type {request.Type} is not a BHoM type."); return(null); } if (request.Type == typeof(IBHoMObject) || request.Type == typeof(BHoMObject) || request.Type == typeof(IMaterialProperties)) { BH.Engine.Reflection.Compute.RecordError($"It is not allowed to pull elements of type {request.Type} because it is too general, please try to narrow the filter down."); return(null); } IEnumerable <Type> correspondentTypes = request.Type.CorrespondentIfcTypes(); return(model.Instances.Where(x => correspondentTypes.Any(y => y.IsAssignableFrom(x.GetType()))).ToList()); }
/***************************************************/ /**** Fallback Methods ****/ /***************************************************/ public static List <IPersistEntity> IfcEntities(this Xbim.Ifc.IfcStore model, IRequest request) { BH.Engine.Reflection.Compute.RecordError($"Request of type {request.GetType()} is not supported."); return(null); }
/***************************************************/ /**** Interface Methods ****/ /***************************************************/ public static List <IPersistEntity> IIfcEntities(this Xbim.Ifc.IfcStore model, IRequest request) { return(IfcEntities(model, request as dynamic)); }