Ejemplo n.º 1
0
        /// <summary>
        /// Checks if the curve element should be exported.
        /// </summary>
        /// <param name="curveElement">
        /// The curve element.
        /// </param>
        /// <returns>
        /// True if the curve element should be exported, false otherwise.
        /// </returns>
        private static bool ShouldCurveElementBeExported(CurveElement curveElement)
        {
            CurveElementType curveElementType = curveElement.CurveElementType;
            bool             exported         = false;

            if (curveElementType == CurveElementType.ModelCurve || curveElementType == CurveElementType.CurveByPoints)
            {
                exported = true;
            }

            if (exported)
            {
                // Confirm curve is not used by another element
                exported = !ExporterIFCUtils.IsCurveFromOtherElementSketch(curveElement);

                // Confirm the geometry curve is valid.
                Curve curve = curveElement.GeometryCurve;

                if (curve == null)
                {
                    exported = false;
                }
                else if (curve is Line)
                {
                    if (!curve.IsBound)
                    {
                        exported = false;
                    }
                    else
                    {
                        XYZ end1 = curve.GetEndPoint(0);
                        XYZ end2 = curve.GetEndPoint(1);
                        if (end1.IsAlmostEqualTo(end2))
                        {
                            exported = false;
                        }
                    }
                }
            }

            return(exported);
        }