parameters: (base_shape, tool_shapes, mode, tolerance = 0.0)
return_statement: return result[0] if len(result) == 1 else Part.Compound(result)
docstring: slice(base_shape, tool_shapes, mode, tolerance = 0.0): functional part of
      Slice feature. Splits base_shape into pieces based on intersections with tool_shapes.
  
      mode is a string. It can be "Standard", "Split" or "CompSolid".
      "Standard" - return like generalFuse: edges, faces and solids are split, but wires,
      shells, compsolids get extra segments but remain in one piece.
      "Split" - wires and shells will be split at intersections, too.
      "CompSolid" - slice a solid and glue it back together to make a compsolid
docstring_summary: slice(base_shape, tool_shapes, mode, tolerance = 0.0): functional part of
      Slice feature. Splits base_shape into pieces based on intersections with tool_shapes.
docstring_tokens: slice ( base_shape tool_shapes mode tolerance = 0 . 0 ) : functional part of Slice feature . Splits base_shape into pieces based on intersections with tool_shapes .
function: def slice(base_shape, tool_shapes, mode, tolerance = 0.0):
      """slice(base_shape, tool_shapes, mode, tolerance = 0.0): functional part of
      Slice feature. Splits base_shape into pieces based on intersections with tool_shapes.
  
      mode is a string. It can be "Standard", "Split" or "CompSolid".
      "Standard" - return like generalFuse: edges, faces and solids are split, but wires,
      shells, compsolids get extra segments but remain in one piece.
      "Split" - wires and shells will be split at intersections, too.
      "CompSolid" - slice a solid and glue it back together to make a compsolid"""
  
      shapes = [base_shape] + [Part.Compound([tool_shape]) for tool_shape in tool_shapes] # hack: putting tools into compounds will prevent contamination of result with pieces of tools
      if len(shapes) < 2:
          raise ValueError("No slicing objects supplied!")
      pieces, map = shapes[0].generalFuse(shapes[1:], tolerance)
      gr = GeneralFuseResult(shapes, (pieces,map))
      if mode == "Standard":
          result = gr.piecesFromSource(shapes[0])
      elif mode == "CompSolid":
          solids = Part.Compound(gr.piecesFromSource(shapes[0])).Solids
          if len(solids) < 1:
              raise ValueError("No solids in the result. Can't make compsolid.")
          elif len(solids) == 1:
              FreeCAD.Console.PrintWarning("Part_Slice: only one solid in the result, generating trivial compsolid.")
          result = ShapeMerge.mergeSolids(solids, bool_compsolid= True).childShapes()
      elif mode == "Split":
          gr.splitAggregates(gr.piecesFromSource(shapes[0]))
          result = gr.piecesFromSource(shapes[0])
      return result[0] if len(result) == 1 else Part.Compound(result)
function_tokens: def slice ( base_shape , tool_shapes , mode , tolerance = 0.0 ) : shapes = [ base_shape ] + [ Part . Compound ( [ tool_shape ] ) for tool_shape in tool_shapes ] # hack: putting tools into compounds will prevent contamination of result with pieces of tools if len ( shapes ) < 2 : raise ValueError ( "No slicing objects supplied!" ) pieces , map = shapes [ 0 ] . generalFuse ( shapes [ 1 : ] , tolerance ) gr = GeneralFuseResult ( shapes , ( pieces , map ) ) if mode == "Standard" : result = gr . piecesFromSource ( shapes [ 0 ] ) elif mode == "CompSolid" : solids = Part . Compound ( gr . piecesFromSource ( shapes [ 0 ] ) ) . Solids if len ( solids ) < 1 : raise ValueError ( "No solids in the result. Can't make compsolid." ) elif len ( solids ) == 1 : FreeCAD . Console . PrintWarning ( "Part_Slice: only one solid in the result, generating trivial compsolid." ) result = ShapeMerge . mergeSolids ( solids , bool_compsolid = True ) . childShapes ( ) elif mode == "Split" : gr . splitAggregates ( gr . piecesFromSource ( shapes [ 0 ] ) ) result = gr . piecesFromSource ( shapes [ 0 ] ) return result [ 0 ] if len ( result ) == 1 else Part . Compound ( result )