Exemplo n.º 1
0
        // Creates a new component descriptor
        private Component CreateComponent(IIfcProduct product, IEnumerable <Classifier> concepts, out int?optParentLabel)
        {
            var parent    = product.Parent <IIfcProduct>().FirstOrDefault();
            var component = new Component
            {
                Id = product.GlobalId.ToGlobalUniqueId(),
                // -1 reserved for roots
                Parent = parent?.GlobalId.ToGlobalUniqueId(),
                Name   = product.Name ?? "",
            };

            // Add IFC express type by default
            component.Concepts.Add(CommonExtensions.DefaultXbimEntityQualifier(product).ToClassifier());

            // Add additiona user qualifiers
            foreach (var userProductQualifier in Settings.UserProductQualifier)
            {
                component.Concepts.Add(userProductQualifier(product).ToClassifier());
            }

            component.Concepts.AddRange(concepts);

            component.Children.AddRange(product.Children <IIfcProduct>().Select(p => p.GlobalId.ToGlobalUniqueId()));
            optParentLabel = parent?.EntityLabel;
            return(component);
        }