Exemple #1
0
        /// <summary>
        /// Returns the surface which defines the internal shape of the face
        /// </summary>
        /// <param name="lcs">The local coordinate system for the surface.  Can be null.</param>
        /// <returns>The surface which defines the internal shape of the face</returns>
        public override Surface GetSurface(Transform lcs)
        {
            if (SweptCurve == null)
            {
                Importer.TheLog.LogError(Id, "Cannot find the profile curve of this revolved face.", true);
            }

            IFCSimpleProfile simpleProfile = SweptCurve as IFCSimpleProfile;

            if (simpleProfile == null)
            {
                Importer.TheLog.LogError(Id, "Can't handle profile curve of type " + SweptCurve.GetType() + ".", true);
            }

            CurveLoop outerCurve   = simpleProfile.OuterCurve;
            Curve     profileCurve = (outerCurve != null) ? outerCurve.First <Curve>() : null;

            if (profileCurve == null)
            {
                Importer.TheLog.LogError(Id, "Cannot create the profile curve of this revolved surface.", true);
            }

            if (outerCurve.Count() > 1)
            {
                Importer.TheLog.LogError(Id, "Revolved surface has multiple profile curves, ignoring all but first.", false);
            }

            Curve revolvedSurfaceProfileCurve = profileCurve.CreateTransformed(Position);

            if (!RevolvedSurface.IsValidProfileCurve(AxisPosition.Origin, AxisPosition.BasisZ, revolvedSurfaceProfileCurve))
            {
                Importer.TheLog.LogError(Id, "Profile curve is invalid for this revolved surface.", true);
            }

            if (lcs == null)
            {
                return(RevolvedSurface.Create(AxisPosition.Origin, AxisPosition.BasisZ, revolvedSurfaceProfileCurve));
            }

            Curve transformedRevolvedSurfaceProfileCurve = revolvedSurfaceProfileCurve.CreateTransformed(lcs);

            return(RevolvedSurface.Create(lcs.OfPoint(AxisPosition.Origin), lcs.OfVector(AxisPosition.BasisZ), transformedRevolvedSurfaceProfileCurve));
        }