public IfcPropertyBoundedValue(IfcIdentifier __Name, IfcText?__Description, IfcValue __UpperBoundValue, IfcValue __LowerBoundValue, IfcUnit __Unit) : base(__Name, __Description) { this._UpperBoundValue = __UpperBoundValue; this._LowerBoundValue = __LowerBoundValue; this._Unit = __Unit; }
public override void Parse(int propIndex, IPropertyValue value, int[] nestedIndex) { switch (propIndex) { case 0: case 1: base.Parse(propIndex, value, nestedIndex); return; case 2: _upperBoundValue = (IfcValue)(value.EntityVal); return; case 3: _lowerBoundValue = (IfcValue)(value.EntityVal); return; case 4: _unit = (IfcUnit)(value.EntityVal); return; case 5: _setPointValue = (IfcValue)(value.EntityVal); return; default: throw new XbimParserException(string.Format("Attribute index {0} is out of range for {1}", propIndex + 1, GetType().Name.ToUpper())); } }
public static void SetExtendedSingleValue(this IfcMaterial material, string pSetName, string propertyName, IfcValue value) { IModel model = material.Model; SetExtendedSingleValue(material, model, pSetName, propertyName, value); }
internal ElementTypeIfcProperties(IfcElementType type) : base(type) { string keyword = type.KeyWord; bool readOnly = true; foreach (IfcPropertySet pset in type.HasPropertySets.OfType <IfcPropertySet>()) { foreach (IfcPropertySingleValue psv in pset.HasProperties.Values.ToList().OfType <IfcPropertySingleValue>()) { IfcValue val = psv.NominalValue; if (val == null) { Add(new CustomProperty(psv.Name, "", typeof(string), readOnly, true) { Group = pset.Name }); } else { Object obj = val.Value; Add(new CustomProperty(psv.Name, obj, obj.GetType(), readOnly, true) { Group = pset.Name }); } } } }
public override void IfcParse(int propIndex, IPropertyValue value) { switch (propIndex) { case 0: case 1: base.IfcParse(propIndex, value); break; case 2: _upperBoundValue = (IfcValue)value.EntityVal; break; case 3: _lowerBoundValue = (IfcValue)value.EntityVal; break; case 4: _unit = (IfcUnit)value.EntityVal; break; default: this.HandleUnexpectedAttribute(propIndex, value); break; } }
internal static XmlNode convert(XmlDocument doc, IfcValue value,string name) { string keyword = value.GetType().Name; XmlElement v = doc.CreateElement(keyword + "-wrapper"); v.InnerText = value.Value.ToString(); if (string.IsNullOrEmpty(name)) return v; XmlElement element = doc.CreateElement(name); element.AppendChild(v); return element; }
//private IfcUnit _ifcUnit; protected BbSingleProperty(string name, string value, Type type) { Name = name; _ifcValue = new IfcValue (); var iValue = Activator.CreateInstance(type) as STRING; iValue.Value = value; _ifcValue.Value = iValue; _ifcPropertySingleValue = new IfcPropertySingleValue{ Name = this.Name, NominalValue = _ifcValue, }; }
protected BbSingleProperty(string name, bool value) { Name = name; _ifcValue = new IfcValue(); var iValue = new IfcBoolean {Value = value}; _ifcValue.Value = iValue; _ifcPropertySingleValue = new IfcPropertySingleValue { Name = this.Name, NominalValue = _ifcValue, }; }
protected BbSingleProperty(string name, DateTime value) { Name = name; _ifcValue = new IfcValue(); var iValue = IfcTimeStamp.GetTimeStamp(value); _ifcValue.Value = iValue; _ifcPropertySingleValue = new IfcPropertySingleValue { Name = this.Name, NominalValue = _ifcValue, }; }
internal ObjectIfcProperties(IfcElement element) { bool readOnly = true; Add(new CustomProperty("GlobalId", element.GlobalId, typeof(string), true, true) { Group = "Element" }); Add(new CustomProperty("Name", element.Name, typeof(string), readOnly, true) { Group = "Element" }); Add(new CustomProperty("Description", element.Description, typeof(string), readOnly, true) { Group = "Element" }); Add(new CustomProperty("ObjectType", element.ObjectType, typeof(string), readOnly, true) { Group = "Element" }); Add(new CustomProperty("Type", element.GetType().Name, typeof(string), true, true) { Group = "Element" }); Add(new CustomProperty("Tag", element.Tag, typeof(string), readOnly, true) { Group = "Element" }); foreach (IfcPropertySet pset in element.IsDefinedBy.ToList().ConvertAll(x => x.RelatingPropertyDefinition).OfType <IfcPropertySet>()) { foreach (IfcPropertySingleValue psv in pset.HasProperties.Values.ToList().OfType <IfcPropertySingleValue>()) { IfcValue val = psv.NominalValue; if (val == null) { Add(new CustomProperty(psv.Name, "", typeof(string), readOnly, true) { Group = pset.Name }); } else { Object obj = val.Value; Add(new CustomProperty(psv.Name, obj, obj.GetType(), readOnly, true) { Group = pset.Name }); } } } }
/// <summary> /// Returns the Reference ID for this specified type in this project (e.g. type 'A-1'), if known /// </summary> /// <param name="window"></param> /// <returns></returns> public static IfcIdentifier?GetReference(this IfcWindow window) { IfcValue val = window.GetPropertySingleNominalValue("Pset_WindowCommon", "Reference "); if (val != null && val is IfcIdentifier) { return((IfcIdentifier)val); } else { return(null); } }
/// <summary> /// Returns if the door is external, default is false if not specified /// </summary> /// <param name="window"></param> /// <returns></returns> public static IfcBoolean GetIsExternal(this IfcWindow window) { IfcValue val = window.GetPropertySingleNominalValue("Pset_WindowCommon", "IsExternal"); if (val != null && val is IfcBoolean) { return((IfcBoolean)val); } else { return(new IfcBoolean(false)); //default is to return false } }
public Sorting_IFCSpace(IfcLabel?Name, int EntityLabel, IfcValue CoolingLoad, IfcValue HeatingLoad, IfcValue LightingLoad, IfcValue PowerLoad, IfcValue CoolingLoad_pa, IfcValue HeatingLoad_pa, IfcValue LightingLoad_pa, IfcValue PowerLoad_pa) { this.Name = Name; this.EntityLabel = EntityLabel; this.CoolingLoad = CoolingLoad; this.HeatingLoad = HeatingLoad; this.LightingLoad = LightingLoad; this.PowerLoad = PowerLoad; this.CoolingLoad_pa = CoolingLoad_pa; this.HeatingLoad_pa = HeatingLoad_pa; this.LightingLoad_pa = LightingLoad_pa; this.PowerLoad_pa = PowerLoad_pa; }
protected BbListProperty(string name, int value, Type type) { Name = name; var _ifcValue = new IfcValue(); var iValue = Activator.CreateInstance(type) as INTEGER; iValue.Value = value; _ifcValue.Value = iValue; _ifcPropertyListValue = new IfcPropertyListValue { Name = this.Name, ListValues = new List<IfcValue> { _ifcValue }, }; }
/// <summary> /// Returns whether the door is a Fire Exit or not, null if not known /// </summary> /// <param name="door"></param> /// <returns></returns> public static IfcBoolean?GetFireExit(this IfcDoor door) { IfcValue val = door.GetPropertySingleNominalValue("Pset_DoorCommon", "FireExit "); if (val != null && val is IfcBoolean) { return((IfcBoolean)val); } else { return(null); } }
//private IfcUnit _ifcUnit; protected BbSingleProperty(string name, string value, Type type) { Name = name; _ifcValue = new IfcValue(); var iValue = Activator.CreateInstance(type) as STRING; iValue.Value = value; _ifcValue.Value = iValue; _ifcPropertySingleValue = new IfcPropertySingleValue { Name = this.Name, NominalValue = _ifcValue, }; }
/// <summary> /// Returns the fire rating if defined /// </summary> /// <param name="window"></param> /// <returns></returns> public static IfcLabel?GetFireRating(this IfcWindow window) { IfcValue val = window.GetPropertySingleNominalValue("Pset_WindowCommon", "FireRating "); if (val != null && val is IfcLabel) { return((IfcLabel)val); } else { return(null); } }
/// <summary> /// Returns the fire rating if defined /// </summary> /// <param name="door"></param> /// <returns></returns> public static IfcLabel?GetFireRating(this IfcDoor door) { IfcValue val = door.GetPropertySingleNominalValue("Pset_DoorCommon", "FireRating "); if (val != null && val is IfcLabel) { return((IfcLabel)val); } else { return(null); } }
/// <summary> /// True if the wall is external /// </summary> /// <param name="wall"></param> /// <returns></returns> public static IfcBoolean?GetIsExternal(this IfcWall wall) { IfcValue val = wall.GetPropertySingleNominalValue("Pset_WallCommon", "IsExternal"); if (val != null && val is IfcBoolean) { return((IfcBoolean)val); } else { return(null); } }
protected BbSingleProperty(string name, double value, Type type) { Name = name; _ifcValue = new IfcValue (); var iValue = Activator.CreateInstance(type) as REAL; if (iValue == null) throw new InvalidOperationException(); iValue.Value = value; _ifcValue.Value = iValue; _ifcPropertySingleValue = new IfcPropertySingleValue{ Name = this.Name, NominalValue = _ifcValue, }; }
public void AddMoreList(string value) { if (_ifcPropertyListValue.ListValues.Count < 1) { return; } var _ifcValue = new IfcValue(); var iValue = Activator.CreateInstance(_ifcPropertyListValue.ListValues[0].GetType()) as STRING; iValue.Value = value; _ifcValue.Value = iValue; _ifcPropertyListValue.ListValues.Add(_ifcValue); }
public static void SetPropertyTableItemValue(this Xbim.Ifc2x3.Kernel.IfcObject obj, string pSetName, string propertyTableName, IfcValue definingValue, IfcValue definedValue, IfcUnit definingUnit, IfcUnit definedUnit) { IfcPropertySet pset = GetPropertySet(obj, pSetName); IModel model = null; if (pset == null) { model = obj.ModelOf; pset = model.Instances.New <IfcPropertySet>(); pset.Name = pSetName; IfcRelDefinesByProperties relDef = model.Instances.New <IfcRelDefinesByProperties>(); relDef.RelatingPropertyDefinition = pset; relDef.RelatedObjects.Add(obj); } IfcPropertyTableValue table = GetPropertyTableValue(obj, pSetName, propertyTableName); if (table == null) { model = obj.ModelOf; table = model.Instances.New <IfcPropertyTableValue>(tb => { tb.Name = propertyTableName; }); pset.HasProperties.Add(table); table.DefinedUnit = definedUnit; table.DefiningUnit = definingUnit; } if (table.DefiningUnit != definingUnit || table.DefinedUnit != definedUnit) { throw new Exception("Inconsistent definition of the units in the property table."); } IfcValue itemValue = GetPropertyTableItemValue(obj, pSetName, propertyTableName, definingValue); if (itemValue != null) { itemValue = definedValue; } else { //if (table.DefiningValues == null) table.DefiningValues = new XbimList<IfcValue>(); table.DefiningValues.Add(definingValue); //if (table.DefinedValues == null) table.DefinedValues = new XbimList<IfcValue>(); table.DefinedValues.Add(definedValue); //check of integrity if (table.DefinedValues.Count != table.DefiningValues.Count) { throw new Exception("Inconsistent state of the property table. Number of defined and defining values are not the same."); } } }
protected BbListProperty(string name, DateTime value) { Name = name; var _ifcValue = new IfcValue(); var iValue = IfcTimeStamp.GetTimeStamp(value); _ifcValue.Value = iValue; _ifcPropertyListValue = new IfcPropertyListValue { Name = this.Name, ListValues = new List <IfcValue> { _ifcValue }, }; }
protected BbSingleProperty(string name, bool value) { Name = name; _ifcValue = new IfcValue(); var iValue = new IfcBoolean { Value = value }; _ifcValue.Value = iValue; _ifcPropertySingleValue = new IfcPropertySingleValue { Name = this.Name, NominalValue = _ifcValue, }; }
protected BbListProperty(string name, double value, Type type) { Name = name; var _ifcValue = new IfcValue(); var iValue = Activator.CreateInstance(type) as REAL; if (iValue == null) throw new InvalidOperationException(); iValue.Value = value; _ifcValue.Value = iValue; _ifcPropertyListValue = new IfcPropertyListValue { Name = this.Name, ListValues = new List<IfcValue> { _ifcValue }, }; }
public override void Parse(int propIndex, IPropertyValue value, int[] nestedIndex) { switch (propIndex) { case 0: _valueComponent = (IfcValue)(value.EntityVal); return; case 1: _unitComponent = (IfcUnit)(value.EntityVal); return; default: throw new XbimParserException(string.Format("Attribute index {0} is out of range for {1}", propIndex + 1, GetType().Name.ToUpper())); } }
protected BbListProperty(string name, int value, Type type) { Name = name; var _ifcValue = new IfcValue(); var iValue = Activator.CreateInstance(type) as INTEGER; iValue.Value = value; _ifcValue.Value = iValue; _ifcPropertyListValue = new IfcPropertyListValue { Name = this.Name, ListValues = new List <IfcValue> { _ifcValue }, }; }
public virtual void IfcParse(int propIndex, IPropertyValue value) { switch (propIndex) { case 0: _valueComponent = (IfcValue)value.EntityVal; break; case 1: _unitComponent = (IfcUnit)value.EntityVal; break; default: this.HandleUnexpectedAttribute(propIndex, value); break; } }
public static void SetPropertyTableItemValue(this Xbim.Ifc2x3.Kernel.IfcTypeObject obj, string pSetName, string propertyTableName, IfcValue definingValue, IfcValue definedValue, IfcUnit definingUnit, IfcUnit definedUnit) { IfcPropertySet pset = GetPropertySet(obj, pSetName); IModel model = null; if (pset == null) { IPersistIfcEntity ent = obj as IPersistIfcEntity; model = ent != null ? ent.ModelOf : obj.ModelOf; pset = model.Instances.New <IfcPropertySet>(); pset.Name = pSetName; obj.AddPropertySet(pset); } IfcPropertyTableValue table = GetPropertyTableValue(obj, pSetName, propertyTableName); if (table == null) { IPersistIfcEntity ent = obj as IPersistIfcEntity; model = ent != null ? ent.ModelOf : obj.ModelOf; table = model.Instances.New <IfcPropertyTableValue>(tb => { tb.Name = propertyTableName; }); pset.HasProperties.Add(table); table.DefinedUnit = definedUnit; table.DefiningUnit = definingUnit; } if (table.DefiningUnit != definingUnit || table.DefinedUnit != definedUnit) { throw new Exception("Inconsistent definition of the units in the property table."); } IfcValue itemValue = GetPropertyTableItemValue(obj, pSetName, propertyTableName, definingValue); if (itemValue != null) { itemValue = definedValue; } else { table.DefiningValues.Add(definingValue); table.DefinedValues.Add(definedValue); //check of integrity if (table.DefinedValues.Count != table.DefiningValues.Count) { throw new Exception("Inconsistent state of the property table. Number of defined and defining values are not the same."); } } }
internal ElementIfcProperties(IfcElement element) : base(element) { string keyword = element.KeyWord; bool readOnly = true; Add(new CustomProperty("ObjectType", element.ObjectType, typeof(string), readOnly, true) { Group = keyword }); Add(new CustomProperty("Type", element.GetType().Name, typeof(string), true, true) { Group = keyword }); Add(new CustomProperty("Tag", element.Tag, typeof(string), readOnly, true) { Group = keyword }); IfcElementType elementType = element.RelatingType as IfcElementType; if (elementType != null) { List.Add(new ElementTypeIfcProperties(elementType)); } foreach (IfcPropertySet pset in element.IsDefinedBy.ToList().ConvertAll(x => x.RelatingPropertyDefinition).OfType <IfcPropertySet>()) { foreach (IfcPropertySingleValue psv in pset.HasProperties.Values.ToList().OfType <IfcPropertySingleValue>()) { IfcValue val = psv.NominalValue; if (val == null) { Add(new CustomProperty(psv.Name, "", typeof(string), readOnly, true) { Group = pset.Name }); } else { Object obj = val.Value; Add(new CustomProperty(psv.Name, obj, obj.GetType(), readOnly, true) { Group = pset.Name }); } } } }
protected BbListProperty(string name, bool value) { Name = name; var _ifcValue = new IfcValue(); var iValue = new IfcBoolean { Value = value }; _ifcValue.Value = iValue; _ifcPropertyListValue = new IfcPropertyListValue { Name = this.Name, ListValues = new List <IfcValue> { _ifcValue }, }; }
static private AttributeValueType GetAttributeValue(IfcPropertyBoundedValue ifcPropertyBoundedValue) { var attributeValueType = new AttributeValueType(); IfcValue ifcValue = ifcPropertyBoundedValue.LowerBoundValue; //only upper and lowwer bounds are supported by COBie on integer and decimal values if (ifcValue.UnderlyingSystemType == typeof(int) || ifcValue.UnderlyingSystemType == typeof(long) || ifcValue.UnderlyingSystemType == typeof(short) || ifcValue.UnderlyingSystemType == typeof(byte) || ifcValue.UnderlyingSystemType == typeof(int?) || ifcValue.UnderlyingSystemType == typeof(long?) || ifcValue.UnderlyingSystemType == typeof(short?) || ifcValue.UnderlyingSystemType == typeof(byte?)) { var integerValue = new AttributeIntegerValueType(); if (ifcPropertyBoundedValue.UpperBoundValue != null) { integerValue.MaxValueInteger = Convert.ToInt32(ifcPropertyBoundedValue.UpperBoundValue.Value); } if (ifcPropertyBoundedValue.LowerBoundValue != null) { integerValue.MinValueInteger = Convert.ToInt32(ifcPropertyBoundedValue.LowerBoundValue.Value); } attributeValueType.Item = integerValue; attributeValueType.ItemElementName = ItemChoiceType.AttributeIntegerValue; } else if (ifcValue.UnderlyingSystemType == typeof(double) || ifcValue.UnderlyingSystemType == typeof(float) || ifcValue.UnderlyingSystemType == typeof(double?) || ifcValue.UnderlyingSystemType == typeof(float?)) { var decimalValue = new AttributeDecimalValueType(); if (ifcPropertyBoundedValue.UpperBoundValue != null) { decimalValue.MaxValueDecimal = (double)ifcPropertyBoundedValue.UpperBoundValue.Value; decimalValue.MaxValueDecimalSpecified = true; } if (ifcPropertyBoundedValue.LowerBoundValue != null) { decimalValue.MinValueDecimal = (double)ifcPropertyBoundedValue.LowerBoundValue.Value; decimalValue.MinValueDecimalSpecified = true; } attributeValueType.Item = decimalValue; attributeValueType.ItemElementName = ItemChoiceType.AttributeDecimalValue; } else { attributeValueType = null; } return(attributeValueType); }
protected BbSingleProperty(string name, double value, Type type) { Name = name; _ifcValue = new IfcValue(); var iValue = Activator.CreateInstance(type) as REAL; if (iValue == null) { throw new InvalidOperationException(); } iValue.Value = value; _ifcValue.Value = iValue; _ifcPropertySingleValue = new IfcPropertySingleValue { Name = this.Name, NominalValue = _ifcValue, }; }
protected BbListProperty(string name, IList <string> values, Type type) { Name = name; _ifcPropertyListValue = new IfcPropertyListValue { Name = this.Name, ListValues = new List <IfcValue>(), }; foreach (var value in values) { var _ifcValue = new IfcValue(); var iValue = Activator.CreateInstance(type) as STRING; iValue.Value = value; _ifcValue.Value = iValue; _ifcPropertyListValue.ListValues.Add(_ifcValue); } }
protected BbListProperty(string name, IList<string> values, Type type) { Name = name; _ifcPropertyListValue = new IfcPropertyListValue { Name = this.Name, ListValues = new List<IfcValue>(), }; foreach(var value in values) { var _ifcValue = new IfcValue(); var iValue = Activator.CreateInstance(type) as STRING; iValue.Value = value; _ifcValue.Value = iValue; _ifcPropertyListValue.ListValues.Add(_ifcValue); } }
bool HasPropertyLikeExternalTrue(IfcWall wall) { //get relations property IEnumerable <IfcRelDefinesByProperties> rels = wall.IsDefinedByProperties; foreach (var rel in rels) { //get property set IfcPropertySet pSet = rel.RelatingPropertyDefinition as IfcPropertySet; if (pSet == null) { continue; } foreach (IfcProperty prop in pSet.HasProperties) { //get properties IfcPropertySingleValue singleVal = prop as IfcPropertySingleValue; if (singleVal == null) { continue; } if (singleVal.Name == "Wall Function") { //check value of the property IfcValue val = singleVal.NominalValue; if (val.UnderlyingSystemType == typeof(int)) { if ((int)val.Value == 1) { return(true); } } else if (val.UnderlyingSystemType == typeof(int?)) { if ((int?)val.Value == 1) { return(true); } } } } } return(false); }
private void AddProperty(IfcObject ifcObject, IfcValue value, string cobiePropertyName, IfcPropertySet propertySet, NamedProperty namedProperty) { try { var property = TargetRepository.Instances.New <IfcPropertySingleValue>(); property.NominalValue = value; property.Description = "Converted from COBie " + cobiePropertyName; property.Name = namedProperty.PropertyName; propertySet.HasProperties.Add(property); var relDef = TargetRepository.Instances.New <IfcRelDefinesByProperties>(); relDef.RelatingPropertyDefinition = propertySet; relDef.RelatedObjects.Add(ifcObject); } catch (Exception e) { throw new Exception("Failed to convert a COBie Value to and Ifc Single Value Property. " + e.Message); } }
public static void SetExtendedSingleValue(this IfcMaterial material, IModel model, string pSetName, string propertyName, IfcValue value) { IfcExtendedMaterialProperties pSet = GetExtendedProperties(material, model, pSetName) ?? model.Instances.New<IfcExtendedMaterialProperties>(ps => { ps.Material = material; ps.Name = pSetName; }); IfcPropertySingleValue singleValue = GetExtendedSingleValue(material, model, pSetName, propertyName); if (singleValue == null) { singleValue = model.Instances.New<IfcPropertySingleValue>(sv => { sv.Name = propertyName; sv.NominalValue = value; }); pSet.ExtendedProperties.Add(singleValue); } }
public override void IfcParse(int propIndex, IPropertyValue value) { switch (propIndex) { case 0: case 1: base.IfcParse(propIndex, value); break; case 2: _nominalValue = (IfcValue) value.EntityVal; break; case 3: _unit = (IfcUnit) value.EntityVal; break; default: this.HandleUnexpectedAttribute(propIndex, value); break; } }
public void AddMoreList(string value) { if( _ifcPropertyListValue.ListValues.Count < 1) return; var _ifcValue = new IfcValue(); var iValue = Activator.CreateInstance(_ifcPropertyListValue.ListValues[0].GetType()) as STRING; iValue.Value = value; _ifcValue.Value = iValue; _ifcPropertyListValue.ListValues.Add(_ifcValue); }
internal IfcAppliedValue(IfcAppliedValue v) : base() { mName = v.mName; mDescription = v.mDescription; mAppliedValue = v.mAppliedValue; mAppliedValueValue = v.mAppliedValueValue; mUnitBasis = v.mUnitBasis; mApplicableDate = v.mApplicableDate; mFixedUntilDate = v.mFixedUntilDate; mCategory = v.mCategory; mCondition = v.mCondition; mArithmeticOperator = v.mArithmeticOperator; mComponents.AddRange(v.mComponents); }
public IfcTableRow(DatabaseIfc m, IfcValue val) : this(m, new List<IfcValue>() { val }, false) { }
public virtual void IfcParse(int propIndex, IPropertyValue value) { switch (propIndex) { case 0: _valueComponent = (IfcValue) value.EntityVal; break; case 1: _unitComponent = (IfcUnit) value.EntityVal; break; default: this.HandleUnexpectedAttribute(propIndex, value); break; } }
protected BbListProperty(string name, DateTime value) { Name = name; var _ifcValue = new IfcValue(); var iValue = IfcTimeStamp.GetTimeStamp(value); _ifcValue.Value = iValue; _ifcPropertyListValue = new IfcPropertyListValue { Name = this.Name, ListValues = new List<IfcValue> { _ifcValue }, }; }
public static void SetPropertyTableItemValue(this Xbim.Ifc2x3.Kernel.IfcTypeObject obj, string pSetName, string propertyTableName, IfcValue definingValue, IfcValue definedValue) { SetPropertyTableItemValue(obj, pSetName, propertyTableName, definingValue, definedValue, null, null); }
public static IfcValue GetPropertyTableItemValue(this Xbim.Ifc2x3.Kernel.IfcTypeObject obj, string pSetName, string propertyTableName, IfcValue definingValue) { IfcPropertyTableValue table = GetPropertyTableValue(obj, pSetName, propertyTableName); if (table == null) return null; IList<IfcValue> definingValues = table.DefiningValues; if (definingValues == null) return null; if (!definingValues.Contains(definingValue)) return null; int index = definingValues.IndexOf(definingValue); if (table.DefinedValues.Count < index + 1) return null; return table.DefinedValues[index]; }
internal IfcMetric(IfcMetric m) : base(m) { mBenchMark = m.mBenchMark; mValueSource = m.mValueSource; mDataValue = m.mDataValue; mDataValueValue = m.mDataValueValue; mReferencePath = m.mReferencePath; }
internal IfcMeasureWithUnit(IfcValue v, IfcUnit u) : base(u.Database) { mValueComponent = v; mUnitComponent = u.Index; }
internal IfcMeasureWithUnit(double value, IfcUnit u) : base(u.Database) { mValueComponent = new IfcReal(value); mUnitComponent = u.Index; }
public IfcPropertySingleValue(DatabaseIfc m, string name, string desc, IfcValue val, IfcUnit unit) : this(m, name, desc,val) { Unit = unit; }
public static void SetPropertyTableItemValue(this Xbim.Ifc2x3.Kernel.IfcTypeObject obj, string pSetName, string propertyTableName, IfcValue definingValue, IfcValue definedValue, IfcUnit definingUnit, IfcUnit definedUnit) { IfcPropertySet pset = GetPropertySet(obj, pSetName); IModel model = null; if (pset == null) { IPersistIfcEntity ent = obj as IPersistIfcEntity; model = ent != null ? ent.ModelOf : obj.ModelOf; pset = model.Instances.New<IfcPropertySet>(); pset.Name = pSetName; obj.AddPropertySet(pset); } IfcPropertyTableValue table = GetPropertyTableValue(obj, pSetName, propertyTableName); if (table == null) { IPersistIfcEntity ent = obj as IPersistIfcEntity; model = ent != null ? ent.ModelOf : obj.ModelOf; table = model.Instances.New<IfcPropertyTableValue>(tb => { tb.Name = propertyTableName; }); pset.HasProperties.Add(table); table.DefinedUnit = definedUnit; table.DefiningUnit = definingUnit; } if (table.DefiningUnit != definingUnit || table.DefinedUnit != definedUnit) throw new Exception("Inconsistent definition of the units in the property table."); IfcValue itemValue = GetPropertyTableItemValue(obj, pSetName, propertyTableName, definingValue); if (itemValue != null) { itemValue = definedValue; } else { table.DefiningValues.Add(definingValue); table.DefinedValues.Add(definedValue); //check of integrity if (table.DefinedValues.Count != table.DefiningValues.Count) throw new Exception("Inconsistent state of the property table. Number of defined and defining values are not the same."); } }
public IfcPropertySingleValue(DatabaseIfc m, string name, string desc, IfcValue value) : base(m, name, desc) { mNominalValue = value; }
public static IfcPropertySingleValue SetPropertySingleValue(this Xbim.Ifc2x3.Kernel.IfcTypeObject obj, string pSetName, string propertyName, IfcValue value) { IfcPropertySet pset = GetPropertySet(obj, pSetName); IfcPropertySingleValue property = null; IModel model = null; if (pset == null) { //if (value == null) return; IPersistIfcEntity ent = obj as IPersistIfcEntity; model = ent!= null? ent.ModelOf : obj.ModelOf; pset = model.Instances.New<IfcPropertySet>(); pset.Name = pSetName; obj.AddPropertySet(pset); } //change existing property of the same name from the property set IfcPropertySingleValue singleVal = GetPropertySingleValue(obj, pSetName, propertyName); if (singleVal != null) { property = singleVal; singleVal.NominalValue = value; } else { //if (value == null) return; IPersistIfcEntity ent = obj as IPersistIfcEntity; model = ent != null ? ent.ModelOf : obj.ModelOf; property = model.Instances.New<IfcPropertySingleValue>(psv => { psv.Name = propertyName; psv.NominalValue = value; }); pset.HasProperties.Add(property); } return property; }
protected BbListProperty(string name, bool value) { Name = name; var _ifcValue = new IfcValue(); var iValue = new IfcBoolean { Value = value }; _ifcValue.Value = iValue; _ifcPropertyListValue = new IfcPropertyListValue { Name = this.Name, ListValues = new List<IfcValue> { _ifcValue }, }; }
public void SetProperty(string propertySetName, string propertyName, IfcValue value) { if (value == null) { _object.DeletePropertySingleValueValue(propertySetName, propertyName); return; } _object.SetPropertySingleValue(propertySetName, propertyName, value); }
public IfcMetric(DatabaseIfc db, string name, IfcConstraintEnum constraint, IfcValue dataValue) : base(db, name, constraint) { mDataValueValue = dataValue; }
public IfcMeasureWithUnit(IfcValue val, IfcUnit unit) { _valueComponent = val; _unitComponent = unit; }
public static void SetExtendedSingleValue(this IfcMaterial material, string pSetName, string propertyName, IfcValue value) { IModel model = material.ModelOf; SetExtendedSingleValue(material, model, pSetName, propertyName, value); }
internal IfcMeasureWithUnit(IfcMeasureWithUnit m) : base() { mValueComponent = m.mValueComponent; mUnitComponent = m.mUnitComponent; }