protected override Xbim.CobieLiteUk.System Mapping(IIfcPropertySet pSet, Xbim.CobieLiteUk.System target)
        {
            var helper = ((IfcToCOBieLiteUkExchanger)Exchanger).Helper;

            //Add Assets
            var systemAssignments = helper.GetSystemAssignments(pSet);

            var    ifcObjectDefinitions = systemAssignments as IList <IIfcObjectDefinition> ?? systemAssignments.ToList();
            string name = string.Empty;

            if (ifcObjectDefinitions.Any())
            {
                name = GetSystemName(helper, ifcObjectDefinitions);

                target.Components = new List <AssetKey>();
                foreach (var ifcObjectDefinition in ifcObjectDefinitions)
                {
                    var assetKey = new AssetKey {
                        Name = ifcObjectDefinition.Name
                    };
                    if (!target.Components.Contains(assetKey))
                    {
                        target.Components.Add(assetKey);
                    }
                }
            }
            target.ExternalEntity = helper.ExternalEntityName(pSet);
            target.ExternalId     = helper.ExternalEntityIdentity(pSet);
            target.ExternalSystem = helper.ExternalSystemName(pSet);
            target.Name           = string.IsNullOrEmpty(name) ? "Unknown" : name;
            target.Description    = string.IsNullOrEmpty(pSet.Description) ? name : pSet.Description.ToString();
            target.CreatedBy      = helper.GetCreatedBy(pSet);
            target.CreatedOn      = helper.GetCreatedOn(pSet);
            target.Categories     = helper.GetCategories(pSet);

            //Attributes, no attributes from PSet as Pset is the attributes, assume that component attributes are extracted by each component anyway
            //target.Attributes = helper.GetAttributes(pSet);

            //Documents
            var docsMappings = Exchanger.GetOrCreateMappings <MappingIfcDocumentSelectToDocument>();

            helper.AddDocuments(docsMappings, target, pSet);

            //TODO:
            //System Issues

            return(target);
        }
Example #2
0
 private void AddPropertySet(IIfcPropertySet pSet, ObservableCollection <PropertyItem> _properties)
 {
     if (pSet == null)
     {
         return;
     }
     foreach (var item in pSet.HasProperties.OfType <IIfcPropertySingleValue>()) //handle IfcPropertySingleValue
     {
         AddProperty(item, pSet.Name, _properties);
     }
     foreach (var item in pSet.HasProperties.OfType <IIfcComplexProperty>()) // handle IfcComplexProperty
     {
         // by invoking the undrlying addproperty function with a longer path
         foreach (var composingProperty in item.HasProperties.OfType <IIfcPropertySingleValue>())
         {
             AddProperty(composingProperty, pSet.Name + " / " + item.Name, _properties);
         }
     }
 }
Example #3
0
        public static IIfcRelDefinesByProperties NewIfcRelDefinesByProperties(this IModel s, IIfcPropertySet set)
        {
            if (set.Model.SchemaVersion != s.SchemaVersion)
            {
                throw new ArgumentException($"Misaligned schema versions {s.SchemaVersion} != {set.Model.SchemaVersion}");
            }

            switch (s.SchemaVersion)
            {
            case Xbim.Common.Step21.XbimSchemaVersion.Ifc2X3:
                return(s.NewIfc2x3PropertyRelation(set as Xbim.Ifc2x3.Kernel.IfcPropertySet));

            case Xbim.Common.Step21.XbimSchemaVersion.Ifc4:
            case Xbim.Common.Step21.XbimSchemaVersion.Ifc4x1:
                return(s.NewIfc4PropertyRelation(set as Xbim.Ifc4.Kernel.IfcPropertySet));

            default:
                throw new NotImplementedException($"Missing implementation for {s.SchemaVersion}");
            }
        }
Example #4
0
 public static IEnumerable <Feature> ToFeatureSet <T>(this IIfcPropertySet set) where T : IIfcProperty
 {
     throw new NotImplementedException();
 }