/// <summary> /// Processes IfcRelDefinesByProperties. /// </summary> /// <param name="ifcRelDefinesByProperties">The IfcRelDefinesByProperties handle.</param> /// <param name="propertySets">The map of property sets that will be modified by this function based on the IfcRelDefinesByProperties handle.</param> static public void ProcessIFCRelDefinesByProperties(IFCAnyHandle ifcRelDefinesByProperties, IDictionary <string, IFCPropertySetDefinition> propertySets) { IFCAnyHandle propertySetDefinition = IFCAnyHandleUtil.GetInstanceAttribute(ifcRelDefinesByProperties, "RelatingPropertyDefinition"); if (IFCAnyHandleUtil.IsNullOrHasNoValue(propertySetDefinition)) { Importer.TheLog.LogNullError(IFCEntityType.IfcPropertySetDefinition); return; } IFCPropertySetDefinition ifcPropertySet = IFCPropertySetDefinition.ProcessIFCPropertySetDefinition(propertySetDefinition); if (ifcPropertySet != null) { int propertySetNumber = 1; string propertySetName = ifcPropertySet.Name; while (true) { string name = (propertySetNumber == 1) ? propertySetName : propertySetName + " " + propertySetNumber.ToString(); if (propertySets.ContainsKey(name)) { propertySetNumber++; } else { propertySets[name] = ifcPropertySet; break; } } } }
private static bool IsColumnLoadBearing(IFCObjectDefinition entity) { if (entity == null) { throw new InvalidOperationException("Function called for null entity."); } // TODO: Figure out load bearing for IfcColumnType. if (!(entity is IFCObject)) { return(false); } IFCObject columnEntity = entity as IFCObject; IDictionary <string, IFCPropertySetDefinition> columnPropertySets = columnEntity.PropertySets; IFCPropertySetDefinition psetColumnCommonDef = null; if (columnPropertySets == null || (!columnPropertySets.TryGetValue("Pset_ColumnCommon", out psetColumnCommonDef))) { return(false); } if (!(psetColumnCommonDef is IFCPropertySet)) { throw new InvalidOperationException("Invalid Pset_ColumnCommon class."); } IFCPropertySet psetColumnCommon = psetColumnCommonDef as IFCPropertySet; IDictionary <string, IFCProperty> columnCommonProperties = psetColumnCommon.IFCProperties; IFCProperty loadBearingPropertyBase = null; if (columnCommonProperties == null || (!columnCommonProperties.TryGetValue("LoadBearing", out loadBearingPropertyBase))) { return(false); } if (!(loadBearingPropertyBase is IFCSimpleProperty)) { throw new InvalidOperationException("Invalid Pset_ColumnCommon::LoadBearing property."); } IFCSimpleProperty loadBearingProperty = loadBearingPropertyBase as IFCSimpleProperty; IList <IFCPropertyValue> propertyValues = loadBearingProperty.IFCPropertyValues; if (propertyValues == null || propertyValues.Count == 0) { return(false); } return(propertyValues[0].AsBoolean()); }