private IIfcTypeObject GetDefiningTypeObject(IIfcObject ifcObject) { IIfcTypeObject definingType; _objectToTypeObjectMap.TryGetValue(ifcObject, out definingType); return(definingType); }
public static void ConvertClassificationIn(IIfcObject ifcObject) { var classificationRelations = ifcObject.Model.Instances.Where <IfcRelAssociatesClassification>(r => r.RelatedObjects.Contains(ifcObject)); if (classificationRelations == null) { return; } foreach (IIfcRelAssociatesClassification classificationRelation in classificationRelations) { foreach (var type in classificationRelation.RelatedObjects) { var b5dType = new B5dType() { InstanceTypeSpecifier = type.ExpressType.Name.ToString(), }; //var typeProps = PropertyConverter.ConvertProperties(type, b5dType); } //var b5dRelationship = new B5dPhysical() //{ // WhatIs = new B5dType() // { // Name = classificationRelation. // } //} } }
public static IEnumerable <IIfcObjectDefinition> GetSpatialStructuresIn(IIfcObject ifcObject) { // Use isDecomposedy to recursively create nodes for Project, Site, Building, Story and Space var spatialStructures = ifcObject.IsDecomposedBy.SelectMany(r => r.RelatedObjects); return(spatialStructures); }
public TValue GetCoBieProperty <TValue>(string valueName, IIfcObject ifcObject) where TValue : struct { XbimAttributedObject attributedObject; if (_attributedObjects.TryGetValue(ifcObject, out attributedObject)) { string[] propertyNames; if (_cobieFieldMap.TryGetValue(valueName, out propertyNames)) { foreach (var propertyName in propertyNames) { TValue value; if (attributedObject.GetSimplePropertyValue(propertyName, out value)) { return(value); } } } else { throw new ArgumentException("Illegal COBie Attribute name:", valueName); } } return(default(TValue)); }
public Dictionary <string, IfcObjectAttributes> GetObjectsOfClass(string classname) { Dictionary <string, IfcObjectAttributes> objs = new Dictionary <string, IfcObjectAttributes>(); foreach (var obj in _model.Instances.Where(x => x.GetType().Name.Equals(classname))) { if (obj is IIfcObject) { IIfcObject ifcObj = (IIfcObject)obj; bool hasGeometry = false; if (obj is IIfcProduct) { IIfcProduct prod = (IIfcProduct)obj; if (prod.Representation != null) { hasGeometry = true; } } objs.Add(ifcObj.GlobalId, new IfcObjectAttributes { Name = ifcObj.Name, Description = ifcObj.Description, GlobalId = ifcObj.GlobalId, Namespace = obj.GetType().Namespace, IfcType = obj.GetType().Name, HasGeometry = hasGeometry }); } } return(objs); }
public static IEnumerable <IIfcPropertySingleValue> GetProperties(IIfcObject ifcObject) { var props = ifcObject.IsDefinedBy .Where(r => r.RelatingPropertyDefinition is IIfcPropertySet) .SelectMany(r => ((IIfcPropertySet)r.RelatingPropertyDefinition).HasProperties) .OfType <IIfcPropertySingleValue>(); return(props); }
public static IEnumerable <IIfcProduct> GetElementsIn(IIfcObject ifcObject) { // Use containsElements to recursively create nodes for Window, Door, Slab, Wall etc if (ifcObject is IIfcSpatialStructureElement spatialElement) { IEnumerable <IIfcProduct> elements = spatialElement.ContainsElements.SelectMany(rel => rel.RelatedElements); return(elements); } return(new List <IIfcProduct>()); }
public static List <B5dProperty> ConvertProperties(IIfcObject ifcObject, B5dObject b5dObject) { var ifcProperties = GetProperties(ifcObject); var b5dProperties = new List <B5dProperty>(); foreach (var prop in ifcProperties) { var b5dProperty = PropertyConverter.ConvertProperty(prop, b5dObject); b5dProperties.Add(b5dProperty); } return(b5dProperties); }
public IEnumerable <IIfcPropertySingleValue> GetPropsForProduct(IIfcObject Object) { if (Object == null) { return(new List <IIfcPropertySingleValue>()); } var Properties = Object.IsDefinedBy .Where(r => r.RelatingPropertyDefinition is IIfcPropertySet) .SelectMany(r => ((IIfcPropertySet)r.RelatingPropertyDefinition).HasProperties) .OfType <IIfcPropertySingleValue>(); return(Properties); }
internal void SetBase(IIfcObject element) { this.ifcEntityLabel = element.EntityLabel; this.ifcGuid = element.GlobalId; this.ifcExpressTypeName = element.GetType().Name; if (element.Name != null) { ifcInfo.Add(new IfcInfo("name", element.Name)); } if (element.Description != null) { ifcInfo.Add(new IfcInfo("description", element.Description.Value)); } if (element.ObjectType != null) { ifcInfo.Add(new IfcInfo("ObjectType", element.ObjectType.Value)); } }