Exemple #1
0
 private DSSolid[] SliceWithPlanes(DSPlane[] planes, bool isRegular)
 {
     IPlaneEntity[] planeHosts = planes.ConvertAll(DSGeometryExtension.ToEntity <DSPlane, IPlaneEntity>);
     if (null == planeHosts || planeHosts.Length == 0)
     {
         throw new System.ArgumentException(string.Format(Properties.Resources.InvalidInput, "planes", "DSSolid.SliceWithPlanes"), "planes");
     }
     IGeometryEntity[] solids = null;
     if (isRegular)
     {
         solids = SolidEntity.SliceWithPlanes(planeHosts);
     }
     else
     {
         solids = new IGeometryEntity[] { SolidEntity.NonRegularSliceWithPlanes(planeHosts) }
     };
     if (solids == null || solids.Length == 0)
     {
         throw new System.Exception(string.Format(Properties.Resources.OperationFailed, "DSSolid.SliceWithPlanes"));
     }
     return(solids.ToArray <DSSolid, IGeometryEntity>(true));
 }
Exemple #2
0
        public DSSolid[] Slice(DSPlane plane, bool isRegular)
        {
            if (null == plane)
            {
                throw new ArgumentNullException("plane");
            }

            IGeometryEntity[] solids = null;
            if (isRegular)
            {
                solids = SolidEntity.SliceWithPlane(plane.PlaneEntity);
            }
            else
            {
                solids = new IGeometryEntity[] { SolidEntity.NonRegularSliceWithPlane(plane.PlaneEntity) }
            };
            if (solids == null || solids.Length == 0)
            {
                throw new System.Exception(string.Format(Properties.Resources.OperationFailed, "DSSolid.Slice"));
            }
            return(solids.ToArray <DSSolid, IGeometryEntity>(true));
        }