예제 #1
0
        public override void Parse(int propIndex, IPropertyValue value, int[] nestedIndex)
        {
            switch (propIndex)
            {
            case 0:
                _name = value.StringVal;
                return;

            case 1:
                _description = value.StringVal;
                return;

            case 2:
                _appliedValue = (IfcAppliedValueSelect)(value.EntityVal);
                return;

            case 3:
                _unitBasis = (IfcMeasureWithUnit)(value.EntityVal);
                return;

            case 4:
                _applicableDate = (IfcDateTimeSelect)(value.EntityVal);
                return;

            case 5:
                _fixedUntilDate = (IfcDateTimeSelect)(value.EntityVal);
                return;

            default:
                throw new XbimParserException(string.Format("Attribute index {0} is out of range for {1}", propIndex + 1, GetType().Name.ToUpper()));
            }
        }
        public override void Parse(int propIndex, IPropertyValue value, int[] nestedIndex)
        {
            switch (propIndex)
            {
            case 0:
            case 1:
            case 2:
            case 3:
            case 4:
            case 5:
                base.Parse(propIndex, value, nestedIndex);
                return;

            case 6:
                _relatingProcess = (IfcProcess)(value.EntityVal);
                return;

            case 7:
                _quantityInProcess = (IfcMeasureWithUnit)(value.EntityVal);
                return;

            default:
                throw new XbimParserException(string.Format("Attribute index {0} is out of range for {1}", propIndex + 1, GetType().Name.ToUpper()));
            }
        }
예제 #3
0
        public virtual void IfcParse(int propIndex, IPropertyValue value)
        {
            switch (propIndex)
            {
            case 0:
                _name = value.StringVal;
                break;

            case 1:
                _description = value.StringVal;
                break;

            case 2:
                _appliedValue = (IfcAppliedValueSelect)value.EntityVal;
                break;

            case 3:
                _unitBasis = (IfcMeasureWithUnit)value.EntityVal;
                break;

            case 4:
                _applicableDate = (IfcDateTimeSelect)value.EntityVal;
                break;

            case 5:
                _fixedUntilDate = (IfcDateTimeSelect)value.EntityVal;
                break;

            default:
                this.HandleUnexpectedAttribute(propIndex, value); break;
            }
        }
예제 #4
0
        public override void IfcParse(int propIndex, IPropertyValue value)
        {
            switch (propIndex)
            {
            case 0:
            case 1:
            case 2:
            case 3:
            case 4:
                base.IfcParse(propIndex, value);
                break;

            case 5:
                _resourceIdentifier = value.StringVal;
                break;

            case 6:
                _resourceGroup = value.StringVal;
                break;

            case 7:
                _resourceConsumption =
                    (IfcResourceConsumptionEnum)Enum.Parse(typeof(IfcResourceConsumptionEnum), value.EnumVal);
                break;

            case 8:
                _baseQuantity = (IfcMeasureWithUnit)value.EntityVal;
                break;

            default:
                this.HandleUnexpectedAttribute(propIndex, value); break;
            }
        }
        public override void IfcParse(int propIndex, IPropertyValue value)
        {
            switch (propIndex)
            {
            case 0:
            case 1:
            case 2:
            case 3:
            case 4:
            case 5:
                base.IfcParse(propIndex, value);
                break;

            case 6:
                _relatingProcess = (IfcProcess)value.EntityVal;
                break;

            case 7:
                _quantityInProcess = (IfcMeasureWithUnit)value.EntityVal;
                break;

            default:
                this.HandleUnexpectedAttribute(propIndex, value); break;
            }
        }
        public static IIfcPhysicalSimpleQuantity ToPhysicalSimpleQuantity(this IfcMeasureWithUnit measure)
        {
            var value = measure.ValueComponent;

            //IfcQuantityArea, IfcQuantityCount, IfcQuantityLength, IfcQuantityTime, IfcQuantityVolume, IfcQuantityWeight
            if (value is IfcAreaMeasure)
            {
                return(new IfcQuantityAreaTransient(measure));
            }
            if (value is IfcCountMeasure)
            {
                return(new IfcQuantityCountTransient(measure));
            }
            if (value is IfcLengthMeasure)
            {
                return(new IfcQuantityLengthTransient(measure));
            }
            if (value is IfcTimeMeasure)
            {
                return(new IfcQuantityTimeTransient(measure));
            }
            if (value is IfcVolumeMeasure)
            {
                return(new IfcQuantityVolumeTransient(measure));
            }
            if (value is IfcMassMeasure)
            {
                return(new IfcQuantityWeightTransient(measure));
            }
            return(null);
        }
        public override void Parse(int propIndex, IPropertyValue value, int[] nestedIndex)
        {
            switch (propIndex)
            {
            case 0:
            case 1:
            case 2:
            case 3:
            case 4:
                base.Parse(propIndex, value, nestedIndex);
                return;

            case 5:
                _resourceIdentifier = value.StringVal;
                return;

            case 6:
                _resourceGroup = value.StringVal;
                return;

            case 7:
                _resourceConsumption = (IfcResourceConsumptionEnum)System.Enum.Parse(typeof(IfcResourceConsumptionEnum), value.EnumVal, true);
                return;

            case 8:
                _baseQuantity = (IfcMeasureWithUnit)(value.EntityVal);
                return;

            default:
                throw new XbimParserException(string.Format("Attribute index {0} is out of range for {1}", propIndex + 1, GetType().Name.ToUpper()));
            }
        }
예제 #8
0
 public IfcConstructionResource(IfcGloballyUniqueId __GlobalId, IfcOwnerHistory __OwnerHistory, IfcLabel?__Name, IfcText?__Description, IfcLabel?__ObjectType, IfcIdentifier?__ResourceIdentifier, IfcLabel?__ResourceGroup, IfcResourceConsumptionEnum?__ResourceConsumption, IfcMeasureWithUnit __BaseQuantity)
     : base(__GlobalId, __OwnerHistory, __Name, __Description, __ObjectType)
 {
     this._ResourceIdentifier  = __ResourceIdentifier;
     this._ResourceGroup       = __ResourceGroup;
     this._ResourceConsumption = __ResourceConsumption;
     this._BaseQuantity        = __BaseQuantity;
 }
예제 #9
0
 public IfcAppliedValue(IfcLabel?__Name, IfcText?__Description, IfcAppliedValueSelect __AppliedValue, IfcMeasureWithUnit __UnitBasis, IfcDateTimeSelect __ApplicableDate, IfcDateTimeSelect __FixedUntilDate)
 {
     this._Name           = __Name;
     this._Description    = __Description;
     this._AppliedValue   = __AppliedValue;
     this._UnitBasis      = __UnitBasis;
     this._ApplicableDate = __ApplicableDate;
     this._FixedUntilDate = __FixedUntilDate;
 }
예제 #10
0
 public IfcAppliedValue(IfcLabel?__Name, IfcText?__Description, IfcAppliedValueSelect __AppliedValue, IfcMeasureWithUnit __UnitBasis, IfcDate?__ApplicableDate, IfcDate?__FixedUntilDate, IfcLabel?__Category, IfcLabel?__Condition, IfcArithmeticOperatorEnum?__ArithmeticOperator, IfcAppliedValue[] __Components)
 {
     this._Name               = __Name;
     this._Description        = __Description;
     this._AppliedValue       = __AppliedValue;
     this._UnitBasis          = __UnitBasis;
     this._ApplicableDate     = __ApplicableDate;
     this._FixedUntilDate     = __FixedUntilDate;
     this._Category           = __Category;
     this._Condition          = __Condition;
     this._ArithmeticOperator = __ArithmeticOperator;
     this._Components         = new List <IfcAppliedValue>(__Components);
 }
        private static string GetMeasureWithUnitAsString(IfcMeasureWithUnit ifcMeasureWithUnit)
        {
            string  value   = string.Format("{0,0:N2}", ifcMeasureWithUnit.ValueComponent.Value);
            IfcUnit ifcUnit = ifcMeasureWithUnit.UnitComponent;
            string  unit    = ifcUnit.GetSymbol();

            if (!string.IsNullOrEmpty(unit))
            {
                value += unit;
            }

            return(value);
        }
예제 #12
0
        public override void Parse(int propIndex, IPropertyValue value, int[] nestedIndex)
        {
            switch (propIndex)
            {
            case 0:
                _name = value.StringVal;
                return;

            case 1:
                _description = value.StringVal;
                return;

            case 2:
                _appliedValue = (IfcAppliedValueSelect)(value.EntityVal);
                return;

            case 3:
                _unitBasis = (IfcMeasureWithUnit)(value.EntityVal);
                return;

            case 4:
                _applicableDate = value.StringVal;
                return;

            case 5:
                _fixedUntilDate = value.StringVal;
                return;

            case 6:
                _category = value.StringVal;
                return;

            case 7:
                _condition = value.StringVal;
                return;

            case 8:
                _arithmeticOperator = (IfcArithmeticOperatorEnum)System.Enum.Parse(typeof(IfcArithmeticOperatorEnum), value.EnumVal, true);
                return;

            case 9:
                _components.InternalAdd((IfcAppliedValue)value.EntityVal);
                return;

            default:
                throw new XbimParserException(string.Format("Attribute index {0} is out of range for {1}", propIndex + 1, GetType().Name.ToUpper()));
            }
        }
예제 #13
0
        /// <summary>
        /// Set the Year Duration Unit
        /// </summary>
        private void SetYearDurationUnit()
        {
            SetSecondUnit();

            IfcMeasureWithUnit yearMeasure = Model.Instances.New <IfcMeasureWithUnit>(mwu =>
            {
                mwu.ValueComponent = new IfcReal(3.1536E7);
                mwu.UnitComponent  = _secondUnit;
            });
            IfcConversionBasedUnit yearConBaseUnit = Model.Instances.New <IfcConversionBasedUnit>(s =>
            {
                s.UnitType         = IfcUnitEnum.TIMEUNIT;
                s.Name             = "Year";
                s.Dimensions       = _dimensionalExponents;
                s.ConversionFactor = yearMeasure;
            });

            //set context units
            _ifcConversionBasedUnitYear = yearConBaseUnit;
        }
예제 #14
0
        /// <summary>
        /// Set the week duration unit
        /// </summary>
        private void SetMinuteDurationUnit()
        {
            SetSecondUnit();

            IfcMeasureWithUnit minuteMeasure = Model.Instances.New <IfcMeasureWithUnit>(mwu =>
            {
                mwu.ValueComponent = new IfcReal(60); //not accurate week but take average
                mwu.UnitComponent  = _secondUnit;
            });
            IfcConversionBasedUnit minuteConBaseUnit = Model.Instances.New <IfcConversionBasedUnit>(s =>
            {
                s.UnitType         = IfcUnitEnum.TIMEUNIT;
                s.Name             = "Minute";
                s.Dimensions       = _dimensionalExponents;
                s.ConversionFactor = minuteMeasure;
            });

            //set context units
            _ifcConversionBasedUnitMinute = minuteConBaseUnit;
        }
예제 #15
0
        public static double GetPower(this IfcUnitAssignment ua, IfcUnitEnum unitType)
        {
            IfcSIUnit si = ua.Units.OfType <IfcSIUnit>().FirstOrDefault(u => u.UnitType == unitType);

            if (si != null && si.Prefix.HasValue)
            {
                return(si.Power());
            }
            else
            {
                IfcConversionBasedUnit cu =
                    ua.Units.OfType <IfcConversionBasedUnit>().FirstOrDefault(u => u.UnitType == unitType);
                if (cu != null)
                {
                    IfcMeasureWithUnit mu = cu.ConversionFactor;
                    IfcSIUnit          uc = mu.UnitComponent as IfcSIUnit;
                    //some BIM tools such as StruCAD write the conversion value out as a Length Measure
                    if (uc != null)
                    {
                        ExpressType et      = ((ExpressType)mu.ValueComponent);
                        double      cFactor = 1.0;
                        if (et.UnderlyingSystemType == typeof(double))
                        {
                            cFactor = (double)et.Value;
                        }
                        else if (et.UnderlyingSystemType == typeof(int))
                        {
                            cFactor = (double)((int)et.Value);
                        }
                        else if (et.UnderlyingSystemType == typeof(long))
                        {
                            cFactor = (double)((long)et.Value);
                        }

                        return(uc.Power() * cFactor);
                    }
                }
            }
            return(1.0);
        }
예제 #16
0
 public IfcRelAssignsToProcess(IfcGloballyUniqueId __GlobalId, IfcOwnerHistory __OwnerHistory, IfcLabel?__Name, IfcText?__Description, IfcObjectDefinition[] __RelatedObjects, IfcObjectTypeEnum?__RelatedObjectsType, IfcProcess __RelatingProcess, IfcMeasureWithUnit __QuantityInProcess)
     : base(__GlobalId, __OwnerHistory, __Name, __Description, __RelatedObjects, __RelatedObjectsType)
 {
     this._RelatingProcess   = __RelatingProcess;
     this._QuantityInProcess = __QuantityInProcess;
 }
예제 #17
0
 public IfcAppliedValue(IfcLabel?__Name, IfcText?__Description, IfcAppliedValueSelect __AppliedValue, IfcMeasureWithUnit __UnitBasis, IfcDate?__ApplicableDate, IfcDate?__FixedUntilDate, IfcLabel?__Category, IfcLabel?__Condition, IfcArithmeticOperatorEnum?__ArithmeticOperator, IfcAppliedValue[] __Components)
 {
     this.Name                 = __Name;
     this.Description          = __Description;
     this.AppliedValue         = __AppliedValue;
     this.UnitBasis            = __UnitBasis;
     this.ApplicableDate       = __ApplicableDate;
     this.FixedUntilDate       = __FixedUntilDate;
     this.Category             = __Category;
     this.Condition            = __Condition;
     this.ArithmeticOperator   = __ArithmeticOperator;
     this.Components           = new List <IfcAppliedValue>(__Components);
     this.HasExternalReference = new HashSet <IfcExternalReferenceRelationship>();
 }
예제 #18
0
		public IfcEnvironmentalImpactValue(IfcLabel? __Name, IfcText? __Description, IfcAppliedValueSelect __AppliedValue, IfcMeasureWithUnit __UnitBasis, IfcDateTimeSelect __ApplicableDate, IfcDateTimeSelect __FixedUntilDate, IfcLabel __ImpactType, IfcEnvironmentalImpactCategoryEnum __Category, IfcLabel? __UserDefinedCategory)
			: base(__Name, __Description, __AppliedValue, __UnitBasis, __ApplicableDate, __FixedUntilDate)
		{
			this._ImpactType = __ImpactType;
			this._Category = __Category;
			this._UserDefinedCategory = __UserDefinedCategory;
		}
예제 #19
0
 public IfcSubContractResource(IfcGloballyUniqueId __GlobalId, IfcOwnerHistory __OwnerHistory, IfcLabel?__Name, IfcText?__Description, IfcLabel?__ObjectType, IfcIdentifier?__ResourceIdentifier, IfcLabel?__ResourceGroup, IfcResourceConsumptionEnum?__ResourceConsumption, IfcMeasureWithUnit __BaseQuantity, IfcActorSelect __SubContractor, IfcText?__JobDescription)
     : base(__GlobalId, __OwnerHistory, __Name, __Description, __ObjectType, __ResourceIdentifier, __ResourceGroup, __ResourceConsumption, __BaseQuantity)
 {
     this._SubContractor  = __SubContractor;
     this._JobDescription = __JobDescription;
 }
예제 #20
0
 public IfcCostValue(IfcLabel?__Name, IfcText?__Description, IfcAppliedValueSelect __AppliedValue, IfcMeasureWithUnit __UnitBasis, IfcDate?__ApplicableDate, IfcDate?__FixedUntilDate, IfcLabel?__Category, IfcLabel?__Condition, IfcArithmeticOperatorEnum?__ArithmeticOperator, IfcAppliedValue[] __Components)
     : base(__Name, __Description, __AppliedValue, __UnitBasis, __ApplicableDate, __FixedUntilDate, __Category, __Condition, __ArithmeticOperator, __Components)
 {
 }
예제 #21
0
 public IfcCrewResource(IfcGloballyUniqueId __GlobalId, IfcOwnerHistory __OwnerHistory, IfcLabel?__Name, IfcText?__Description, IfcLabel?__ObjectType, IfcIdentifier?__ResourceIdentifier, IfcLabel?__ResourceGroup, IfcResourceConsumptionEnum?__ResourceConsumption, IfcMeasureWithUnit __BaseQuantity)
     : base(__GlobalId, __OwnerHistory, __Name, __Description, __ObjectType, __ResourceIdentifier, __ResourceGroup, __ResourceConsumption, __BaseQuantity)
 {
 }
예제 #22
0
        public Model(IDictionary <Guid, BaseIfc> storage, string name, string description, IfcAddress address, IfcPerson user, IfcOrganization owner)
        {
            this.storage = storage;

            this.storage.Add(address.Id, address);
            this.storage.Add(user.Id, user);
            this.storage.Add(owner.Id, owner);

            // Create an organization for app creation.
            var appOrg = new IfcOrganization(APPNAME);

            this.storage.Add(appOrg.Id, appOrg);

            // Create an authoring application.
            var v   = owner.GetType().Assembly.GetName().Version.ToString();
            var app = new IfcApplication(appOrg, v, APPNAME, APPNAME);

            this.storage.Add(app.Id, app);

            // Create an person and history for the owner history.
            var personAndOrg = new IfcPersonAndOrganization(user, owner);

            this.storage.Add(personAndOrg.Id, personAndOrg);

            // Create an owner history for the project.
            var history = new IfcOwnerHistory(personAndOrg, app, UnixNow());

            this.storage.Add(history.Id, history);

            var lu = new IfcSIUnit(null, IfcUnitEnum.LENGTHUNIT, IfcSIUnitName.METRE);

            this.storage.Add(lu.Id, lu);
            var lengthUnit = new IfcUnit(lu);

            var au = new IfcSIUnit(null, IfcUnitEnum.AREAUNIT, IfcSIUnitName.SQUARE_METRE);

            this.storage.Add(au.Id, au);
            var areaUnit = new IfcUnit(au);

            var vu = new IfcSIUnit(null, IfcUnitEnum.VOLUMEUNIT, IfcSIUnitName.CUBIC_METRE);

            this.storage.Add(vu.Id, vu);
            var volumeUnit = new IfcUnit(vu);

            var sau = new IfcSIUnit(null, IfcUnitEnum.SOLIDANGLEUNIT, IfcSIUnitName.STERADIAN);

            this.storage.Add(sau.Id, sau);
            var solidAngleUnit = new IfcUnit(sau);

            var mu = new IfcSIUnit(null, IfcUnitEnum.MASSUNIT, IfcSIUnitName.GRAM);

            this.storage.Add(mu.Id, mu);
            var massUnit = new IfcUnit(mu);

            var tu = new IfcSIUnit(null, IfcUnitEnum.TIMEUNIT, IfcSIUnitName.SECOND);

            this.storage.Add(tu.Id, tu);
            var timeUnit = new IfcUnit(tu);

            var thu = new IfcSIUnit(null, IfcUnitEnum.THERMODYNAMICTEMPERATUREUNIT, IfcSIUnitName.DEGREE_CELSIUS);

            this.storage.Add(thu.Id, thu);
            var thermUnit = new IfcUnit(thu);

            var lmu = new IfcSIUnit(null, IfcUnitEnum.LUMINOUSINTENSITYUNIT, IfcSIUnitName.LUMEN);

            this.storage.Add(lmu.Id, lmu);
            var lumUnit = new IfcUnit(lmu);

            var pau = new IfcSIUnit(null, IfcUnitEnum.PLANEANGLEUNIT, IfcSIUnitName.RADIAN);

            this.storage.Add(pau.Id, pau);
            var planeAngleUnit = new IfcUnit(pau);

            var measure = new IfcMeasureWithUnit(new IfcValue(new IfcMeasureValue(new IfcPlaneAngleMeasure(1.745e-2))), planeAngleUnit);

            this.storage.Add(measure.Id, measure);

            var dimExp = new IfcDimensionalExponents(0, 0, 0, 0, 0, 0, 0);

            this.storage.Add(dimExp.Id, dimExp);

            var du = new IfcConversionBasedUnit(dimExp, IfcUnitEnum.PLANEANGLEUNIT, "DEGREE", measure);

            this.storage.Add(du.Id, du);
            var degree = new IfcUnit(du);

            var units = new List <IfcUnit> {
                lengthUnit, areaUnit, volumeUnit, solidAngleUnit, massUnit, timeUnit, thermUnit, lumUnit, planeAngleUnit, degree
            };
            var unitAss = new IfcUnitAssignment(units);

            this.storage.Add(unitAss.Id, unitAss);

            // Create the project.
            var proj = new IfcProject(IfcGuid.ToIfcGuid(Guid.NewGuid()), history, name, description, null, null, null, null, unitAss);

            this.storage.Add(proj.Id, proj);
        }
예제 #23
0
 public IfcCostValue(IfcLabel?__Name, IfcText?__Description, IfcAppliedValueSelect __AppliedValue, IfcMeasureWithUnit __UnitBasis, IfcDateTimeSelect __ApplicableDate, IfcDateTimeSelect __FixedUntilDate, IfcLabel __CostType, IfcText?__Condition)
     : base(__Name, __Description, __AppliedValue, __UnitBasis, __ApplicableDate, __FixedUntilDate)
 {
     this._CostType  = __CostType;
     this._Condition = __Condition;
 }
예제 #24
0
 public IfcConstructionMaterialResource(IfcGloballyUniqueId __GlobalId, IfcOwnerHistory __OwnerHistory, IfcLabel?__Name, IfcText?__Description, IfcLabel?__ObjectType, IfcIdentifier?__ResourceIdentifier, IfcLabel?__ResourceGroup, IfcResourceConsumptionEnum?__ResourceConsumption, IfcMeasureWithUnit __BaseQuantity, IfcActorSelect[] __Suppliers, IfcRatioMeasure?__UsageRatio)
     : base(__GlobalId, __OwnerHistory, __Name, __Description, __ObjectType, __ResourceIdentifier, __ResourceGroup, __ResourceConsumption, __BaseQuantity)
 {
     this._Suppliers  = new HashSet <IfcActorSelect>(__Suppliers);
     this._UsageRatio = __UsageRatio;
 }