public new void AddMaterialLayer(XbimMaterial material, double thickness, bool isVentilated, XbimMaterialFunctionEnum function) { if (!CanHaveOwnGeometry) throw new Exception("Roof has decomposing elements so it can not have its own material layers specified"); IfcMaterialLayer matLayer = _document.Model.Instances.New<IfcMaterialLayer>(); matLayer.Material = material.Material; matLayer.LayerThickness = thickness; if (IfcMaterialLayerSetUsage == null) { IfcMaterialLayerSet matLayerSet = _document.Model.Instances.New<IfcMaterialLayerSet>(); //create new material layer set and set its usage _ifcBuildingElement.SetMaterialLayerSetUsage(matLayerSet, IfcLayerSetDirectionEnum.AXIS1, IfcDirectionSenseEnum.POSITIVE, 0); } IfcMaterialLayerSet layerSet = IfcMaterialLayerSetUsage.ForLayerSet; layerSet.MaterialLayers.Add_Reversible(matLayer); }
public IEnumerable<IfcBuildingElement> IsMadeOf(XbimMaterial material) { HashSet<IfcBuildingElement> elements = new HashSet<IfcBuildingElement>(); IEnumerable<IfcMaterialLayer> layers = _model.Instances.Where<IfcMaterialLayer>(l => l.Material == material.Material).Distinct(); //IEnumerable<IfcRelAssociatesMaterial> rels = _model.InstancesWhere<IfcRelAssociatesMaterial>( // .Select<IfcRelAssociatesMaterial, IfcMaterialSelect>(rel => rel.RelatingMaterial).OfType<IfcMaterialLayerSetUsage>() // .Select<IfcMaterialLayerSetUsage, IfcMaterialLayerSet>(lsu => lsu.ForLayerSet) // .SelectMany<IfcMaterialLayerSet, IfcMaterialLayer>(ls => ls.MaterialLayers) // .Where(ml => ml.Material == material.Material).Select(r); //foreach (var rel in rels) //{ // foreach (var obj in rel.RelatedObjects.OfType<IfcBuildingElement>()) // if (!elements.Contains(obj)) elements.Add(obj); //} return elements; }
public void AddMaterialLayer(XbimMaterial material, double thickness, bool isVentilated, XbimMaterialFunctionEnum function) { IfcMaterialLayerSet materialLayerSet = _ifcBuildingElement.GetMaterial() as IfcMaterialLayerSet; if (materialLayerSet == null) { materialLayerSet = _document.Model.Instances.New<IfcMaterialLayerSet>(/*set => set.LayerSetName = _ifcTypeProduct.Name*/); _ifcBuildingElement.SetMaterial(materialLayerSet); } IfcMaterialLayer matLayer = _document.Model.Instances.New<IfcMaterialLayer>(); matLayer.LayerThickness = thickness; matLayer.Material = material; matLayer.IsVentilated = isVentilated; materialLayerSet.MaterialLayers.Add_Reversible(matLayer); int materialIndex = materialLayerSet.MaterialLayers.IndexOf(matLayer); if (materialIndex < 0) return; //check if material exists in the material layer set _ifcBuildingElement.SetPropertyTableItemValue("xbim_MaterialFunctionAssignment", "MaterialFunctionAssignment", (IfcInteger)materialIndex, (IfcLabel)Enum.GetName(typeof(XbimMaterialFunctionEnum), function)); }
public XbimMaterialFunctionEnum GetMaterialFunction(XbimMaterial material) { object funObj = IfcBuildingElement.GetPropertyTableItemValue("xbim_MaterialFunctionAssignment", "MaterialFunctionAssignment", (IfcLabel)material.Name); if (funObj != null) { string function = (IfcLabel)funObj; XbimMaterialFunctionEnum result = (XbimMaterialFunctionEnum)Enum.Parse(typeof(XbimMaterialFunctionEnum), function, true); return result; } return XbimMaterialFunctionEnum.None; }
public void SetMaterialFunction(XbimMaterial material, XbimMaterialFunctionEnum function) { IfcBuildingElement.SetPropertyTableItemValue("xbim_MaterialFunctionAssignment", "MaterialFunctionAssignment", (IfcLabel)material.Name, (IfcLabel)Enum.GetName(typeof(XbimMaterialFunctionEnum), function)); }