public virtual void IfcParse(int propIndex, IPropertyValue value) { switch (propIndex) { case 0: _forLayerSet = (IfcMaterialLayerSet)value.EntityVal; break; case 1: _layerSetDirection = (IfcLayerSetDirectionEnum)Enum.Parse(typeof(IfcLayerSetDirectionEnum), value.EnumVal, true); break; case 2: _directionSense = (IfcDirectionSenseEnum)Enum.Parse(typeof(IfcDirectionSenseEnum), value.EnumVal, true); break; case 3: _offsetFromReferenceLine = value.RealVal; break; default: this.HandleUnexpectedAttribute(propIndex, value); break; } }
public override bool Equals(object obj) { // Check for null if (obj == null) { return(false); } // Check for type if (this.GetType() != obj.GetType()) { return(false); } // Cast as IfcRoot IfcMaterialLayerSet root = (IfcMaterialLayerSet)obj; return(this == root); }
public override void Parse(int propIndex, IPropertyValue value, int[] nestedIndex) { switch (propIndex) { case 0: _forLayerSet = (IfcMaterialLayerSet)(value.EntityVal); return; case 1: _layerSetDirection = (IfcLayerSetDirectionEnum)System.Enum.Parse(typeof(IfcLayerSetDirectionEnum), value.EnumVal, true); return; case 2: _directionSense = (IfcDirectionSenseEnum)System.Enum.Parse(typeof(IfcDirectionSenseEnum), value.EnumVal, true); return; case 3: _offsetFromReferenceLine = value.RealVal; return; default: throw new XbimParserException(string.Format("Attribute index {0} is out of range for {1}", propIndex + 1, GetType().Name.ToUpper())); } }
/// <summary> /// Set Material set usage and creates it if it doesn't exist. /// </summary> /// <param name = "forLayerSet">Material layer set for the usage</param> /// <param name = "layerSetDirection">Direction of the material layer set in the usage</param> /// <param name = "directionSense">Sense of the direction of the usage</param> /// <param name = "offsetFromReferenceLine">Offset from the reference line of the element</param> public static void SetMaterialLayerSetUsage(this IfcRoot element, IfcMaterialLayerSet forLayerSet, IfcLayerSetDirectionEnum layerSetDirection, IfcDirectionSenseEnum directionSense, IfcLengthMeasure offsetFromReferenceLine) { IModel model = element.ModelOf; element.SetMaterialLayerSetUsage(model, forLayerSet, layerSetDirection, directionSense, offsetFromReferenceLine); }
/// <summary> /// Set Material set usage parameters and creates it if it doesn't exist. /// </summary> /// <param name = "model">Model of the element</param> /// <param name = "forLayerSet">Material layer set for the usage</param> /// <param name = "layerSetDirection">Direction of the material layer set in the usage</param> /// <param name = "directionSense">Sense of the direction of the usage</param> /// <param name = "offsetFromReferenceLine">Offset from the reference line of the element</param> public static void SetMaterialLayerSetUsage(this IfcRoot element, IModel model, IfcMaterialLayerSet forLayerSet, IfcLayerSetDirectionEnum layerSetDirection, IfcDirectionSenseEnum directionSense, IfcLengthMeasure offsetFromReferenceLine) { //if some input is not correct, material layer set usage is not created or changed if (element == null || forLayerSet == null) return; IfcMaterialLayerSetUsage materialUsage = element.GetOrCreateLayerSetUsage(model); materialUsage.ForLayerSet = forLayerSet; materialUsage.LayerSetDirection = layerSetDirection; materialUsage.DirectionSense = directionSense; materialUsage.OffsetFromReferenceLine = offsetFromReferenceLine; }
public virtual void IfcParse(int propIndex, IPropertyValue value) { switch (propIndex) { case 0: _forLayerSet = (IfcMaterialLayerSet) value.EntityVal; break; case 1: _layerSetDirection = (IfcLayerSetDirectionEnum) Enum.Parse(typeof (IfcLayerSetDirectionEnum), value.EnumVal, true); break; case 2: _directionSense = (IfcDirectionSenseEnum) Enum.Parse(typeof (IfcDirectionSenseEnum), value.EnumVal, true); break; case 3: _offsetFromReferenceLine = value.RealVal; break; default: this.HandleUnexpectedAttribute(propIndex, value); break; } }
/// <summary> /// Add the child objects to the IfcMaterialLayerSet /// </summary> /// <param name="ifcMaterialLayerSet">IfcMaterialLayerSet object</param> /// <param name="childNames">list of child object names separated by " : ", NOT case sensitive</param> private bool AddChildObjects(IfcMaterialLayerSet ifcMaterialLayerSet, string childNames) { bool returnValue = false; List<string> splitChildNames = SplitString(childNames, ':'); foreach (string item in splitChildNames) { string name = item; double? thickness = GetLayerThickness(name); name = GetMaterialName(name).ToLower().Trim(); IfcMaterialLayer ifcMaterialLayer = null; IEnumerable<IfcMaterialLayer> ifcMaterialLayers = IfcMaterialLayers.Where(ml => (ml.Material.Name != null) && (ml.Material.Name.ToString().ToLower().Trim() == name)); if ((ifcMaterialLayers.Any()) && (ifcMaterialLayers.Count() > 1) && (thickness != null) ) { ifcMaterialLayer = ifcMaterialLayers.Where(ml => ml.LayerThickness == thickness).FirstOrDefault(); } else { ifcMaterialLayer = ifcMaterialLayers.FirstOrDefault(); } if (ifcMaterialLayer != null) { if (!ifcMaterialLayerSet.MaterialLayers.Contains(ifcMaterialLayer)) ifcMaterialLayerSet.MaterialLayers.Add_Reversible(ifcMaterialLayer); returnValue = true; } } return returnValue; }
/// <summary> /// Set Material set usage with typical values and creates it if it doesn't exist. /// LayerSetDirection = IfcLayerSetDirectionEnum.AXIS1 /// DirectionSense = IfcDirectionSenseEnum.POSITIVE /// OffsetFromReferenceLine = 0 /// </summary> /// <param name = "forLayerSet">Material layer set for the usage</param> public static void SetTypicalMaterialLayerSetUsage(this IfcWall wall, IfcMaterialLayerSet forLayerSet) { wall.SetMaterialLayerSetUsage(forLayerSet, IfcLayerSetDirectionEnum.AXIS1, IfcDirectionSenseEnum.POSITIVE, 0); }