Ejemplo n.º 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;
        }
Ejemplo n.º 2
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;
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="curves"></param>
        /// <param name="planes"></param>
        /// <param name="surfaces"></param>
        /// <param name="solids"></param>
        /// <param name="selectPoint"></param>
        /// <param name="autoExtend"></param>
        /// <returns></returns>
        public Surface Trim(Curve[] curves, Plane[] planes, Surface[] surfaces, Solid[] solids, Point selectPoint, bool autoExtend)
        {
            if (null == selectPoint)
                throw new System.ArgumentNullException("selectPoint");

            ICurveEntity[] hostCurves = curves.ConvertAll(GeometryExtension.ToEntity<Curve, ICurveEntity>);
            IPlaneEntity[] hostPlanes = planes.ConvertAll(GeometryExtension.ToEntity<Plane, IPlaneEntity>);
            ISurfaceEntity[] hostSurfaces = surfaces.ConvertAll(GeometryExtension.ToEntity<Surface, ISurfaceEntity>);
            ISolidEntity[] hostSolids = solids.ConvertAll(GeometryExtension.ToEntity<Solid, ISolidEntity>);

            IPointEntity hostPoint = selectPoint.PointEntity;

            if (hostCurves == null && hostPlanes == null && hostSurfaces == null && hostSolids == null)
                throw new System.ArgumentException(string.Format(Properties.Resources.InvalidInput, "Geometry", "Surface.Trim"));

            ISurfaceEntity trimSurface = SurfaceEntity.Trim(hostCurves, hostPlanes, hostSurfaces, hostSolids, hostPoint, autoExtend);

            //For trim operation, if the return value is not null, hide the original tools and surfaces.
            if (null != trimSurface)
            {
                Hide(curves);
                Hide(planes);
                Hide(surfaces);
                Hide(solids);
                SetVisibility(false);
            }

            return trimSurface.ToSurf(true, this);
        }