예제 #1
0
        private static ISurfaceEntity FromCrossSectionsGuidesCore(Curve[] crossSections, Curve[] guides)
        {
            bool isClosed = crossSections[0].IsClosed;

            //Validation
            ICurveEntity[] hostXCurves = crossSections.ConvertAll((Curve c) => GeometryExtension.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(GeometryExtension.ToEntity <Curve, 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, "Surface.LoftFromCrossSectionsGuides"));
            }
            return(entity);
        }
예제 #2
0
        private static ISolidEntity LoftFromCrossSectionsGuidesCore(Curve[] crossSections, Curve[] guides)
        {
            //Get all closed host xsections.
            ICurveEntity[] xsections = crossSections.ConvertAll((Curve c) => GeometryExtension.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(GeometryExtension.ToEntity <Curve, ICurveEntity>));

            if (entity == null)
            {
                throw new InvalidOperationException(string.Format(Properties.Resources.OperationFailed, "Solid.LoftFromCrossSectionsGuides"));
            }
            return(entity);
        }
예제 #3
0
        private static ISurfaceEntity FromCrossSectionsPathCore(Curve[] crossSections, Curve 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((Curve c) => GeometryExtension.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, "Surface.LoftFromCrossSectionsPath"));
            }
            return(entity);
        }