Exemple #1
0
        /// <summary>
        /// Calculates span value for a beam.
        /// </summary>
        /// <param name="exporterIFC">
        /// The ExporterIFC object.
        /// </param>
        /// <param name="extrusionCreationData">
        /// The IFCExtrusionCreationData.
        /// </param>
        /// <param name="element">
        /// The element to calculate the value.
        /// </param>
        /// <param name="elementType">
        /// The element type.
        /// </param>
        /// <returns>
        /// True if the operation succeed, false otherwise.
        /// </returns>
        public override bool Calculate(ExporterIFC exporterIFC, IFCExtrusionCreationData extrusionCreationData, Element element, ElementType elementType, EntryMap entryMap)
        {
            // Check the override first from "IfcSpan" parameter, if not overriden use the geometry data from extrusion
            double spanVal;

            if (ParameterUtil.GetDoubleValueFromElementOrSymbol(element, entryMap.RevitParameterName, out spanVal) == null)
            {
                if (ParameterUtil.GetDoubleValueFromElementOrSymbol(element, entryMap.CompatibleRevitParameterName, out spanVal) == null)
                {
                    return(false);
                }
            }

            spanVal = UnitUtil.ScaleLength(spanVal);
            if (spanVal > MathUtil.Eps())
            {
                m_Span = spanVal;
                return(true);
            }

            if (extrusionCreationData == null || MathUtil.IsAlmostZero(extrusionCreationData.ScaledLength))
            {
                return(false);
            }
            m_Span = extrusionCreationData.ScaledLength;

            // No support, do nothing. Leave the Span to be the length of the entire beam
            return(true);
        }
 /// <summary>
 /// Calculates cross area.
 /// </summary>
 /// <param name="exporterIFC">
 /// The ExporterIFC object.
 /// </param>
 /// <param name="extrusionCreationData">
 /// The IFCExtrusionCreationData.
 /// </param>
 /// <param name="element">
 /// The element to calculate the value.
 /// </param>
 /// <param name="elementType">
 /// The element type.
 /// </param>
 /// <returns>
 /// True if the operation succeed, false otherwise.
 /// </returns>
 public override bool Calculate(ExporterIFC exporterIFC, IFCExtrusionCreationData extrusionCreationData, Element element, ElementType elementType)
 {
     if (extrusionCreationData == null)
     {
         double crossSectionArea = 0;
         ParameterUtil.GetDoubleValueFromElement(element, BuiltInParameter.HOST_AREA_COMPUTED, out crossSectionArea);
         m_Area = UnitUtil.ScaleArea(crossSectionArea);
         if (m_Area < MathUtil.Eps() * MathUtil.Eps() || m_Area < MathUtil.Eps())
         {
             ParameterUtil.GetDoubleValueFromElementOrSymbol(element, "IfcQtyCrossSectionArea", out crossSectionArea);
             m_Area = UnitUtil.ScaleArea(crossSectionArea);
             if (m_Area < MathUtil.Eps() * MathUtil.Eps() || m_Area < MathUtil.Eps())
             {
                 return(false);
             }
             else
             {
                 return(true);
             }
         }
     }
     else
     {
         m_Area = extrusionCreationData.ScaledArea;
     }
     return(m_Area > MathUtil.Eps() * MathUtil.Eps());
 }
Exemple #3
0
        /// <summary>
        /// Calculates gross cross area.
        /// </summary>
        /// <param name="exporterIFC">
        /// The ExporterIFC object.
        /// </param>
        /// <param name="extrusionCreationData">
        /// The IFCExtrusionCreationData.
        /// </param>
        /// <param name="element">
        /// The element to calculate the value.
        /// </param>
        /// <param name="elementType">
        /// The element type.
        /// </param>
        /// <returns>
        /// True if the operation succeed, false otherwise.
        /// </returns>
        public override bool Calculate(ExporterIFC exporterIFC, IFCExtrusionCreationData extrusionCreationData, Element element, ElementType elementType, EntryMap entryMap)
        {
            double crossSectionArea = 0;

            // 1. Check override parameter
            if (ParameterUtil.GetDoubleValueFromElementOrSymbol(element, entryMap.RevitParameterName, out crossSectionArea) == null)
            {
                if (ParameterUtil.GetDoubleValueFromElementOrSymbol(element, entryMap.CompatibleRevitParameterName, out crossSectionArea) == null)
                {
                    ParameterUtil.GetDoubleValueFromElementOrSymbol(element, "IfcQtyGrossCrossSectionArea", out crossSectionArea);
                }
            }
            m_Area = UnitUtil.ScaleArea(crossSectionArea);
            if (m_Area > MathUtil.Eps() * MathUtil.Eps())
            {
                return(true);
            }

            // 2. try using extrusion data
            if (extrusionCreationData == null)
            {
                return(false);
            }

            m_Area = extrusionCreationData.ScaledArea;
            return(m_Area > MathUtil.Eps() * MathUtil.Eps());
        }
        /// <summary>
        /// Calculates gross volume.
        /// </summary>
        /// <param name="exporterIFC">
        /// The ExporterIFC object.
        /// </param>
        /// <param name="extrusionCreationData">
        /// The IFCExtrusionCreationData.
        /// </param>
        /// <param name="element">
        /// The element to calculate the value.
        /// </param>
        /// <param name="elementType">
        /// The element type.
        /// </param>
        /// <returns>
        /// True if the operation succeed, false otherwise.
        /// </returns>
        public override bool Calculate(ExporterIFC exporterIFC, IFCExtrusionCreationData extrusionCreationData, Element element, ElementType elementType)
        {
            if (ParameterUtil.GetDoubleValueFromElementOrSymbol(element, "IfcQtyGrossVolume", out m_Volume) == null)
            {
                if (ParameterUtil.GetDoubleValueFromElementOrSymbol(element, "IfcGrossVolume", out m_Volume) == null)
                {
                    ParameterUtil.GetDoubleValueFromElementOrSymbol(element, "GrossVolume", out m_Volume);
                }
            }
            m_Volume = UnitUtil.ScaleVolume(m_Volume);
            if (m_Volume > MathUtil.Eps() * MathUtil.Eps() * MathUtil.Eps())
            {
                return(true);
            }

            if (extrusionCreationData == null)
            {
                return(false);
            }

            double area   = extrusionCreationData.ScaledArea;
            double length = extrusionCreationData.ScaledLength;

            m_Volume = area * length;
            if (m_Volume > MathUtil.Eps() * MathUtil.Eps() * MathUtil.Eps())
            {
                return(true);
            }

            return(false);
        }
        /// <summary>
        /// Calculates gross volume for a slab.
        /// </summary>
        /// <param name="exporterIFC">The ExporterIFC object.</param>
        /// <param name="extrusionCreationData">The IFCExtrusionCreationData.</param>
        /// <param name="element">The element to calculate the value.</param>
        /// <param name="elementType">The element type.</param>
        /// <returns>True if the operation succeed, false otherwise.</returns>
        public override bool Calculate(ExporterIFC exporterIFC, IFCExtrusionCreationData extrusionCreationData, Element element, ElementType elementType, EntryMap entryMap)
        {
            double areaEps = MathUtil.Eps() * MathUtil.Eps();

            if ((ParameterUtil.GetDoubleValueFromElementOrSymbol(element, entryMap.RevitParameterName, out m_Area) != null) ||
                (ParameterUtil.GetDoubleValueFromElementOrSymbol(element, entryMap.CompatibleRevitParameterName, out m_Area) != null) ||
                (ParameterUtil.GetDoubleValueFromElementOrSymbol(element, "IfcQtyOuterSurfaceArea", out m_Area) != null))
            {
                m_Area = UnitUtil.ScaleArea(m_Area);
                if (m_Area > areaEps)
                {
                    return(true);
                }
            }

            if (extrusionCreationData == null)
            {
                return(false);
            }

            // It may be that the length component of the area unit is not the same
            // as the length unit itself (e.g. length in mm, area in m^2).  As such,
            // we unscale the length values and then re-scale them to the area unit.
            double outerPerimeter = UnitUtil.UnscaleLength(extrusionCreationData.ScaledOuterPerimeter);
            double length         = UnitUtil.UnscaleLength(extrusionCreationData.ScaledLength);

            m_Area = UnitUtil.ScaleArea(outerPerimeter * length);

            return(m_Area > areaEps);
        }
        /// <summary>
        /// Calculates cross area.
        /// </summary>
        /// <param name="exporterIFC">
        /// The ExporterIFC object.
        /// </param>
        /// <param name="extrusionCreationData">
        /// The IFCExtrusionCreationData.
        /// </param>
        /// <param name="element">
        /// The element to calculate the value.
        /// </param>
        /// <param name="elementType">
        /// The element type.
        /// </param>
        /// <returns>
        /// True if the operation succeed, false otherwise.
        /// </returns>
        public override bool Calculate(ExporterIFC exporterIFC, IFCExtrusionCreationData extrusionCreationData, Element element, ElementType elementType)
        {
            double crossSectionArea = 0;

            // 1. Use the builtin parameter first
            if (ParameterUtil.GetDoubleValueFromElement(element, BuiltInParameter.HOST_AREA_COMPUTED, out crossSectionArea) != null)
            {
                m_Area = UnitUtil.ScaleArea(crossSectionArea);
                if (m_Area > MathUtil.Eps() * MathUtil.Eps())
                {
                    return(true);
                }
            }

            // 2. Check override parameter
            if (ParameterUtil.GetDoubleValueFromElementOrSymbol(element, "IfcQtyCrossSectionArea", out crossSectionArea) == null)
            {
                ParameterUtil.GetDoubleValueFromElementOrSymbol(element, "CrossSectionArea", out crossSectionArea);
            }
            m_Area = UnitUtil.ScaleArea(crossSectionArea);
            if (m_Area > MathUtil.Eps() * MathUtil.Eps())
            {
                return(true);
            }

            // 3. try using extrusion data
            if (extrusionCreationData == null)
            {
                return(false);
            }

            m_Area = extrusionCreationData.ScaledArea;
            return(m_Area > MathUtil.Eps() * MathUtil.Eps());
        }
Exemple #7
0
        /// <summary>
        /// Calculates level area for a space.
        /// </summary>
        /// <param name="exporterIFC">
        /// The ExporterIFC object.
        /// </param>
        /// <param name="extrusionCreationData">
        /// The IFCExtrusionCreationData.
        /// </param>
        /// <param name="element">
        /// The element to calculate the value.
        /// </param>
        /// <param name="elementType">
        /// The element type.
        /// </param>
        /// <returns>
        /// True if the operation succeed, false otherwise.
        /// </returns>
        public override bool Calculate(ExporterIFC exporterIFC, IFCExtrusionCreationData extrusionCreationData, Element element, ElementType elementType)
        {
            if (ParameterUtil.GetDoubleValueFromElementOrSymbol(element, "IfcSpaceLevelArea", out m_Area) == null)
            {
                ParameterUtil.GetDoubleValueFromElementOrSymbol(element, "SpaceLevelArea", out m_Area);
            }
            m_Area = UnitUtil.ScaleArea(m_Area);
            if (m_Area > MathUtil.Eps() * MathUtil.Eps())
            {
                return(true);
            }

            if (extrusionCreationData == null || element == null)
            {
                return(false);
            }

            Area areaElement = element as Area;

            if (areaElement == null || !areaElement.IsGrossInterior)
            {
                return(false);
            }

            m_Area = extrusionCreationData.ScaledArea;

            return(m_Area > MathUtil.Eps() * MathUtil.Eps());
        }
        /// <summary>
        /// Calculates gross surface area.
        /// </summary>
        /// <param name="exporterIFC">
        /// The ExporterIFC object.
        /// </param>
        /// <param name="extrusionCreationData">
        /// The IFCExtrusionCreationData.
        /// </param>
        /// <param name="element">
        /// The element to calculate the value.
        /// </param>
        /// <param name="elementType">
        /// The element type.
        /// </param>
        /// <returns>
        /// True if the operation succeed, false otherwise.
        /// </returns>
        public override bool Calculate(ExporterIFC exporterIFC, IFCExtrusionCreationData extrusionCreationData, Element element, ElementType elementType)
        {
            if (extrusionCreationData == null)
            {
                return(false);
            }
            double extrudedArea = extrusionCreationData.ScaledArea;
            double length       = extrusionCreationData.ScaledLength;
            double perimeter    = extrusionCreationData.ScaledOuterPerimeter;

            m_Area = perimeter * length + 2 * extrudedArea;
            if (m_Area < MathUtil.Eps() * MathUtil.Eps())
            {
                ParameterUtil.GetDoubleValueFromElementOrSymbol(element, "IfcQtyGrossSurfaceArea", out m_Area);
                if (m_Area < MathUtil.Eps() * MathUtil.Eps())
                {
                    return(false);
                }
                else
                {
                    return(true);
                }
            }
            else
            {
                return(true);
            }
        }
        /// <summary>
        /// Calculates volume for a space.
        /// </summary>
        /// <param name="exporterIFC">
        /// The ExporterIFC object.
        /// </param>
        /// <param name="calcValues">
        /// The IFCExtrusionCreationData.
        /// </param>
        /// <param name="element">
        /// The element to calculate the value.
        /// </param>
        /// <param name="elementType">
        /// The element type.
        /// </param>
        /// <returns>
        /// True if the operation succeed, false otherwise.
        /// </returns>
        public override bool Calculate(ExporterIFC exporterIFC, IFCExtrusionCreationData extrusionCreationData, Element element, ElementType elementType)
        {
            if (ParameterUtil.GetDoubleValueFromElementOrSymbol(element, "IfcQtyVolume", out m_Volume) == null)
            {
                ParameterUtil.GetDoubleValueFromElementOrSymbol(element, "QtyVolume", out m_Volume);
            }
            m_Volume = UnitUtil.ScaleArea(m_Volume);
            if (m_Volume > MathUtil.Eps() * MathUtil.Eps() * MathUtil.Eps())
            {
                return(true);
            }

            if (extrusionCreationData == null)
            {
                return(false);
            }
            double area   = extrusionCreationData.ScaledArea;
            double height = extrusionCreationData.ScaledHeight;

            if (area < MathUtil.Eps() * MathUtil.Eps() || height < MathUtil.Eps())
            {
                return(false);
            }
            else
            {
                m_Volume = area * height;
                return(true);
            }
        }
Exemple #10
0
        /// <summary>
        /// Calculates the diameter of a provision for void.
        /// </summary>
        /// <param name="exporterIFC">The ExporterIFC object.</param>
        /// <param name="extrusionCreationData">The IFCExtrusionCreationData.</param>
        /// <param name="element">The element to calculate the value.</param>
        /// <param name="elementType">The element type.</param>
        /// <returns>
        /// True if the operation succeed, false otherwise.
        /// </returns>
        public override bool Calculate(ExporterIFC exporterIFC, IFCExtrusionCreationData extrusionCreationData, Element element, ElementType elementType)
        {
            if (ParameterUtil.GetDoubleValueFromElementOrSymbol(element, "IfcQtyDiameter", out m_Diameter) == null)
            {
                ParameterUtil.GetDoubleValueFromElementOrSymbol(element, "Diameter", out m_Diameter);
            }
            m_Diameter = UnitUtil.ScaleLength(m_Diameter);
            if (m_Diameter > MathUtil.Eps() * MathUtil.Eps())
            {
                return(true);
            }

            if (extrusionCreationData == null)
            {
                return(false);
            }

            // For ProvisionForVoid
            ShapeCalculator shapeCalculator = ShapeCalculator.Instance;

            if (shapeCalculator != null && shapeCalculator.GetCurrentElement() == element)
            {
                if (String.Compare(shapeCalculator.GetStringValue(), IFCProvisionForVoidShapeType.Round.ToString()) == 0)
                {
                    m_Diameter = extrusionCreationData.ScaledOuterPerimeter / Math.PI;
                    if (m_Diameter > MathUtil.Eps())
                    {
                        return(true);
                    }
                }
            }

            return(false);
        }
Exemple #11
0
        /// <summary>
        /// Calculates volume for a space.
        /// </summary>
        /// <param name="exporterIFC">The ExporterIFC object.</param>
        /// <param name="calcValues">The IFCExtrusionCreationData.</param>
        /// <param name="element">The element to calculate the value.</param>
        /// <param name="elementType">The element type.</param>
        /// <returns>True if the operation succeed, false otherwise.</returns>
        public override bool Calculate(ExporterIFC exporterIFC, IFCExtrusionCreationData extrusionCreationData, Element element, ElementType elementType)
        {
            double volumeEps = MathUtil.Eps() * MathUtil.Eps() * MathUtil.Eps();

            if ((ParameterUtil.GetDoubleValueFromElementOrSymbol(element, "IfcQtyVolume", out m_Volume) != null) ||
                (ParameterUtil.GetDoubleValueFromElementOrSymbol(element, "QtyVolume", out m_Volume) != null))
            {
                m_Volume = UnitUtil.ScaleArea(m_Volume);
                if (m_Volume > volumeEps)
                {
                    return(true);
                }
            }

            if (extrusionCreationData == null)
            {
                return(false);
            }

            double area   = UnitUtil.UnscaleArea(extrusionCreationData.ScaledArea);
            double height = UnitUtil.UnscaleLength(extrusionCreationData.ScaledHeight);

            m_Volume = UnitUtil.ScaleVolume(area * height);
            return(m_Volume > volumeEps);
        }
Exemple #12
0
        /// <summary>
        /// Calculates gross volume.
        /// </summary>
        /// <param name="exporterIFC">The ExporterIFC object.</param>
        /// <param name="extrusionCreationData">The IFCExtrusionCreationData.</param>
        /// <param name="element">The element to calculate the value.</param>
        /// <param name="elementType">The element type.</param>
        /// <returns>True if the operation succeeded, false otherwise.</returns>
        public override bool Calculate(ExporterIFC exporterIFC, IFCExtrusionCreationData extrusionCreationData, Element element, ElementType elementType, EntryMap entryMap)
        {
            if ((ParameterUtil.GetDoubleValueFromElementOrSymbol(element, entryMap.RevitParameterName, out m_Volume) != null) ||
                (ParameterUtil.GetDoubleValueFromElementOrSymbol(element, entryMap.CompatibleRevitParameterName, out m_Volume) != null) ||
                (ParameterUtil.GetDoubleValueFromElementOrSymbol(element, "IfcQtyGrossVolume", out m_Volume) != null))
            {
                m_Volume = UnitUtil.ScaleVolume(m_Volume);
                if (m_Volume > MathUtil.Eps() * MathUtil.Eps() * MathUtil.Eps())
                {
                    return(true);
                }
            }

            if (extrusionCreationData == null)
            {
                return(false);
            }

            // While it would be unlikely that area and volume have different base length units,
            // it is still safer to unscale and rescale the results.  For length, it is somewhat
            // common to have mm as the length unit and m^3 as the volume unit.
            double area   = UnitUtil.UnscaleArea(extrusionCreationData.ScaledArea);
            double length = UnitUtil.UnscaleLength(extrusionCreationData.ScaledLength);

            m_Volume = UnitUtil.ScaleVolume(area * length);
            return(m_Volume > MathUtil.Eps() * MathUtil.Eps() * MathUtil.Eps());
        }
        /// <summary>
        /// Calculates Roll value (Rotation angle) for a beam, column and member
        /// </summary>
        /// <param name="exporterIFC">
        /// The ExporterIFC object.
        /// </param>
        /// <param name="extrusionCreationData">
        /// The IFCExtrusionCreationData.
        /// </param>
        /// <param name="element">
        /// The element to calculate the value.
        /// </param>
        /// <param name="elementType">
        /// The element type.
        /// </param>
        /// <returns>
        /// True if the operation succeed, false otherwise.
        /// </returns>
        public override bool Calculate(ExporterIFC exporterIFC, IFCExtrusionCreationData extrusionCreationData, Element element, ElementType elementType)
        {
            Parameter rollPar = element.get_Parameter(BuiltInParameter.STRUCTURAL_BEND_DIR_ANGLE);

            if (rollPar != null)
            {
                double?roll = rollPar.AsDouble();
                if (roll != null && roll.HasValue)
                {
                    m_Roll = UnitUtil.ScaleAngle(roll.Value);
                    return(true);
                }
            }

            // For other elements with ExtrusionData. Parameter will take precedence (override)
            if (ParameterUtil.GetDoubleValueFromElementOrSymbol(element, "IfcRoll", out m_Roll) == null)
            {
                ParameterUtil.GetDoubleValueFromElementOrSymbol(element, "Roll", out m_Roll);
            }
            m_Roll = UnitUtil.ScaleAngle(m_Roll);
            if (m_Roll > MathUtil.Eps())
            {
                return(true);
            }

            return(false);
        }
        /// <summary>
        /// Calculates the depth of a provision for void.
        /// </summary>
        /// <param name="exporterIFC">The ExporterIFC object.</param>
        /// <param name="extrusionCreationData">The IFCExtrusionCreationData.</param>
        /// <param name="element">The element to calculate the value.</param>
        /// <param name="elementType">The element type.</param>
        /// <returns>
        /// True if the operation succeed, false otherwise.
        /// </returns>
        public override bool Calculate(ExporterIFC exporterIFC, IFCExtrusionCreationData extrusionCreationData, Element element, ElementType elementType, EntryMap entryMap)
        {
            if (ParameterUtil.GetDoubleValueFromElementOrSymbol(element, entryMap.RevitParameterName, out m_Depth) == null)
            {
                if (ParameterUtil.GetDoubleValueFromElementOrSymbol(element, entryMap.CompatibleRevitParameterName, out m_Depth) == null)
                {
                    ParameterUtil.GetDoubleValueFromElementOrSymbol(element, "IfcQtyDepth", out m_Depth);
                }
            }
            m_Depth = UnitUtil.ScaleLength(m_Depth);
            if (m_Depth > MathUtil.Eps() * MathUtil.Eps())
            {
                return(true);
            }

            if (extrusionCreationData == null)
            {
                return(false);
            }

            // For Slab, Depth is equal to the extrusion length (from ScaledLength)
            IFCAnyHandle hnd = ExporterCacheManager.ElementToHandleCache.Find(element.Id);

            if (IFCAnyHandleUtil.IsSubTypeOf(hnd, IFCEntityType.IfcSlab))
            {
                m_Depth = extrusionCreationData.ScaledLength;
            }
            else
            {
                m_Depth = extrusionCreationData.ScaledHeight;
            }

            return(m_Depth > MathUtil.Eps());
        }
        /// <summary>
        /// Calculates cross area.
        /// </summary>
        /// <param name="exporterIFC">
        /// The ExporterIFC object.
        /// </param>
        /// <param name="extrusionCreationData">
        /// The IFCExtrusionCreationData.
        /// </param>
        /// <param name="element">
        /// The element to calculate the value.
        /// </param>
        /// <param name="elementType">
        /// The element type.
        /// </param>
        /// <returns>
        /// True if the operation succeed, false otherwise.
        /// </returns>
        public override bool Calculate(ExporterIFC exporterIFC, IFCExtrusionCreationData extrusionCreationData, Element element, ElementType elementType)
        {
            if (ParameterUtil.GetDoubleValueFromElementOrSymbol(element, "IfcQtyGrossArea", out m_Area) == null)
            {
                if (ParameterUtil.GetDoubleValueFromElementOrSymbol(element, "IfcGrossArea", out m_Area) == null)
                {
                    ParameterUtil.GetDoubleValueFromElementOrSymbol(element, "GrossArea", out m_Area);
                }
            }
            m_Area = UnitUtil.ScaleArea(m_Area);
            if (m_Area > MathUtil.Eps() * MathUtil.Eps())
            {
                return(true);
            }

            if (extrusionCreationData == null)
            {
                return(false);
            }

            m_Area = extrusionCreationData.ScaledArea;

            if (m_Area > MathUtil.Eps() * MathUtil.Eps())
            {
                return(true);
            }

            return(false);
        }
        /// <summary>
        /// Calculates gross surface area.
        /// </summary>
        /// <param name="exporterIFC">
        /// The ExporterIFC object.
        /// </param>
        /// <param name="extrusionCreationData">
        /// The IFCExtrusionCreationData.
        /// </param>
        /// <param name="element">
        /// The element to calculate the value.
        /// </param>
        /// <param name="elementType">
        /// The element type.
        /// </param>
        /// <returns>
        /// True if the operation succeed, false otherwise.
        /// </returns>
        public override bool Calculate(ExporterIFC exporterIFC, IFCExtrusionCreationData extrusionCreationData, Element element, ElementType elementType, EntryMap entryMap)
        {
            if ((ParameterUtil.GetDoubleValueFromElementOrSymbol(element, entryMap.RevitParameterName, out m_Area) != null) ||
                (ParameterUtil.GetDoubleValueFromElementOrSymbol(element, entryMap.CompatibleRevitParameterName, out m_Area) != null) ||
                (ParameterUtil.GetDoubleValueFromElementOrSymbol(element, "IfcQtyGrossSurfaceArea", out m_Area) != null))
            {
                m_Area = UnitUtil.ScaleArea(m_Area);
                if (m_Area > MathUtil.Eps() * MathUtil.Eps())
                {
                    return(true);
                }
            }

            if (extrusionCreationData == null)
            {
                return(false);
            }

            double extrudedArea = extrusionCreationData.ScaledArea;

            // The base units for length and area may be different, especially in metric.
            // E.g., the length unit may be in mm, while the area unit may be m^2.
            // As such, we have to unscale the length units, and then rescale to the area units.
            double length    = UnitUtil.UnscaleLength(extrusionCreationData.ScaledLength);
            double perimeter = UnitUtil.UnscaleLength(extrusionCreationData.ScaledOuterPerimeter);

            if (length > MathUtil.Eps() && perimeter > MathUtil.Eps())
            {
                m_Area = UnitUtil.ScaleArea(perimeter * length) + 2 * extrudedArea;
                return(true);
            }

            return(false);
        }
        /// <summary>
        /// Calculates gross volume for a slab.
        /// </summary>
        /// <param name="exporterIFC">
        /// The ExporterIFC object.
        /// </param>
        /// <param name="extrusionCreationData">
        /// The IFCExtrusionCreationData.
        /// </param>
        /// <param name="element">
        /// The element to calculate the value.
        /// </param>
        /// <param name="elementType">
        /// The element type.
        /// </param>
        /// <returns>
        /// True if the operation succeed, false otherwise.
        /// </returns>
        public override bool Calculate(ExporterIFC exporterIFC, IFCExtrusionCreationData extrusionCreationData, Element element, ElementType elementType)
        {
            if (ParameterUtil.GetDoubleValueFromElementOrSymbol(element, "IfcQtyOuterSurfaceArea", out m_Area) == null)
            {
                ParameterUtil.GetDoubleValueFromElementOrSymbol(element, "OuterSurfaceArea", out m_Area);
            }
            m_Area = UnitUtil.ScaleArea(m_Area);
            if (m_Area > MathUtil.Eps() * MathUtil.Eps())
            {
                return(true);
            }

            if (extrusionCreationData != null)
            {
                double outerPerimeter = extrusionCreationData.ScaledOuterPerimeter;
                double length         = extrusionCreationData.ScaledLength;

                if (outerPerimeter > MathUtil.Eps() * MathUtil.Eps() && length > MathUtil.Eps())
                {
                    m_Area = outerPerimeter * length;
                    return(true);
                }
            }

            return(false);
        }
Exemple #18
0
        /// <summary>
        /// Calculates slope value.
        /// </summary>
        /// <param name="exporterIFC">The ExporterIFC object.</param>
        /// <param name="extrusionCreationData">The IFCExtrusionCreationData.</param>
        /// <param name="element">The element to calculate the value.</param>
        /// <param name="elementType">The element type.</param>
        /// <returns>True if the operation succeed, false otherwise.</returns>
        public override bool Calculate(ExporterIFC exporterIFC, IFCExtrusionCreationData extrusionCreationData, Element element, ElementType elementType)
        {
            // We may have an extrusionCreationData that doesn't have anything set.  We will check this by seeing if there is a valid length set.
            // This works for Beam
            if (extrusionCreationData == null || MathUtil.IsAlmostZero(extrusionCreationData.ScaledLength))
            {
                // Try looking for parameters that we can calculate slope from.
                double startParamHeight;
                if (ParameterUtil.GetDoubleValueFromElement(element, BuiltInParameter.STRUCTURAL_BEAM_END0_ELEVATION, out startParamHeight) == null)
                {
                    return(false);
                }
                double endParamHeight;
                if (ParameterUtil.GetDoubleValueFromElement(element, BuiltInParameter.STRUCTURAL_BEAM_END1_ELEVATION, out endParamHeight) == null)
                {
                    return(false);
                }
                double length;
                if (ParameterUtil.GetDoubleValueFromElement(element, BuiltInParameter.INSTANCE_LENGTH_PARAM, out length) == null)
                {
                    return(false);
                }
                m_Slope = UnitUtil.ScaleAngle(Math.Asin(Math.Abs(endParamHeight - startParamHeight) / length));
                return(true);
            }

            // This works for Ramp/RampFlight
            double slope = 0.0;

            if (ParameterUtil.GetDoubleValueFromElement(element, BuiltInParameter.RAMP_ATTR_MIN_INV_SLOPE, out slope) != null)
            {
                m_Slope = slope;

                if (!MathUtil.IsAlmostZero(m_Slope))
                {
                    m_Slope = UnitUtil.ScaleAngle(Math.Atan(m_Slope));
                    return(true);
                }
            }

            // For other elements with ExtrusionData. Parameter will take precedence (override)
            if (ParameterUtil.GetDoubleValueFromElementOrSymbol(element, "IfcSlope", out m_Slope) == null)
            {
                ParameterUtil.GetDoubleValueFromElementOrSymbol(element, "Slope", out m_Slope);
            }
            m_Slope = UnitUtil.ScaleAngle(m_Slope);
            if (m_Slope > MathUtil.Eps())
            {
                return(true);
            }

            if (extrusionCreationData != null)
            {
                m_Slope = extrusionCreationData.Slope;
                return(true);
            }

            return(false);
        }
Exemple #19
0
        /// <summary>
        /// Calculates cross area.
        /// </summary>
        /// <param name="exporterIFC">
        /// The ExporterIFC object.
        /// </param>
        /// <param name="extrusionCreationData">
        /// The IFCExtrusionCreationData.
        /// </param>
        /// <param name="element">
        /// The element to calculate the value.
        /// </param>
        /// <param name="elementType">
        /// The element type.
        /// </param>
        /// <returns>
        /// True if the operation succeed, false otherwise.
        /// </returns>
        public override bool Calculate(ExporterIFC exporterIFC, IFCExtrusionCreationData extrusionCreationData, Element element, ElementType elementType)
        {
            double lengthFromParam = 0;

            if (ParameterUtil.GetDoubleValueFromElementOrSymbol(element, "IfcQtyLength", out lengthFromParam) == null)
            {
                ParameterUtil.GetDoubleValueFromElementOrSymbol(element, "Length", out lengthFromParam);
            }
            m_Length = UnitUtil.ScaleLength(lengthFromParam);

            // Check for Stair Run - Do special computation for the length
            if (element is StairsRun)
            {
                StairsRun flight    = element as StairsRun;
                double    flightLen = flight.GetStairsPath().GetExactLength();
                flightLen = UnitUtil.ScaleLength(flightLen);
                if (flightLen > MathUtil.Eps())
                {
                    m_Length = flightLen;
                    return(true);
                }
                // consider override as specified in a parameter
                else if (m_Length > MathUtil.Eps())
                {
                    return(true);
                }
                // exit when none for StairsRun
                else
                {
                    return(false);
                }
            }

            // For others
            if (m_Length > MathUtil.Eps())
            {
                return(true);
            }

            if (extrusionCreationData == null)
            {
                if (ParameterUtil.GetDoubleValueFromElement(element, BuiltInParameter.EXTRUSION_LENGTH, out m_Length) != null)
                {
                    m_Length = UnitUtil.ScaleLength(m_Length);
                }
            }
            else
            {
                m_Length = extrusionCreationData.ScaledLength;
            }

            if (m_Length > MathUtil.Eps())
            {
                return(true);
            }

            return(false);
        }
        /// <summary>
        /// Calculates net surface area.
        /// </summary>
        /// <param name="exporterIFC">
        /// The ExporterIFC object.
        /// </param>
        /// <param name="extrusionCreationData">
        /// The IFCExtrusionCreationData.
        /// </param>
        /// <param name="element">
        /// The element to calculate the value.
        /// </param>
        /// <param name="elementType">
        /// The element type.
        /// </param>
        /// <returns>
        /// True if the operation succeed, false otherwise.
        /// </returns>
        public override bool Calculate(ExporterIFC exporterIFC, IFCExtrusionCreationData extrusionCreationData, Element element, ElementType elementType)
        {
            double areaSum = 0;
            SolidMeshGeometryInfo geomInfo = GeometryUtil.GetSolidMeshGeometry(element);

            if (geomInfo.SolidsCount() > 0)
            {
                for (int ii = 0; ii < geomInfo.SolidsCount(); ++ii)
                {
                    foreach (Face f in geomInfo.GetSolids()[ii].Faces)
                    {
                        areaSum += f.Area;
                    }
                }
            }

            if (geomInfo.MeshesCount() > 0)
            {
                for (int jj = 0; jj < geomInfo.MeshesCount(); ++jj)
                {
                    Mesh geomMesh      = geomInfo.GetMeshes()[jj];
                    XYZ  arbitraryOrig = geomMesh.Vertices[0];
                    for (int ii = 0; ii < geomMesh.NumTriangles; ++ii)
                    {
                        MeshTriangle meshTri = geomMesh.get_Triangle(ii);
                        double       a       = meshTri.get_Vertex(1).DistanceTo(meshTri.get_Vertex(0));
                        double       b       = meshTri.get_Vertex(2).DistanceTo(meshTri.get_Vertex(1));
                        double       c       = meshTri.get_Vertex(0).DistanceTo(meshTri.get_Vertex(2));
                        areaSum += (a + b + c) / 2.0;
                    }
                }
            }

            m_Area = UnitUtil.ScaleArea(areaSum);
            if (m_Area < MathUtil.Eps() * MathUtil.Eps() || m_Area < MathUtil.Eps())
            {
                if (ParameterUtil.GetDoubleValueFromElementOrSymbol(element, "IfcQtyNetSurfaceArea", out m_Area) == null)
                {
                    if (ParameterUtil.GetDoubleValueFromElementOrSymbol(element, "IfcNetSurfaceArea", out m_Area) == null)
                    {
                        ParameterUtil.GetDoubleValueFromElementOrSymbol(element, "NetSurfaceArea", out m_Area);
                    }
                }
                m_Area = UnitUtil.ScaleArea(m_Area);
                if (m_Area < MathUtil.Eps() * MathUtil.Eps() || m_Area < MathUtil.Eps())
                {
                    return(false);
                }
                else
                {
                    return(true);
                }
            }
            else
            {
                return(true);
            }
        }
Exemple #21
0
        /// <summary>
        /// Calculates height for a railing
        /// </summary>
        /// <param name="exporterIFC">
        /// The ExporterIFC object.
        /// </param>
        /// <param name="extrusionCreationData">
        /// The IFCExtrusionCreationData.
        /// </param>
        /// <param name="element">
        /// The element to calculate the value.
        /// </param>
        /// <param name="elementType">
        /// The element type.
        /// </param>
        /// <returns>
        /// True if the operation succeed, false otherwise.
        /// </returns>
        public override bool Calculate(ExporterIFC exporterIFC, IFCExtrusionCreationData extrusionCreationData, Element element, ElementType elementType, EntryMap entryMap)
        {
            if (element == null)
            {
                return(false);
            }

            // For Railing
            RailingType railingType = element.Document.GetElement(element.GetTypeId()) as RailingType;

            if (railingType != null)
            {
                m_Height = UnitUtil.ScaleLength(railingType.TopRailHeight);
                return(true);
            }

            // For ProvisionForVoid
            ShapeCalculator shapeCalculator = ShapeCalculator.Instance;

            if (shapeCalculator != null && shapeCalculator.GetCurrentElement() == element)
            {
                if (String.Compare(shapeCalculator.GetStringValue(), IFCProvisionForVoidShapeType.Rectangle.ToString()) == 0)
                {
                    IFCAnyHandle rectProfile = shapeCalculator.GetCurrentProfileHandle();
                    if (!IFCAnyHandleUtil.IsNullOrHasNoValue(rectProfile))
                    {
                        // This is already scaled.
                        double?height = IFCAnyHandleUtil.GetDoubleAttribute(rectProfile, "YDim");
                        m_Height = height.HasValue ? height.Value : 0.0;
                        if (m_Height > MathUtil.Eps())
                        {
                            return(true);
                        }
                    }
                }
            }

            if (ParameterUtil.GetDoubleValueFromElementOrSymbol(element, entryMap.RevitParameterName, out m_Height) == null)
            {
                ParameterUtil.GetDoubleValueFromElementOrSymbol(element, entryMap.CompatibleRevitParameterName, out m_Height);
            }

            m_Height = UnitUtil.ScaleLength(m_Height);
            if (m_Height > MathUtil.Eps())
            {
                return(true);
            }

            // For other elements
            if (extrusionCreationData == null)
            {
                return(false);
            }

            m_Height = extrusionCreationData.ScaledHeight;
            return(m_Height > MathUtil.Eps());
        }
        /// <summary>
        /// Calculates number of risers for a stair.
        /// </summary>
        /// <param name="exporterIFC">
        /// The ExporterIFC object.
        /// </param>
        /// <param name="extrusionCreationData">
        /// The IFCExtrusionCreationData.
        /// </param>
        /// <param name="element">
        /// The element to calculate the value.
        /// </param>
        /// <param name="elementType">
        /// The element type.
        /// </param>
        /// <returns>
        /// True if the operation succeed, false otherwise.
        /// </returns>
        public override bool Calculate(ExporterIFC exporterIFC, IFCExtrusionCreationData extrusionCreationData, Element element, ElementType elementType, EntryMap entryMap)
        {
            bool valid = true;

            if (StairsExporter.IsLegacyStairs(element))
            {
                double riserHeight, treadLength, nosingLength, waistThickness = 0;
                int    numberOfRisers, numberOfTreads = 0;
                ExporterIFCUtils.GetLegacyStairsProperties(exporterIFC, element,
                                                           out numberOfRisers, out numberOfTreads,
                                                           out riserHeight, out treadLength, out m_TreadLengthAtInnerSide,
                                                           out nosingLength, out waistThickness);
            }
            else if (element is Stairs || element is StairsRun)
            {
                Stairs stairs;
                if (element is StairsRun)
                {
                    StairsRun stairsRun = element as StairsRun;
                    stairs = stairsRun.GetStairs();
                }
                else
                {
                    stairs = element as Stairs;
                }

                StairsType stairsType = stairs.Document.GetElement(stairs.GetTypeId()) as StairsType;

                double treadLengthAtInnerSide;
                if (ParameterUtil.GetDoubleValueFromElement(stairsType,
                                                            BuiltInParameter.STAIRSTYPE_MINIMUM_TREAD_WIDTH_INSIDE_BOUNDARY, out treadLengthAtInnerSide) != null)
                {
                    m_TreadLengthAtInnerSide = UnitUtil.ScaleLength(treadLengthAtInnerSide);
                }

                if (m_TreadLengthAtInnerSide <= 0)
                {
                    m_TreadLengthAtInnerSide = UnitUtil.ScaleLength(stairs.ActualTreadDepth);
                }
            }
            else
            {
                valid = false;
            }

            // Get override from parameter
            double treadLengthAtInnerSideOverride = 0.0;

            if (ParameterUtil.GetDoubleValueFromElementOrSymbol(element, entryMap.RevitParameterName, out treadLengthAtInnerSideOverride) != null ||
                ParameterUtil.GetDoubleValueFromElementOrSymbol(element, entryMap.CompatibleRevitParameterName, out treadLengthAtInnerSideOverride) != null)
            {
                m_TreadLengthAtInnerSide = UnitUtil.ScaleArea(treadLengthAtInnerSideOverride);
            }

            return(valid);
        }
        /// <summary>
        /// Calculates width for a slab.
        /// </summary>
        /// <param name="exporterIFC">
        /// The ExporterIFC object.
        /// </param>
        /// <param name="extrusionCreationData">
        /// The IFCExtrusionCreationData.
        /// </param>
        /// <param name="element">
        /// The element to calculate the value.
        /// </param>
        /// <param name="elementType">
        /// The element type.
        /// </param>
        /// <returns>
        /// True if the operation succeed, false otherwise.
        /// </returns>
        public override bool Calculate(ExporterIFC exporterIFC, IFCExtrusionCreationData extrusionCreationData, Element element, ElementType elementType, EntryMap entryMap)
        {
            ShapeCalculator shapeCalculator = ShapeCalculator.Instance;

            if (shapeCalculator != null && shapeCalculator.GetCurrentElement() == element)
            {
                if (String.Compare(shapeCalculator.GetStringValue(), IFCProvisionForVoidShapeType.Rectangle.ToString()) == 0)
                {
                    IFCAnyHandle rectProfile = shapeCalculator.GetCurrentProfileHandle();
                    if (!IFCAnyHandleUtil.IsNullOrHasNoValue(rectProfile))
                    {
                        // This is already scaled.
                        double?width = IFCAnyHandleUtil.GetDoubleAttribute(rectProfile, "XDim");
                        m_Width = width.HasValue ? width.Value : 0.0;
                        if (m_Width > MathUtil.Eps())
                        {
                            return(true);
                        }
                    }
                }
            }

            if (ParameterUtil.GetDoubleValueFromElementOrSymbol(element, entryMap.RevitParameterName, out m_Width) == null)
            {
                if (ParameterUtil.GetDoubleValueFromElementOrSymbol(element, entryMap.CompatibleRevitParameterName, out m_Width) == null)
                {
                    ParameterUtil.GetDoubleValueFromElementOrSymbol(element, "IfcQtyWidth", out m_Width);
                }
            }

            m_Width = UnitUtil.ScaleLength(m_Width);
            if (m_Width > MathUtil.Eps())
            {
                return(true);
            }

            if (extrusionCreationData == null)
            {
                return(false);
            }

            // For Slab width is the lesser edge of the rectangle area profile (get it from ScaledHeight)
            IFCAnyHandle hnd = ExporterCacheManager.ElementToHandleCache.Find(element.Id);

            if (IFCAnyHandleUtil.IsSubTypeOf(hnd, IFCEntityType.IfcSlab))
            {
                m_Width = extrusionCreationData.ScaledHeight;
            }
            else
            {
                m_Width = extrusionCreationData.ScaledWidth;
            }

            return(m_Width > MathUtil.Eps());
        }
Exemple #24
0
        /// <summary>
        /// Calculates net volume.
        /// </summary>
        /// <param name="exporterIFC">
        /// The ExporterIFC object.
        /// </param>
        /// <param name="extrusionCreationData">
        /// The IFCExtrusionCreationData.
        /// </param>
        /// <param name="element">
        /// The element to calculate the value.
        /// </param>
        /// <param name="elementType">
        /// The element type.
        /// </param>
        /// <returns>
        /// True if the operation succeed, false otherwise.
        /// </returns>
        public override bool Calculate(ExporterIFC exporterIFC, IFCExtrusionCreationData extrusionCreationData, Element element, ElementType elementType)
        {
            double vol = 0;
            SolidMeshGeometryInfo geomInfo = GeometryUtil.GetSolidMeshGeometry(element);

            if (geomInfo.SolidsCount() > 0)
            {
                for (int ii = 0; ii < geomInfo.SolidsCount(); ++ii)
                {
                    vol += geomInfo.GetSolids()[ii].Volume;
                }
            }

            if (geomInfo.MeshesCount() > 0)
            {
                for (int jj = 0; jj < geomInfo.MeshesCount(); ++jj)
                {
                    Mesh geomMesh      = geomInfo.GetMeshes()[jj];
                    XYZ  arbitraryOrig = geomMesh.Vertices[0];
                    for (int i = 0; i < geomMesh.NumTriangles; ++i)
                    {
                        MeshTriangle meshTri = geomMesh.get_Triangle(i);
                        XYZ          v1      = meshTri.get_Vertex(0) - arbitraryOrig;
                        XYZ          v2      = meshTri.get_Vertex(1) - arbitraryOrig;
                        XYZ          v3      = meshTri.get_Vertex(2) - arbitraryOrig;
                        vol += v1.DotProduct(v2.CrossProduct(v3)) / 6.0f;
                    }
                }
            }

            m_Volume = UnitUtil.ScaleVolume(vol);
            if (m_Volume < MathUtil.Eps() * MathUtil.Eps() || m_Volume < MathUtil.Eps())
            {
                if (ParameterUtil.GetDoubleValueFromElementOrSymbol(element, "IfcQtyNetVolume", out m_Volume) == null)
                {
                    if (ParameterUtil.GetDoubleValueFromElementOrSymbol(element, "IfcNetVolume", out m_Volume) == null)
                    {
                        ParameterUtil.GetDoubleValueFromElementOrSymbol(element, "NetVolume", out m_Volume);
                    }
                }
                m_Volume = UnitUtil.ScaleVolume(m_Volume);
                if (m_Volume < MathUtil.Eps())
                {
                    return(false);
                }
                else
                {
                    return(true);
                }
            }
            else
            {
                return(true);
            }
        }
        /// <summary>
        /// Calculates total area for a roof
        /// </summary>
        /// <param name="exporterIFC">
        /// The ExporterIFC object.
        /// </param>
        /// <param name="extrusionCreationData">
        /// The IFCExtrusionCreationData.
        /// </param>
        /// <param name="element">
        /// The element to calculate the value.
        /// </param>
        /// <param name="elementType">
        /// The element type.
        /// </param>
        /// <returns>
        /// True if the operation succeed, false otherwise.
        /// </returns>
        public override bool Calculate(ExporterIFC exporterIFC, IFCExtrusionCreationData extrusionCreationData, Element element, ElementType elementType)
        {
            ParameterUtil.GetDoubleValueFromElementOrSymbol(element, "ProjectedArea", out m_Area);
            if (m_Area > MathUtil.Eps() * MathUtil.Eps())
            {
                return(true);
            }

            m_Area = UnitUtil.ScaleArea(ExporterIFCUtils.ComputeRoofProjectedArea(element));
            return(m_Area > MathUtil.Eps() * MathUtil.Eps());
        }
 /// <summary>
 /// Calculates gross weight from parameter.
 /// </summary>
 /// <param name="exporterIFC">
 /// The ExporterIFC object.
 /// </param>
 /// <param name="extrusionCreationData">
 /// The IFCExtrusionCreationData.
 /// </param>
 /// <param name="element">
 /// The element to calculate the value.
 /// </param>
 /// <param name="elementType">
 /// The element type.
 /// </param>
 /// <returns>
 /// True if the operation succeed, false otherwise.
 /// </returns>
 public override bool Calculate(ExporterIFC exporterIFC, IFCExtrusionCreationData extrusionCreationData, Element element, ElementType elementType)
 {
     ParameterUtil.GetDoubleValueFromElementOrSymbol(element, "IfcQtyGrossWeight", out m_Weight);
     if (m_Weight < MathUtil.Eps())
     {
         return(false);
     }
     else
     {
         return(true);
     }
 }
Exemple #27
0
        /// <summary>
        /// Process to create element quantity.
        /// </summary>
        /// <param name="file">
        /// The IFC file.
        /// </param>
        /// <param name="exporterIFC">
        /// The ExporterIFC object.
        /// </param>
        /// <param name="extrusionCreationData">
        /// The IFCExtrusionCreationData.
        /// </param>
        /// <param name="element">
        /// The element of which this property is created for.
        /// </param>
        /// <param name="elementType">
        /// The element type of which this quantity is created for.
        /// </param>
        /// <returns>
        /// Then created quantity handle.
        /// </returns>
        public IFCAnyHandle ProcessEntry(IFCFile file, ExporterIFC exporterIFC,
                                         IFCExtrusionCreationData extrusionCreationData, Element element, ElementType elementType)
        {
            bool useProperty = (!String.IsNullOrEmpty(RevitParameterName)) || (RevitBuiltInParameter != BuiltInParameter.INVALID);

            bool   success = false;
            double val     = 0;

            if (useProperty)
            {
                success = ParameterUtil.GetDoubleValueFromElementOrSymbol(element, RevitParameterName, out val);
                if (!success && RevitBuiltInParameter != BuiltInParameter.INVALID)
                {
                    success = ParameterUtil.GetDoubleValueFromElementOrSymbol(element, RevitBuiltInParameter, out val);
                }
            }

            if (PropertyCalculator != null && !success)
            {
                success = PropertyCalculator.Calculate(exporterIFC, extrusionCreationData, element, elementType);
                if (success)
                {
                    val = PropertyCalculator.GetDoubleValue();
                }
            }

            IFCAnyHandle quantityHnd = null;

            if (success)
            {
                switch (QuantityType)
                {
                case QuantityType.PositiveLength:
                    quantityHnd = IFCInstanceExporter.CreateQuantityLength(file, PropertyName, MethodOfMeasurement, null, val);
                    break;

                case QuantityType.Area:
                    quantityHnd = IFCInstanceExporter.CreateQuantityArea(file, PropertyName, MethodOfMeasurement, null, val);
                    break;

                case QuantityType.Volume:
                    quantityHnd = IFCInstanceExporter.CreateQuantityVolume(file, PropertyName, MethodOfMeasurement, null, val);
                    break;

                default:
                    throw new InvalidOperationException("Missing case!");
                }
            }

            return(quantityHnd);
        }
        /// <summary>
        /// Calculates total area for a roof
        /// </summary>
        /// <param name="exporterIFC">
        /// The ExporterIFC object.
        /// </param>
        /// <param name="extrusionCreationData">
        /// The IFCExtrusionCreationData.
        /// </param>
        /// <param name="element">
        /// The element to calculate the value.
        /// </param>
        /// <param name="elementType">
        /// The element type.
        /// </param>
        /// <returns>
        /// True if the operation succeed, false otherwise.
        /// </returns>
        public override bool Calculate(ExporterIFC exporterIFC, IFCExtrusionCreationData extrusionCreationData, Element element, ElementType elementType, EntryMap entryMap)
        {
            if (ParameterUtil.GetDoubleValueFromElementOrSymbol(element, entryMap.RevitParameterName, out m_Area) == null)
            {
                ParameterUtil.GetDoubleValueFromElementOrSymbol(element, entryMap.CompatibleRevitParameterName, out m_Area);
            }
            if (m_Area > MathUtil.Eps() * MathUtil.Eps())
            {
                return(true);
            }

            m_Area = UnitUtil.ScaleArea(ExporterIFCUtils.ComputeRoofProjectedArea(element));
            return(m_Area > MathUtil.Eps() * MathUtil.Eps());
        }
Exemple #29
0
        /// <summary>
        /// Calculates the area.
        /// </summary>
        /// <param name="exporterIFC">The ExporterIFC object.</param>
        /// <param name="extrusionCreationData">The IFCExtrusionCreationData.</param>
        /// <param name="element">The element to calculate the value.</param>
        /// <param name="elementType">The element type.</param>
        /// <returns>True if the operation succeed, false otherwise.</returns>
        public override bool Calculate(ExporterIFC exporterIFC, IFCExtrusionCreationData extrusionCreationData, Element element, ElementType elementType, EntryMap entryMap)
        {
            double height = 0.0;
            double width  = 0.0;

            ElementId categoryId = CategoryUtil.GetSafeCategoryId(element);

            // Work for Door element
            if (categoryId == new ElementId(BuiltInCategory.OST_Doors))
            {
                if ((ParameterUtil.GetDoubleValueFromElementOrSymbol(element, BuiltInParameter.DOOR_HEIGHT, out height) != null) &&
                    (ParameterUtil.GetDoubleValueFromElementOrSymbol(element, BuiltInParameter.DOOR_WIDTH, out width) != null))
                {
                    m_Area = UnitUtil.ScaleArea(height * width);
                    return(true);
                }
            }

            // Work for Window element
            if (categoryId == new ElementId(BuiltInCategory.OST_Windows))
            {
                if ((ParameterUtil.GetDoubleValueFromElementOrSymbol(element, BuiltInParameter.WINDOW_HEIGHT, out height) != null) &&
                    (ParameterUtil.GetDoubleValueFromElementOrSymbol(element, BuiltInParameter.WINDOW_WIDTH, out width) != null))
                {
                    m_Area = UnitUtil.ScaleArea(height * width);
                    return(true);
                }
            }

            // If no value from the above, consider the parameter override
            if ((ParameterUtil.GetDoubleValueFromElementOrSymbol(element, entryMap.RevitParameterName, out m_Area) != null) ||
                (ParameterUtil.GetDoubleValueFromElementOrSymbol(element, entryMap.CompatibleRevitParameterName, out m_Area) != null) ||
                (ParameterUtil.GetDoubleValueFromElementOrSymbol(element, "IfcQtyArea", out m_Area) != null))     // IfcQty* is deprecated
            {
                m_Area = UnitUtil.ScaleArea(m_Area);
                if (m_Area > MathUtil.Eps() * MathUtil.Eps())
                {
                    return(true);
                }
            }

            // Work for Space element or other element that has extrusion
            if (extrusionCreationData == null)
            {
                return(false);
            }

            m_Area = extrusionCreationData.ScaledArea;
            return(m_Area > MathUtil.Eps() * MathUtil.Eps());
        }
        /// <summary>
        /// Calculates number of risers for a stair.
        /// </summary>
        /// <param name="exporterIFC">
        /// The ExporterIFC object.
        /// </param>
        /// <param name="extrusionCreationData">
        /// The IFCExtrusionCreationData.
        /// </param>
        /// <param name="element">
        /// The element to calculate the value.
        /// </param>
        /// <param name="elementType">
        /// The element type.
        /// </param>
        /// <returns>
        /// True if the operation succeed, false otherwise.
        /// </returns>
        public override bool Calculate(ExporterIFC exporterIFC, IFCExtrusionCreationData extrusionCreationData, Element element, ElementType elementType, EntryMap entryMap)
        {
            bool valid = true;

            // Get override from parameter
            if (ParameterUtil.GetDoubleValueFromElementOrSymbol(element, entryMap.RevitParameterName, out m_WaistThickness) != null)
            {
                if (ParameterUtil.GetDoubleValueFromElementOrSymbol(element, entryMap.CompatibleRevitParameterName, out m_WaistThickness) != null)
                {
                    m_WaistThickness = UnitUtil.ScaleArea(m_WaistThickness);
                }
            }

            return(valid);
        }