public override void Parse(int propIndex, IPropertyValue value, int[] nestedIndex) { switch (propIndex) { case 0: case 1: case 2: case 3: case 4: case 5: case 6: case 7: case 8: base.Parse(propIndex, value, nestedIndex); return; case 9: _baseCosts.InternalAdd((IfcAppliedValue)value.EntityVal); return; case 10: _baseQuantity = (IfcPhysicalQuantity)(value.EntityVal); return; default: throw new XbimParserException(string.Format("Attribute index {0} is out of range for {1}", propIndex + 1, GetType().Name.ToUpper())); } }
protected IfcConstructionResource(IfcGloballyUniqueId __GlobalId, IfcOwnerHistory __OwnerHistory, IfcLabel?__Name, IfcText?__Description, IfcLabel?__ObjectType, IfcIdentifier?__Identification, IfcText?__LongDescription, IfcResourceTime __Usage, IfcAppliedValue[] __BaseCosts, IfcPhysicalQuantity __BaseQuantity) : base(__GlobalId, __OwnerHistory, __Name, __Description, __ObjectType, __Identification, __LongDescription) { this.Usage = __Usage; this.BaseCosts = new List <IfcAppliedValue>(__BaseCosts); this.BaseQuantity = __BaseQuantity; }
public static bool Add(this IfcPropertySetDefinition pSetDefinition, IfcPhysicalQuantity quantity) { var quantSet = pSetDefinition as IfcElementQuantity; if (quantSet != null) { quantSet.Quantities.Add(quantity); } return(quantSet != null); }
internal static TCoBieValueBaseType ConvertAttribute <TCoBieValueBaseType>(IfcPhysicalQuantity ifcQuantity) where TCoBieValueBaseType : AttributeValue, new() { var ifcQuantityLength = ifcQuantity as IfcQuantityLength; var ifcQuantityArea = ifcQuantity as IfcQuantityArea; var ifcQuantityVolume = ifcQuantity as IfcQuantityVolume; var ifcQuantityCount = ifcQuantity as IfcQuantityCount; var ifcQuantityWeight = ifcQuantity as IfcQuantityWeight; var ifcQuantityTime = ifcQuantity as IfcQuantityTime; var ifcPhysicalComplexQuantity = ifcQuantity as IfcPhysicalComplexQuantity; var ifcPhysicalSimpleQuantity = ifcQuantity as IfcPhysicalSimpleQuantity; var result = new TCoBieValueBaseType(); if (ifcPhysicalSimpleQuantity != null && ifcPhysicalSimpleQuantity.Unit != null) { result.Unit = ifcPhysicalSimpleQuantity.Unit.GetName(); } if (ifcQuantityLength != null) { SetCoBieAttributeValue(result, ifcQuantityLength.LengthValue); } else if (ifcQuantityArea != null) { SetCoBieAttributeValue(result, ifcQuantityArea.AreaValue); } else if (ifcQuantityVolume != null) { SetCoBieAttributeValue(result, ifcQuantityVolume.VolumeValue); } else if (ifcQuantityCount != null) { SetCoBieAttributeValue(result, ifcQuantityCount.CountValue); } else if (ifcQuantityWeight != null) { SetCoBieAttributeValue(result, ifcQuantityWeight.WeightValue); } else if (ifcQuantityTime != null) { SetCoBieAttributeValue(result, ifcQuantityTime.TimeValue); } else if (ifcPhysicalComplexQuantity != null) { //Logger.WarnFormat("Ifc Physical Complex Quantities values are not supported in COBie"); } else { result = null; } return(result); }
/// <summary> /// Adds a new IfcPhysicalQuantity to the IfcElementQuantity called propertySetName /// </summary> /// <param name="propertySetName">Name of the IfcElementQuantity property set</param> /// <param name="quantity">quantity to be added</param> /// <param name="methodOfMeasurement">Sets the method of measurement, if not null overrides previous value</param> public IfcElementQuantity AddQuantity(string propertySetName, IfcPhysicalQuantity quantity, string methodOfMeasurement) { var pset = GetElementQuantity(propertySetName) as IfcElementQuantity; if (pset == null) { pset = Model.Instances.New <IfcElementQuantity>(); pset.Name = propertySetName; var relDef = Model.Instances.New <IfcRelDefinesByProperties>(); relDef.RelatingPropertyDefinition = pset; relDef.RelatedObjects.Add(this); } pset.Quantities.Add(quantity); if (!string.IsNullOrEmpty(methodOfMeasurement)) { pset.MethodOfMeasurement = methodOfMeasurement; } return(pset); }
public IfcLaborResource(IfcGloballyUniqueId __GlobalId, IfcOwnerHistory __OwnerHistory, IfcLabel?__Name, IfcText?__Description, IfcLabel?__ObjectType, IfcIdentifier?__Identification, IfcText?__LongDescription, IfcResourceTime __Usage, IfcAppliedValue[] __BaseCosts, IfcPhysicalQuantity __BaseQuantity, IfcLaborResourceTypeEnum?__PredefinedType) : base(__GlobalId, __OwnerHistory, __Name, __Description, __ObjectType, __Identification, __LongDescription, __Usage, __BaseCosts, __BaseQuantity) { this._PredefinedType = __PredefinedType; }
public IfcConstructionEquipmentResourceType(IfcGloballyUniqueId __GlobalId, IfcOwnerHistory __OwnerHistory, IfcLabel?__Name, IfcText?__Description, IfcIdentifier?__ApplicableOccurrence, IfcPropertySetDefinition[] __HasPropertySets, IfcIdentifier?__Identification, IfcText?__LongDescription, IfcLabel?__ResourceType, IfcAppliedValue[] __BaseCosts, IfcPhysicalQuantity __BaseQuantity, IfcConstructionEquipmentResourceTypeEnum __PredefinedType) : base(__GlobalId, __OwnerHistory, __Name, __Description, __ApplicableOccurrence, __HasPropertySets, __Identification, __LongDescription, __ResourceType, __BaseCosts, __BaseQuantity) { this.PredefinedType = __PredefinedType; }
/// <summary> /// Adds a new IfcPhysicalQuantity to the IfcElementQuantity called propertySetName /// </summary> /// <param name="elem"></param> /// <param name="propertySetName">Name of the IfcElementQuantity property set</param> /// <param name="quantity">quantity to be added</param> static public IfcElementQuantity AddQuantity(this IfcObject elem, string propertySetName, IfcPhysicalQuantity quantity) { return(AddQuantity(elem, propertySetName, quantity, null)); }
/// <summary> /// Adds a new IfcPhysicalQuantity to the IfcElementQuantity called propertySetName /// </summary> /// <param name="elem"></param> /// <param name="propertySetName">Name of the IfcElementQuantity property set</param> /// <param name="quantity">quantity to be added</param> /// <param name="methodOfMeasurement">Sets the method of measurement, if not null overrides previous value</param> public static IfcElementQuantity AddQuantity(this IfcObject elem, string propertySetName, IfcPhysicalQuantity quantity, string methodOfMeasurement) { IfcElementQuantity pset = elem.GetElementQuantity(propertySetName); if (pset == null) { IModel model = elem.ModelOf; pset = model.Instances.New <IfcElementQuantity>(); pset.Name = propertySetName; IfcRelDefinesByProperties relDef = model.Instances.New <IfcRelDefinesByProperties>(); relDef.RelatingPropertyDefinition = pset; relDef.RelatedObjects.Add(elem); } pset.Quantities.Add(quantity); if (!string.IsNullOrEmpty(methodOfMeasurement)) { pset.MethodOfMeasurement = methodOfMeasurement; } return(pset); }
protected IfcConstructionResourceType(IfcGloballyUniqueId __GlobalId, IfcOwnerHistory __OwnerHistory, IfcLabel?__Name, IfcText?__Description, IfcIdentifier?__ApplicableOccurrence, IfcPropertySetDefinition[] __HasPropertySets, IfcIdentifier?__Identification, IfcText?__LongDescription, IfcLabel?__ResourceType, IfcAppliedValue[] __BaseCosts, IfcPhysicalQuantity __BaseQuantity) : base(__GlobalId, __OwnerHistory, __Name, __Description, __ApplicableOccurrence, __HasPropertySets, __Identification, __LongDescription, __ResourceType) { this.BaseCosts = new List <IfcAppliedValue>(__BaseCosts); this.BaseQuantity = __BaseQuantity; }
/// <summary> /// Adds a new IfcPhysicalQuantity to the IfcElementQuantity called propertySetName /// </summary> /// <param name="propertySetName">Name of the IfcElementQuantity property set</param> /// <param name="quantity">quantity to be added</param> public IfcElementQuantity AddQuantity(string propertySetName, IfcPhysicalQuantity quantity) { return(AddQuantity(propertySetName, quantity, null)); }
private bool InternalRemove() { // throw new NotImplementedException("You must override Remove method."); if (this is Ifc4.Entity) { string sid = ((Ifc4.Entity) this).Id; List <Entity> removeEntities = new List <Entity>(); // ------------------------------------------------------------------------------ foreach (var ifcRelAggregates in this.Document.IfcXmlDocument.Items.OfType <IfcRelAggregates>()) { if (ifcRelAggregates.RelatedObjects != null && ifcRelAggregates.RelatedObjects.Items != null) { ifcRelAggregates.RelatedObjects.Items.RemoveAll(relatedObject => relatedObject.Ref == sid); if (!ifcRelAggregates.RelatedObjects.Items.Any()) // has no items { removeEntities.Add(ifcRelAggregates); } } } // ------------------------------------------------------------------------------ //< IfcRelAssociatesDocument GlobalId="0eDueiBMrB9AOMWod2KzTn"> // <RelatedObjects> // <IfcProject ref="i1" xsi:nil="true" /> // </RelatedObjects> // <RelatingDocument> // <IfcDocumentInformation ref="i3302" xsi:nil="true" /> // </RelatingDocument> //</IfcRelAssociatesDocument> // ------------------------------------------------------------------------------ foreach (var ifcRelAssociatesDocument in this.Document.IfcXmlDocument.Items.OfType <IfcRelAssociatesDocument>()) { if (ifcRelAssociatesDocument.RelatingDocument?.Item?.Ref == sid) { removeEntities.Add(ifcRelAssociatesDocument); } } foreach (var ifcExternalReferenceRelationship in this.Document.IfcXmlDocument.Items.OfType <IfcExternalReferenceRelationship>()) { if ( ifcExternalReferenceRelationship.RelatedResourceObjects?.Items != null && ifcExternalReferenceRelationship.RelatedResourceObjects.Items.Any(item => item.Ref == sid) ) { ifcExternalReferenceRelationship.RelatedResourceObjects.Items.RemoveAll(relatedResourceObject => relatedResourceObject.Ref == sid); if (!ifcExternalReferenceRelationship.RelatedResourceObjects.Items.Any()) // has no items { removeEntities.Add(ifcExternalReferenceRelationship); } } } // ------------------------------------------------------------------------------ if (this.Parent is System.Collections.IList) { var parent = (System.Collections.IList) this.Parent; if (parent != null) { parent.Remove(this); } } // ------------------------------------------------------------------------------ foreach (var ifcRelDefinesByProperties in this.Document.IfcXmlDocument.Items.OfType <IfcRelDefinesByProperties>()) { if (ifcRelDefinesByProperties.RelatedObjects == null || ifcRelDefinesByProperties.RelatedObjects.Ref != sid) { continue; } if (ifcRelDefinesByProperties.RelatingPropertyDefinition == null || ifcRelDefinesByProperties.RelatingPropertyDefinition.Item == null) { continue; } //1. [System.Xml.Serialization.XmlElementAttribute("IfcElementQuantity", typeof(IfcElementQuantity), IsNullable = true)] //2. [System.Xml.Serialization.XmlElementAttribute("IfcPropertySet", typeof(IfcPropertySet), IsNullable=true)] //[System.Xml.Serialization.XmlElementAttribute("IfcPropertySetDefinition", typeof(IfcPropertySetDefinition), IsNullable=true)] //[System.Xml.Serialization.XmlElementAttribute("IfcPropertySetDefinitionSet-wrapper", typeof(IfcPropertySetDefinitionSetwrapper), IsNullable=true)] // -------------------------------------------------------------------------------- // 1. if (ifcRelDefinesByProperties.RelatingPropertyDefinition.Item is IfcElementQuantity) { IfcElementQuantity ifcElementQuantity = (IfcElementQuantity)ifcRelDefinesByProperties.RelatingPropertyDefinition.Item; if (ifcElementQuantity.IsRef) { ifcElementQuantity = this.Document.IfcXmlDocument.Items.OfType <IfcElementQuantity>().FirstOrDefault(item => item.Id == ifcElementQuantity.Ref); } if (ifcElementQuantity.Quantities != null && ifcElementQuantity.Quantities.Items != null) { foreach (var quantityItem in ifcElementQuantity.Quantities.Items) { IfcPhysicalQuantity ifcPhysicalQuantity = quantityItem; if (ifcPhysicalQuantity.IsRef) { ifcPhysicalQuantity = this.Document.IfcXmlDocument.Items.OfType <IfcPhysicalQuantity>().FirstOrDefault(item => item.Id == ifcPhysicalQuantity.Ref); } removeEntities.Add(ifcPhysicalQuantity); } ifcElementQuantity.Quantities.Items.Clear(); removeEntities.Add(ifcElementQuantity); } } // -------------------------------------------------------------------------------- // 2. else if (ifcRelDefinesByProperties.RelatingPropertyDefinition.Item is IfcPropertySet) { IfcPropertySet ifcPropertySet = (IfcPropertySet)ifcRelDefinesByProperties.RelatingPropertyDefinition.Item; if (ifcPropertySet.IsRef) { ifcPropertySet = this.Document.IfcXmlDocument.Items.OfType <IfcPropertySet>().FirstOrDefault(item => item.Id == ifcPropertySet.Ref); } if (ifcPropertySet.HasProperties != null && ifcPropertySet.HasProperties.Items != null) { foreach (var ifcPropertyItem in ifcPropertySet.HasProperties.Items) { IfcProperty ifcProperty = ifcPropertyItem; if (ifcProperty.IsRef) { ifcProperty = this.Document.IfcXmlDocument.Items.OfType <IfcProperty>().FirstOrDefault(item => item.Id == ifcProperty.Ref); } removeEntities.Add(ifcProperty); } ifcPropertySet.HasProperties.Items.Clear(); } // ------------------------------------------------------------------------------ foreach (var ifcRelDefinesByTemplate in this.Document.IfcXmlDocument.Items.OfType <IfcRelDefinesByTemplate>()) { if (ifcRelDefinesByTemplate.RelatedPropertySets != null && ifcRelDefinesByTemplate.RelatedPropertySets.Items != null) { ifcRelDefinesByTemplate.RelatedPropertySets.Items.RemoveAll(relatedPropertySet => relatedPropertySet.Ref == ifcPropertySet.Id); if (!ifcRelDefinesByTemplate.RelatedPropertySets.Items.Any()) // has no items { removeEntities.Add(ifcRelDefinesByTemplate); } } } removeEntities.Add(ifcPropertySet); } else { } removeEntities.Add(ifcRelDefinesByProperties); } // ------------------------------------------------------------------------------ foreach (var ifcRelAssignsToGroup in this.Document.IfcXmlDocument.Items.OfType <IfcRelAssignsToGroup>()) { if (ifcRelAssignsToGroup.RelatedObjects != null && ifcRelAssignsToGroup.RelatedObjects.Items != null) { ifcRelAssignsToGroup.RelatedObjects.Items.RemoveAll(relatedObject => relatedObject.Ref == sid); if (!ifcRelAssignsToGroup.RelatedObjects.Items.Any()) // has no items { removeEntities.Add(ifcRelAssignsToGroup); } } } // ------------------------------------------------------------------------------ foreach (var ifcRelAssociatesClassification in this.Document.IfcXmlDocument.Items.OfType <IfcRelAssociatesClassification>()) { if (ifcRelAssociatesClassification.RelatedObjects != null && ifcRelAssociatesClassification.RelatedObjects.Items != null) { ifcRelAssociatesClassification.RelatedObjects.Items.RemoveAll(relatedObject => relatedObject.Ref == sid); if (!ifcRelAssociatesClassification.RelatedObjects.Items.Any()) // has no items { removeEntities.Add(ifcRelAssociatesClassification); } } } // ------------------------------------------------------------------------------ removeEntities.Add(((Ifc4.Entity) this)); this.Document.IfcXmlDocument.Items.RemoveAll(item => removeEntities.Contains(item)); // ------------------------------------------------------------------------------ } return(true); }
public static bool Add(this IfcPropertySetDefinition pSetDefinition, IfcPhysicalQuantity quantity) { var quantSet = pSetDefinition as IfcElementQuantity; if (quantSet != null) quantSet.Quantities.Add(quantity); return quantSet != null; }