Beispiel #1
0
        public static DSSurface[] SelectTrim(DSSurface[] surfaces, DSSolid trimmingSolid, bool keepInside)
        {
            string kMethodName = "DSSurface.SelectTrim";

            if (null == trimmingSolid)
            {
                throw new System.ArgumentNullException("trimmingSolid");
            }

            ISurfaceEntity[] surfacehosts = surfaces.ConvertAll(DSGeometryExtension.ToEntity <DSSurface, ISurfaceEntity>);
            if (surfacehosts == null || surfacehosts.Length == 0)
            {
                throw new System.ArgumentException(string.Format(Properties.Resources.InvalidInput, "surfaces", kMethodName), "surfaces");
            }

            ISolidEntity trimmingEntity = trimmingSolid.SolidEntity;

            DSSurface[] result = SelectTrimCore(surfacehosts, trimmingEntity, keepInside);
            if (null != result)
            {
                Hide(surfaces);
                Hide(trimmingSolid);
            }

            return(result);
        }
Beispiel #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="toolSolid"></param>
        /// <returns></returns>
        public DSSurface[] Difference(DSSolid toolSolid)
        {
            string kMethod = "DSSurface.Difference";

            if (null == toolSolid)
            {
                throw new System.ArgumentNullException("toolSolid");
            }

            IGeometryEntity[] geoms = SurfaceEntity.SubtractFrom(toolSolid.SolidEntity);
            if (null == geoms)
            {
                throw new System.InvalidOperationException(string.Format(Properties.Resources.OperationFailed, kMethod));
            }

            return(geoms.ConvertAll(
                       (IGeometryEntity g) =>
            {
                ISurfaceEntity s = g as ISurfaceEntity;
                if (null == s)
                {
                    return null;
                }
                return s.ToSurf(true, this);
            }));
        }
Beispiel #3
0
        /// <summary>
        /// Returns a solid by doing a non-regular union (if 'isRegular' is set
        /// to false) of two solids (manifold or non-manifold)
        /// </summary>
        /// <param name="otherSolid">The other solid</param>
        /// <param name="isRegular">Switch for Regular or Non-regular Union</param>
        /// <returns>Solid</returns>
        public DSSolid Union(DSSolid otherSolid, bool isRegular)
        {
            if (otherSolid == null)
            {
                return(this);
            }
            IGeometryEntity[] solids = null;
            if (isRegular)
            {
                solids = SolidEntity.UnionWith(otherSolid.SolidEntity);
            }
            else
            {
                solids = SolidEntity.NonRegularUnionWith(otherSolid.SolidEntity);
            }

            if (null == solids || solids.Length == 0)
            {
                throw new System.Exception(string.Format(Properties.Resources.OperationFailed, "DSSolid.Union"));
            }

            ISolidEntity solidhost = solids[0] as ISolidEntity;

            if (solidhost == null)
            {
                throw new System.Exception(string.Format(Properties.Resources.OperationFailed, "DSSolid.Union"));
            }

            return(solidhost.ToSolid(true, this));
        }
Beispiel #4
0
        internal override IGeometryEntity[] ProjectOn(DSGeometry other, DSVector direction)
        {
            IVector   dir  = direction.IVector;
            DSSurface surf = other as DSSurface;

            if (null != surf)
            {
                return(surf.SurfaceEntity.Project(PointEntity, dir));
            }

            DSCurve curve = other as DSCurve;

            if (null != curve)
            {
                IPointEntity pt = curve.CurveEntity.Project(PointEntity, dir);
                return(new IGeometryEntity[] { pt });
            }

            DSPlane plane = other as DSPlane;

            if (null != plane)
            {
                IPointEntity pt = plane.PlaneEntity.Project(PointEntity, dir);
                return(new IGeometryEntity[] { pt });
            }

            DSSolid solid = other as DSSolid;

            if (null != solid)
            {
                return(solid.SolidEntity.Project(PointEntity, dir));
            }

            return(base.ProjectOn(other, direction));
        }
Beispiel #5
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="solid"></param>
        /// <param name="selectPoint"></param>
        /// <param name="autoExtend"></param>
        /// <returns></returns>
        public DSSurface Trim(DSSolid solid, DSPoint selectPoint, bool autoExtend)
        {
            if (null == solid)
            {
                throw new System.ArgumentNullException("solid");
            }

            DSSolid[] solids = { solid };
            return(Trim(null, null, null, solids, selectPoint, autoExtend));
        }
Beispiel #6
0
        public DSGeometry[] Intersect(DSGeometry other)
        {
            if (null == other)
            {
                throw new ArgumentNullException("other");
            }

            IGeometryEntity[] geoms = null;
            DSPlane           plane = other as DSPlane;

            if (plane != null)
            {
                geoms = IntersectWithPlane(plane);
            }
            else
            {
                DSSurface surf = other as DSSurface;
                if (surf != null)
                {
                    geoms = IntersectWithSurface(surf);
                }
                else
                {
                    DSSolid solid = other as DSSolid;
                    if (solid != null)
                    {
                        geoms = IntersectWithSolid(solid);
                    }
                    else
                    {
                        DSCurve curve = other as DSCurve;
                        if (curve != null)
                        {
                            geoms = IntersectWithCurve(curve);
                        }
                        else
                        {
                            DSPoint point = other as DSPoint;
                            if (null != point)
                            {
                                geoms = IntersectWithPoint(point);
                            }
                            else
                            {
                                throw new System.InvalidOperationException(string.Format(Properties.Resources.InvalidIntersect, GetType().Name, other.GetType().Name));
                            }
                        }
                    }
                }
            }

            return(geoms.ToArray <DSGeometry, IGeometryEntity>(true));
        }
Beispiel #7
0
        /// <summary>
        /// Returns a non-manifold solid by imposing the input regular solid onto
        /// the given solid
        /// </summary>
        /// <param name="otherSolid">The other solid</param>
        /// <returns>Returns a Non-manifold Solid</returns>
        public DSNonManifoldSolid Impose(DSSolid otherSolid)
        {
            if (otherSolid == null)
            {
                throw new ArgumentNullException("otherSolid");
            }

            ISolidEntity host = SolidEntity.NonRegularImpose(otherSolid.SolidEntity);

            if (host == null)
            {
                throw new System.Exception(string.Format(Properties.Resources.OperationFailed, "DSSolid.Impose"));
            }
            return(host.ToSolid(true, this) as DSNonManifoldSolid);
        }
        static DSSolid CreateSolid(IGeometryEntity host, bool persist)
        {
            ISolidEntity entity = host as ISolidEntity;

            if (null == entity)
            {
                return(null);
            }
            if (entity.IsNonManifold())
            {
                return(new DSNonManifoldSolid(entity, persist));
            }

            return(DSSolid.CreateSolid(entity, persist));
        }
Beispiel #9
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="otherSolid"></param>
        /// <returns></returns>
        public DSSolid Intersect(DSSolid otherSolid)
        {
            if (otherSolid == null)
            {
                throw new ArgumentNullException("otherSolid");
            }

            IGeometryEntity[] solids = SolidEntity.IntersectWith(otherSolid.SolidEntity);
            if (solids == null || solids.Length == 0 || solids[0] == null)
            {
                throw new System.Exception(string.Format(Properties.Resources.OperationFailed, "DSSolid.Impose"));
            }

            ISolidEntity host = solids[0] as ISolidEntity;

            return(host.ToSolid(true, this));
        }
Beispiel #10
0
        /// <summary>
        /// Constructs a point by projecting a point on solid. It is equivalent
        /// to finding the nearest point on the solid
        /// </summary>
        /// <param name="contextSolid">The solid on which the projection is to be made.</param>
        /// <returns>Projected point on solid</returns>
        public DSPoint Project(DSSolid contextSolid)
        {
            if (null == contextSolid)
            {
                throw new ArgumentNullException("contextSolid");
            }

            DSPoint pt = ProjectOnGeometry(contextSolid, null);

            if (null == pt)
            {
                throw new InvalidOperationException(string.Format(Properties.Resources.OperationFailed, "Project on surface"));
            }

            pt.Context        = contextSolid;
            pt.ReferencePoint = this;
            return(pt);
        }
Beispiel #11
0
        /// <summary>
        /// Constructs a point by projecting a point on solid with given
        /// project direction.
        /// </summary>
        /// <param name="contextSolid">The solid on which the projection is to be made.</param>
        /// <param name="direction">The direction vector of the projection</param>
        /// <returns>Projected point on solid</returns>
        public DSPoint Project(DSSolid contextSolid, DSVector direction)
        {
            if (null == contextSolid)
            {
                throw new ArgumentNullException("contextSurface");
            }
            if (null == direction || direction.IsZeroVector())
            {
                throw new ArgumentException(string.Format(Properties.Resources.InvalidInput, direction, "Project on surface"), "direction");
            }

            DSPoint pt = ProjectOnGeometry(contextSolid, direction);

            pt.Context        = contextSolid;
            pt.Direction      = direction;
            pt.ReferencePoint = this;

            return(pt);
        }
Beispiel #12
0
        public static DSSurface[] SelectTrim(DSSurface[] surfaces, DSSolid[] trimmingSolids, bool keepInside)
        {
            string kMethodName = "DSSurface.SelectTrim";

            ISurfaceEntity[] surfacehosts = surfaces.ConvertAll(DSGeometryExtension.ToEntity <DSSurface, ISurfaceEntity>);
            if (surfacehosts == null || surfacehosts.Length == 0)
            {
                throw new System.ArgumentException(string.Format(Properties.Resources.InvalidInput, "surfaces", kMethodName), "surfaces");
            }

            ISolidEntity[] solidhosts = trimmingSolids.ConvertAll(DSGeometryExtension.ToEntity <DSSolid, ISolidEntity>);
            if (null == solidhosts || solidhosts.Length == 0)
            {
                throw new System.ArgumentException(string.Format(Properties.Resources.InvalidInput, "trimmingSolids", kMethodName), "trimmingSolids");
            }

            DSSurface[] result = null;
            if (solidhosts.Length == 1)
            {
                result = SelectTrimCore(surfacehosts, solidhosts[0], keepInside);
            }
            else
            {
                DSSolid unionSolid = DSSolid.UnionCore(solidhosts[0], solidhosts, false);
                if (null == unionSolid)
                {
                    throw new System.InvalidOperationException(string.Format(Properties.Resources.OperationFailed, kMethodName));
                }

                result = SelectTrimCore(surfacehosts, unionSolid.SolidEntity, keepInside);
            }

            if (null != result)
            {
                Hide(surfaces);
                Hide(trimmingSolids);
            }

            return(result);
        }
Beispiel #13
0
 /// <summary>
 /// Returns a solid by uniting an array of solids (manifold or non-manifold)
 /// </summary>
 /// <param name="solids">The input array of solids</param>
 /// <returns>Returns a Solid</returns>
 public static DSSolid UnionAll(DSSolid[] solids)
 {
     ISolidEntity[] solidhosts = solids.ConvertAll(DSGeometryExtension.ToEntity<DSSolid, ISolidEntity>);
     if (null == solidhosts || (solidhosts.Length < 2))
         throw new System.ArgumentException(string.Format(Properties.Resources.InvalidInput, "solids", "DSSolid.UnionAll"), "solids");
     return UnionCore(solidhosts[0], solidhosts, true);
 }
Beispiel #14
0
 internal override IGeometryEntity[] IntersectWithSolid(DSSolid solid)
 {
     return solid.SolidEntity.IntersectWith(SurfaceEntity);
 }
Beispiel #15
0
 internal virtual IGeometryEntity[] IntersectWithSolid(DSSolid solid)
 {
     throw new System.InvalidOperationException(string.Format(Properties.Resources.InvalidIntersect, GetType().Name, "DSSolid"));
 }
Beispiel #16
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 DSSurface Trim(DSCurve[] curves, DSPlane[] planes, DSSurface[] surfaces, DSSolid[] solids, DSPoint selectPoint, bool autoExtend)
        {
            if (null == selectPoint)
                throw new System.ArgumentNullException("selectPoint");

            ICurveEntity[] hostCurves = curves.ConvertAll(DSGeometryExtension.ToEntity<DSCurve, ICurveEntity>);
            IPlaneEntity[] hostPlanes = planes.ConvertAll(DSGeometryExtension.ToEntity<DSPlane, IPlaneEntity>);
            ISurfaceEntity[] hostSurfaces = surfaces.ConvertAll(DSGeometryExtension.ToEntity<DSSurface, ISurfaceEntity>);
            ISolidEntity[] hostSolids = solids.ConvertAll(DSGeometryExtension.ToEntity<DSSolid, ISolidEntity>);

            IPointEntity hostPoint = selectPoint.PointEntity;

            if (hostCurves == null && hostPlanes == null && hostSurfaces == null && hostSolids == null)
                throw new System.ArgumentException(string.Format(Properties.Resources.InvalidInput, "DSGeometry", "DSSurface.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);
        }
Beispiel #17
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="solids"></param>
        /// <param name="selectPoint"></param>
        /// <param name="autoExtend"></param>
        /// <returns></returns>
        public DSSurface Trim(DSSolid[] solids, DSPoint selectPoint, bool autoExtend)
        {
            if(null == solids)
                throw new System.ArgumentNullException("solids");

            return Trim(null, null, null, solids, selectPoint, autoExtend);
        }
Beispiel #18
0
 /// <summary>
 /// Returns a solid by uniting one solid with an array of solids (any combination of manifold or non-manifold)
 /// </summary>
 /// <param name="otherSolids">An array of solids</param>
 /// <returns>Returns a Solid</returns>
 public DSSolid Union(DSSolid[] otherSolids)
 {
     ISolidEntity[] othersolidhosts = otherSolids.ConvertAll(DSGeometryExtension.ToEntity<DSSolid, ISolidEntity>);
     if (null == othersolidhosts || (othersolidhosts.Length == 0))
         throw new System.ArgumentException(string.Format(Properties.Resources.InvalidInput, "otherSolids", "DSSolid.Union"), "otherSolids");
     return UnionCore(SolidEntity, othersolidhosts, true);
 }
Beispiel #19
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="toolSolid"></param>
        /// <returns></returns>
        public DSSurface[] Difference(DSSolid toolSolid)
        {
            string kMethod = "DSSurface.Difference";
            if (null == toolSolid)
                throw new System.ArgumentNullException("toolSolid");

            IGeometryEntity[] geoms = SurfaceEntity.SubtractFrom(toolSolid.SolidEntity);
            if (null == geoms)
                throw new System.InvalidOperationException(string.Format(Properties.Resources.OperationFailed, kMethod));

            return geoms.ConvertAll(
                (IGeometryEntity g) =>
                {
                    ISurfaceEntity s = g as ISurfaceEntity;
                    if (null == s)
                        return null;
                    return s.ToSurf(true, this);
                });
        }
Beispiel #20
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="solids"></param>
 /// <param name="selectPoint"></param>
 /// <returns></returns>
 public DSSolid Trim(DSSolid[] solids, DSPoint selectPoint)
 {
     return Trim(null, null, solids, selectPoint);
 }
Beispiel #21
0
        // TODO: To be fixed - pratapa
        /// <summary>
        /// 
        /// </summary>
        /// <param name="planes"></param>
        /// <param name="surfaces"></param>
        /// <param name="solids"></param>
        /// <param name="selectPoint"></param>
        /// <returns></returns>
        public DSSolid Trim(DSPlane[] planes, DSSurface[] surfaces, DSSolid[] solids, DSPoint selectPoint)
        {
            IPlaneEntity[] hostPlanes = planes.ConvertAll(DSGeometryExtension.ToEntity<DSPlane, IPlaneEntity>);
            ISurfaceEntity[] hostSurfaces = surfaces.ConvertAll(DSGeometryExtension.ToEntity<DSSurface, ISurfaceEntity>);
            ISolidEntity[] hostSolids = solids.ConvertAll(DSGeometryExtension.ToEntity<DSSolid, ISolidEntity>);
            if (selectPoint == null)
                throw new System.ArgumentNullException("selectPoint");
            IPointEntity hostPoint = selectPoint.PointEntity;
            if (hostPlanes == null && hostSurfaces == null && hostSolids == null)
                throw new System.ArgumentException(string.Format(Properties.Resources.InvalidInput, "DSGeometry", "DSSolid.Trim"));

            ISolidEntity trimSolid = SolidEntity.Trim(hostPlanes, hostSurfaces, hostSolids, hostPoint);
            if (null == trimSolid)
                throw new System.Exception(string.Format(Properties.Resources.OperationFailed, "DSSolid.Trim"));

            Hide(planes);
            Hide(surfaces);
            Hide(solids);
            SetVisibility(false);

            return new DSSolid(trimSolid, true);
        }
Beispiel #22
0
 /// <summary>
 /// Returns a solid by uniting one solid with another solid
 /// </summary>
 /// <param name="otherSolid">The other solid </param>
 /// <returns>Returns a Solid</returns>
 public DSSolid Union(DSSolid otherSolid)
 {
     return Union(otherSolid, true);
 }
Beispiel #23
0
        /// <summary>
        /// Constructs a point by projecting a point on solid. It is equivalent 
        /// to finding the nearest point on the solid
        /// </summary>
        /// <param name="contextSolid">The solid on which the projection is to be made.</param>
        /// <returns>Projected point on solid</returns>
        public DSPoint Project(DSSolid contextSolid)
        {
            if (null == contextSolid)
                throw new ArgumentNullException("contextSolid");

            DSPoint pt = ProjectOnGeometry(contextSolid, null);
            if (null == pt)
                throw new InvalidOperationException(string.Format(Properties.Resources.OperationFailed, "Project on surface"));

            pt.Context = contextSolid;
            pt.ReferencePoint = this;
            return pt;
        }
Beispiel #24
0
        /// <summary>
        /// Returns a non-manifold solid by imposing the input regular solid onto 
        /// the given solid
        /// </summary>
        /// <param name="otherSolid">The other solid</param>
        /// <returns>Returns a Non-manifold Solid</returns>
        public DSNonManifoldSolid Impose(DSSolid otherSolid)
        {
            if (otherSolid == null)
                throw new ArgumentNullException("otherSolid");

            ISolidEntity host = SolidEntity.NonRegularImpose(otherSolid.SolidEntity);
            if (host == null)
                throw new System.Exception(string.Format(Properties.Resources.OperationFailed, "DSSolid.Impose"));
            return host.ToSolid(true, this) as DSNonManifoldSolid;
        }
Beispiel #25
0
 /// <summary>
 /// Returns a solid by uniting one solid with another solid
 /// </summary>
 /// <param name="otherSolid">The other solid </param>
 /// <returns>Returns a Solid</returns>
 public DSSolid Union(DSSolid otherSolid)
 {
     return(Union(otherSolid, true));
 }
Beispiel #26
0
        /// <summary>
        /// Returns a solid by doing a non-regular unite (if 'isRegular' is set
        /// to false) of one solid with an array of solids (any combination of 
        /// manifold or non-manifold)
        /// </summary>
        /// <param name="otherSolids">An array of solids</param>
        /// <param name="isRegular">Switch for Regular or Non-regular Union</param>
        /// <returns>Returns a solid</returns>
        public DSSolid Union(DSSolid[] otherSolids, bool isRegular)
        {
            ISolidEntity[] othersolidhosts = otherSolids.ConvertAll(DSGeometryExtension.ToEntity<DSSolid, ISolidEntity>);
            if (null == othersolidhosts || (othersolidhosts.Length == 0))
                throw new System.ArgumentException(string.Format(Properties.Resources.InvalidInput, "otherSolids", "DSSolid.Union"), "otherSolids");

            if (isRegular)
                return UnionCore(SolidEntity, othersolidhosts, true);

            ISolidEntity host = SolidEntity.NonRegularUnionWithMany(othersolidhosts);
            if (host == null)
                throw new System.Exception(string.Format(Properties.Resources.OperationFailed, "DSSolid.Union"));
            return host.ToSolid(true, this);
        }
Beispiel #27
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="solid"></param>
 /// <param name="selectPoint"></param>
 /// <returns></returns>
 public DSSolid Trim(DSSolid solid, DSPoint selectPoint)
 {
     DSSolid[] solids = { solid };
     return Trim(null, null, solids, selectPoint);
 }
Beispiel #28
0
        public static DSSurface[] SelectTrim(DSSurface[] surfaces, DSSolid[] trimmingSolids, bool keepInside)
        {
            string kMethodName = "DSSurface.SelectTrim";
            ISurfaceEntity[] surfacehosts = surfaces.ConvertAll(DSGeometryExtension.ToEntity<DSSurface, ISurfaceEntity>);
            if (surfacehosts == null || surfacehosts.Length == 0)
                throw new System.ArgumentException(string.Format(Properties.Resources.InvalidInput, "surfaces", kMethodName), "surfaces");

            ISolidEntity[] solidhosts = trimmingSolids.ConvertAll(DSGeometryExtension.ToEntity<DSSolid, ISolidEntity>);
            if (null == solidhosts || solidhosts.Length == 0)
                throw new System.ArgumentException(string.Format(Properties.Resources.InvalidInput, "trimmingSolids", kMethodName), "trimmingSolids");

            DSSurface[] result = null;
            if (solidhosts.Length == 1)
            {
                result = SelectTrimCore(surfacehosts, solidhosts[0], keepInside);
            }
            else
            {
                DSSolid unionSolid = DSSolid.UnionCore(solidhosts[0], solidhosts, false);
                if (null == unionSolid)
                    throw new System.InvalidOperationException(string.Format(Properties.Resources.OperationFailed, kMethodName));

                result = SelectTrimCore(surfacehosts, unionSolid.SolidEntity, keepInside);
            }

            if (null != result)
            {
                Hide(surfaces);
                Hide(trimmingSolids);
            }

            return result;
        }
Beispiel #29
0
        /// <summary>
        /// Constructs a point by projecting a point on solid with given 
        /// project direction.
        /// </summary>
        /// <param name="contextSolid">The solid on which the projection is to be made.</param>
        /// <param name="direction">The direction vector of the projection</param>
        /// <returns>Projected point on solid</returns>
        public DSPoint Project(DSSolid contextSolid, DSVector direction)
        {
            if (null == contextSolid)
                throw new ArgumentNullException("contextSurface");
            if (null == direction || direction.IsZeroVector())
                throw new ArgumentException(string.Format(Properties.Resources.InvalidInput, direction, "Project on surface"), "direction");

            DSPoint pt = ProjectOnGeometry(contextSolid, direction);
            pt.Context = contextSolid;
            pt.Direction = direction;
            pt.ReferencePoint = this;

            return pt;
        }
Beispiel #30
0
        /// <summary>
        /// Returns a solid by doing a non-regular union (if 'isRegular' is set 
        /// to false) of two solids (manifold or non-manifold)
        /// </summary>
        /// <param name="otherSolid">The other solid</param>
        /// <param name="isRegular">Switch for Regular or Non-regular Union</param>
        /// <returns>Solid</returns>
        public DSSolid Union(DSSolid otherSolid, bool isRegular)
        {
            if (otherSolid == null)
                return this;
            IGeometryEntity[] solids = null;
            if (isRegular)
                solids = SolidEntity.UnionWith(otherSolid.SolidEntity);
            else
                solids = SolidEntity.NonRegularUnionWith(otherSolid.SolidEntity);

            if (null == solids || solids.Length == 0)
                throw new System.Exception(string.Format(Properties.Resources.OperationFailed, "DSSolid.Union"));

            ISolidEntity solidhost = solids[0] as ISolidEntity;
            if (solidhost == null)
                throw new System.Exception(string.Format(Properties.Resources.OperationFailed, "DSSolid.Union"));

            return solidhost.ToSolid(true, this);
        }
Beispiel #31
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="solid"></param>
 /// <param name="selectPoint"></param>
 /// <returns></returns>
 public DSSolid Trim(DSSolid solid, DSPoint selectPoint)
 {
     DSSolid[] solids = { solid };
     return(Trim(null, null, solids, selectPoint));
 }
Beispiel #32
0
        public static DSSurface[] SelectTrim(DSSurface[] surfaces, DSSolid trimmingSolid, bool keepInside)
        {
            string kMethodName = "DSSurface.SelectTrim";

            if (null == trimmingSolid)
                throw new System.ArgumentNullException("trimmingSolid");

            ISurfaceEntity[] surfacehosts = surfaces.ConvertAll(DSGeometryExtension.ToEntity<DSSurface, ISurfaceEntity>);
            if (surfacehosts == null || surfacehosts.Length == 0)
                throw new System.ArgumentException(string.Format(Properties.Resources.InvalidInput, "surfaces", kMethodName), "surfaces");

            ISolidEntity trimmingEntity = trimmingSolid.SolidEntity;
            DSSurface[] result = SelectTrimCore(surfacehosts, trimmingEntity, keepInside);
            if (null != result)
            {
                Hide(surfaces);
                Hide(trimmingSolid);
            }

            return result;
        }
Beispiel #33
0
 internal override IGeometryEntity[] IntersectWithSolid(DSSolid solid)
 {
     return(solid.SolidEntity.IntersectWith(SurfaceEntity));
 }
Beispiel #34
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="otherSolid"></param>
        /// <returns></returns>
        public DSSolid Intersect(DSSolid otherSolid)
        {
            if (otherSolid == null)
                throw new ArgumentNullException("otherSolid");

            IGeometryEntity[] solids = SolidEntity.IntersectWith(otherSolid.SolidEntity);
            if (solids == null || solids.Length == 0 || solids[0] == null)
                throw new System.Exception(string.Format(Properties.Resources.OperationFailed, "DSSolid.Impose"));

            ISolidEntity host = solids[0] as ISolidEntity;
            return host.ToSolid(true, this);
        }