Exemplo n.º 1
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);
        }
Exemplo n.º 2
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());
        }
Exemplo n.º 3
0
        /// <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());
        }
        /// <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)
        {
            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, "IfcQtyWidth", out m_Width) == null)
            {
                if (ParameterUtil.GetDoubleValueFromElementOrSymbol(element, "IfcWidth", out m_Width) == null)
                {
                    ParameterUtil.GetDoubleValueFromElementOrSymbol(element, "Width", out m_Width);
                }
            }

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

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

            // Currently used for Slab Width
            m_Width = extrusionCreationData.ScaledLength;
            return(m_Width > MathUtil.Eps());
        }