public static List <MctMaterialValue> TranslateMaterial(List <IIfcMaterialSelect> girderSet_Material, ref int matIndex)
        {
            var mp           = new Dictionary <string, double>();
            var material_Set = new List <MctMaterialValue>();

            for (int i = 0; i < girderSet_Material.Count; i++)
            {
                var singleMP = (IIfcMaterial)girderSet_Material[i];
                foreach (var p_set in singleMP.HasProperties)
                {
                    foreach (var p in p_set.Properties)
                    {
                        if (p is IIfcPropertySingleValue pv && pv.NominalValue != null)
                        {
                            mp[pv.Name.ToString().ToUpper()] = (double)pv.NominalValue.Value;
                        }
                    }
                }
                var mat = new MctMaterialValue(new MctUnitSystem())
                {
                    Id      = matIndex++,
                    Name    = singleMP.Name,
                    Type    = singleMP.Category.ToString().ToUpper() == "STEEL" ? MctMaterialTypeEnum.STEEL : (singleMP.Category.ToString().ToUpper() == "CONC" ? MctMaterialTypeEnum.CONC : MctMaterialTypeEnum.USER),
                    UseMass = true,
                    Elast   = mp.ContainsKey("YOUNGMODULUS") ? mp["YOUNGMODULUS"] : 0,
                    Poisson = mp.ContainsKey("POISSONRATIO") ? mp["POISSONRATIO"] : 0,
                    Thermal = mp.ContainsKey("ThermalExpansionCoefficient") ? mp["ThermalExpansionCoefficient"] : 0,
                    Density = mp.ContainsKey("MASSDENSITY") ? mp["MASSDENSITY"] : 0,
                    Mass    = mp.ContainsKey("MASSDENSITY") ? mp["MASSDENSITY"] : 0
                };
                material_Set.Add(mat);
            }
            return(material_Set);
        }
Пример #2
0
 public void AddMaterial(MctMaterialValue material)
 {
     if (!_material.ContainsKey(material.Id))
     {
         _material[material.Id] = material;
     }
 }