Example #1
0
 public override string ToString()
 {
     return(IfcReal.AsPart21(_theValue));
     //string str = _theValue.ToString();
     //if (str.IndexOfAny(new[] {'.', 'E', 'e'}) == -1) str += ".";
     //return str;
 }
Example #2
0
 public IfcTemperatureGradientMeasure(string val)
 {
     _theValue = IfcReal.ToDouble(val);
 }
 public IfcIlluminanceMeasure(string val)
 {
     _theValue = IfcReal.ToDouble(val);
 }
 public IfcCurvatureMeasure(string val)
 {
     _theValue = IfcReal.ToDouble(val);
 }
 public IfcHeatFluxDensityMeasure(string val)
 {
     _theValue = IfcReal.ToDouble(val);
 }
 public IfcFrequencyMeasure(string val)
 {
     _theValue = IfcReal.ToDouble(val);
 }
Example #7
0
 public IfcAngularVelocityMeasure(string val)
 {
     _theValue = IfcReal.ToDouble(val);
 }
 public IfcPositivePlaneAngleMeasure(string val)
 {
     _theValue = IfcReal.ToDouble(val);
 }
 public IfcThermodynamicTemperatureMeasure(string val)
 {
     _theValue = IfcReal.ToDouble(val);
 }
Example #10
0
 public IfcSoundPressureMeasure(string val)
 {
     _theValue = IfcReal.ToDouble(val);
 }
 public IfcMoistureDiffusivityMeasure(string val)
 {
     _theValue = IfcReal.ToDouble(val);
 }
 public IfcThermalConductivityMeasure(string val)
 {
     _theValue = IfcReal.ToDouble(val);
 }
 public IfcParameterValue(string val)
 {
     _theValue = IfcReal.ToDouble(val);
 }
 public override void IfcParse(int propIndex, IPropertyValue value)
 {
     switch (propIndex)
     {
         case 0:
         case 1:
         case 2:
         case 3:
             base.IfcParse(propIndex, value);
             break;
         case 4:
             _Position = (IfcCartesianPoint)value.EntityVal;
             break;
         case 5:
             _Radius = value.RealVal;
             break;
         case 6:
             _ConstantAttenuation = value.RealVal;
             break;
         case 7:
             _DistanceAttenuation = value.RealVal;
             break;
         case 8:
             _QuadricAttenuation = value.RealVal;
             break;
         default:
             this.HandleUnexpectedAttribute(propIndex, value); break;
     }
 }
 public IfcModulusOfSubgradeReactionMeasure(string val)
 {
     _theValue = IfcReal.ToDouble(val);
 }
Example #16
0
        /// <summary>
        /// Add the properties to the row object
        /// </summary>
        /// <param name="row">COBieAttributeRow holding the data</param>
        private void AddAttribute(COBieAttributeRow row)
        {
            //need a sheet and a row to be able to attach property to an object
            if ((ValidateString(row.RowName)) && (ValidateString(row.SheetName)))
            {
                switch (row.SheetName.ToLower())
                {
                    case "facility":
                        //set list if first time
                        if (IfcBuildings == null) IfcBuildings = Model.Instances.OfType<IfcBuilding>();
                        if (!((CurrentObject is IfcBuilding) && (CurrentObject.Name == row.RowName)))
                            CurrentObject = IfcBuildings.Where(b => b.Name.ToString().ToLower() == row.RowName.ToLower()).FirstOrDefault();
                        break;
                    case "floor":
                        if (IfcBuildingStoreys == null) IfcBuildingStoreys = Model.Instances.OfType<IfcBuildingStorey>();
                        if (!((CurrentObject is IfcBuildingStorey) && (CurrentObject.Name == row.RowName)))
                            CurrentObject = IfcBuildingStoreys.Where(b => b.Name.ToString().ToLower() == row.RowName.ToLower()).FirstOrDefault();
                        break;
                    case "space":
                        if (IfcSpaces == null) IfcSpaces = Model.Instances.OfType<IfcSpace>();
                        if (!((CurrentObject is IfcSpace) && (CurrentObject.Name == row.RowName)))
                            CurrentObject = IfcSpaces.Where(b => b.Name.ToString().ToLower() == row.RowName.ToLower()).FirstOrDefault();
                        break;
                    case "type":
                        if (IfcTypeObjects == null) IfcTypeObjects = Model.Instances.OfType<IfcTypeObject>();
                        if (!((CurrentObject is IfcTypeObject) && (CurrentObject.Name == row.RowName)))
                            CurrentObject = IfcTypeObjects.Where(b => b.Name.ToString().ToLower() == row.RowName.ToLower()).FirstOrDefault();
                        break;
                    case "spare":
                        if (IfcConstructionProductResources == null) IfcConstructionProductResources = Model.Instances.OfType<IfcConstructionProductResource>();
                        if (!((CurrentObject is IfcConstructionProductResource) && (CurrentObject.Name == row.RowName)))
                            CurrentObject = IfcConstructionProductResources.Where(b => b.Name.ToString().ToLower() == row.RowName.ToLower()).FirstOrDefault();
                        break;
                    case "component":
                        if (IfcElements == null) IfcElements = Model.Instances.OfType<IfcElement>();
                        if (!((CurrentObject is IfcElement) && (CurrentObject.Name == row.RowName)))
                            CurrentObject = IfcElements.Where(b => b.Name.ToString().ToLower() == row.RowName.ToLower()).FirstOrDefault();
                        break;
                    case "zone":
                        if (IfcZones == null) IfcZones = Model.Instances.OfType<IfcZone>();
                        if (!((CurrentObject is IfcZone) && (CurrentObject.Name == row.RowName)))
                            CurrentObject = IfcZones.Where(b => b.Name.ToString().ToLower() == row.RowName.ToLower()).FirstOrDefault();
                        break;
                    default:
                        CurrentObject = null;
                        break;
                }
               
                if (CurrentObject != null)
                {
                    if (ValidateString(row.Name)) 
                    {
                        IfcPropertySet ifcPropertySet = CheckIfExistOnMerge(row.ExtObject, row.ExtIdentifier);

                        if (ifcPropertySet == null)
                        {
                            return;
                        }

                        //Set Description
                        string description = "";
                        if (ValidateString(row.Description))
                            description = row.Description;


                        if ((ValidateString(row.Value)) &&
                            row.Value.Contains(":") &&
                            row.Value.Contains("(") &&
                            row.Value.Contains(")") 
                            )//only if we have a IfcPropertyTableValue defined by COBieDataAttributeBuilder
                        {
                            AddPropertyTableValue(ifcPropertySet , row.Name, description, row.Value, row.AllowedValues, row.Unit);
                        }
                        else if ((ValidateString(row.AllowedValues)) &&
                                //row.Value.Contains(":") && can be single value
                                (row.AllowedValues.Contains(":") ||
                                row.AllowedValues.Contains(",")
                                )
                                )//have a IfcPropertyEnumeratedValue
                        {
                            IfcValue[] ifcValues = GetValueArray(row.Value);
                            IfcValue[] ifcValueEnums = GetValueArray(row.AllowedValues);
                            IfcUnit ifcUnit = GetIfcUnit(row.Unit);
                            AddPropertyEnumeratedValue(ifcPropertySet, row.Name, description, ifcValues, ifcValueEnums, ifcUnit);
                        }
                        else
                        {
                            IfcValue ifcValue;
                            double number;
                            if (double.TryParse(row.Value, out number))
                                ifcValue = new IfcReal((double)number);
                            else if (ValidateString(row.Value))
                                ifcValue = new IfcLabel(row.Value);
                            else
                                ifcValue = new IfcLabel("");
                            IfcUnit ifcUnit = GetIfcUnit(row.Unit);
                            AddPropertySingleValue(ifcPropertySet, row.Name, description, ifcValue, ifcUnit);
                        }

                        //Add Category****
                        if (ValidateString(row.Category))
                        {
                            SetCategory(ifcPropertySet, row.Category);
                        }

                        //****************Note need this as last call Add OwnerHistory*************
                        if (ifcPropertySet != null)
                        {
                            //Add Created By, Created On and ExtSystem to Owner History. 
                            SetUserHistory(ifcPropertySet, row.ExtSystem, row.CreatedBy, row.CreatedOn);
                        }
                        //****************Note need SetOwnerHistory above to be last call, as XBim changes to default on any property set or changed, cannot use edit context as property set used more than once per row******
                    }
                    else
                    {
 #if DEBUG
                        Console.WriteLine("Failed to create attribute. No name : {0} value {1}", row.Name, row.ExtObject);
#endif
                    }
                    
                }
                else
                {
#if DEBUG
                    Console.WriteLine("Failed to create attribute. No object found to add too {0} value {1}", row.Name, row.ExtObject);
#endif
                }
                
            }
            else
            {
#if DEBUG
                Console.WriteLine("Failed to create attribute. No sheet or row name {0} value {1}", row.Name, row.ExtObject);
#endif
            }
            
        }
 public IfcMagneticFluxMeasure(string val)
 {
     _theValue = IfcReal.ToDouble(val);
 }
 public IfcAmountOfSubstanceMeasure(string val)
 {
     _theValue = IfcReal.ToDouble(val);
 }
Example #19
0
 public IfcRadioActivityMeasure(string val)
 {
     _theValue = IfcReal.ToDouble(val);
 }
Example #20
0
 public IfcLuminousFluxMeasure(string val)
 {
     _theValue = IfcReal.ToDouble(val);
 }
 public IfcPositiveLengthMeasure(string val)
 {
     _theValue = IfcReal.ToDouble(val);
 }
 public IfcSpecificHeatCapacityMeasure(string val)
 {
     _theValue = IfcReal.ToDouble(val);
 }
 public IfcLinearStiffnessMeasure(string val)
 {
     _theValue = IfcReal.ToDouble(val);
 }
 public IfcInductanceMeasure(string val)
 {
     _theValue = IfcReal.ToDouble(val);
 }
Example #25
0
 public IfcLinearForceMeasure(string val)
 {
     _theValue = IfcReal.ToDouble(val);
 }
 public IfcSolidAngleMeasure(string val)
 {
     _theValue = IfcReal.ToDouble(val);
 }
Example #27
0
 public IfcElectricResistanceMeasure(string val)
 {
     _theValue = IfcReal.ToDouble(val);
 }
Example #28
0
 public IfcWarpingMomentMeasure(string val)
 {
     _theValue = IfcReal.ToDouble(val);
 }
Example #29
0
 public IfcRotationalStiffnessMeasure(string val)
 {
     _theValue = IfcReal.ToDouble(val);
 }
Example #30
0
 public IfcTorqueMeasure(string val)
 {
     _theValue = IfcReal.ToDouble(val);
 }
Example #31
0
 public IfcDoseEquivalentMeasure(string val)
 {
     _theValue = IfcReal.ToDouble(val);
 }
Example #32
0
 public IfcThermalResistanceMeasure(string val)
 {
     _theValue = IfcReal.ToDouble(val);
 }
Example #33
0
 /// <summary>
 /// set IfcValue to IfcText or IfcReal
 /// </summary>
 /// <param name="value"></param>
 /// <returns></returns>
 private IfcValue SetValue(string value)
 {
     IfcValue ifcValue;
     double test;
     if (double.TryParse(value, out test))
         ifcValue = new IfcReal(test);
     else
         ifcValue = new IfcText(value);
     return ifcValue;
 }