예제 #1
0
        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);
        }
예제 #2
0
        public B5dProjectNode BuildTree(B5dObject b5dParent, IIfcObjectDefinition ifcParent, IIfcObjectDefinition ifcChild)
        {
            B5dProjectNode b5dChild = IfcObjectConverter.Convert(ifcChild);

            if (ifcChild is IIfcProject)
            {
                currentProject = b5dChild;
            }
            else
            {
                GltfRef.TryCreatingGltfRef(ifcChild.GlobalId.ToString(), currentProject, b5dChild);
            }


            if (b5dParent != null)
            {
                B5dProjectNodeChild ChildRelationship = B5dProjectNodeChild.CreateNodeChildRelation(b5dParent, b5dChild);
            }

            if (ifcChild is IIfcObject ifcObject)
            {
                // Use containsElements to recursively create nodes for Window, Door, Slab, Wall etc
                foreach (var ifcSpatialElement in RelContainedInSpatialStructure.GetElementsIn(ifcObject))
                {
                    BuildTree(b5dChild, ifcChild, ifcSpatialElement);
                }

                // Use isDecomposedy to recursively create nodes for Project, Site, Building, Story and Space
                foreach (var ifcSpatialStructure in RelAggregates.GetSpatialStructuresIn(ifcObject))
                {
                    BuildTree(b5dChild, ifcChild, ifcSpatialStructure);
                }

                // Use isDefinedBy to convert all of the ifcProperties
                PropertyConverter.ConvertProperties(ifcObject, b5dChild);
            }

            return(b5dChild);
        }