private static ISurfaceEntity FromCrossSectionsGuidesCore(DSCurve[] crossSections, DSCurve[] guides)
        {
            bool isClosed = crossSections[0].IsClosed;

            //Validation
            ICurveEntity[] hostXCurves = crossSections.ConvertAll((DSCurve c) => DSGeometryExtension.GetCurveEntity(c, isClosed));
            if (hostXCurves == null || hostXCurves.Length < 2)
            {
                throw new System.ArgumentException(string.Format(Properties.Resources.InvalidArguments, "cross sections"), "crossSections");
            }

            ICurveEntity[] hostGuides = guides.ConvertAll(DSGeometryExtension.ToEntity <DSCurve, ICurveEntity>);
            if (hostGuides == null || hostGuides.Length < 1)
            {
                throw new System.ArgumentException(string.Format(Properties.Resources.InvalidArguments, "guides"), "guides");
            }

            ISurfaceEntity entity = HostFactory.Factory.SurfaceByLoftCrossSectionsGuides(hostXCurves, hostGuides);

            if (entity == null)
            {
                throw new System.Exception(string.Format(Properties.Resources.OperationFailed, "DSSurface.LoftFromCrossSectionsGuides"));
            }
            return(entity);
        }
Beispiel #2
0
        private static ISolidEntity LoftFromCrossSectionsGuidesCore(DSCurve[] crossSections, DSCurve[] guides)
        {
            //Get all closed host xsections.
            ICurveEntity[] xsections = crossSections.ConvertAll((DSCurve c) => DSGeometryExtension.GetCurveEntity(c, true));
            if (xsections == null || xsections.Length < 2)
            {
                throw new System.ArgumentException(string.Format(Properties.Resources.InvalidArguments, "cross sections"), "crossSections");
            }

            ISolidEntity entity = HostFactory.Factory.SolidByLoftCrossSectionsGuides(xsections, guides.ConvertAll(DSGeometryExtension.ToEntity <DSCurve, ICurveEntity>));

            if (entity == null)
            {
                throw new InvalidOperationException(string.Format(Properties.Resources.OperationFailed, "DSSolid.LoftFromCrossSectionsGuides"));
            }
            return(entity);
        }
        private static ISurfaceEntity FromCrossSectionsPathCore(DSCurve[] crossSections, DSCurve path)
        {
            if (null == path)
            {
                throw new System.ArgumentException(string.Format(Properties.Resources.NullArgument, "path"), "path");
            }

            bool isClosed = crossSections[0].IsClosed;

            //Validation
            ICurveEntity[] hostXCurves = crossSections.ConvertAll((DSCurve c) => DSGeometryExtension.GetCurveEntity(c, isClosed));
            if (hostXCurves == null || hostXCurves.Length < 2)
            {
                throw new System.ArgumentException(string.Format(Properties.Resources.InvalidArguments, "cross sections"), "crossSections");
            }

            ISurfaceEntity entity = HostFactory.Factory.SurfaceByLoftCrossSectionsPath(hostXCurves, path.CurveEntity);

            if (entity == null)
            {
                throw new System.Exception(string.Format(Properties.Resources.OperationFailed, "DSSurface.LoftFromCrossSectionsPath"));
            }
            return(entity);
        }