Part Slice

Description
The Part Slice also known as Slice to compound tool is used to split shapes by intersection with other shapes. For example, for a box and a plane, a compound of two solids is created.



There are two commands to slice a shape: Part Slice apart and  Part Slice to compound. They both create a 'Slice' parametric feature, that puts the sliced pieces into a compound. However, Part Slice Apart explodes the resulting compound into separate objects. "Slice to compound" is fully-parametric, and causes no trouble as the number of pieces changes. "Slice apart" will not update the number of objects as the number of pieces changes.

The output shape occupies the same space as the original. But it is split where it intersects with other shapes. The split pieces are put into a compound (or compsolid), so the object appears to remain in one piece. You need to explode the compound to get the individual pieces. If you want to access the individual pieces in a parametric way you can use Part CompoundFilter for this purpose. For quick non-parametric access use Draft Downgrade.

The tool has three modes: "Standard", "Split", and "CompSolid". There is no selection form, they are predefined but can be accessed after the operation on the resulting slices level.

"Standard" and "Split" differ by the action of the tool on wires, shells and compsolids: if "Split", those are separated; if "Standard", they are kept together (get extra segments).

Compounding structure in "Standard" and "Split" modes follows the compounding structure of shape being sliced.

In "CompSolid" mode, the output is a compsolid (or a compound of compsolids, if the resulting solids form more than one island of connectedness). Compsolid is a set of solids connected by faces; they are related to solids like wires are related to edges, and shells are related to faces; the name is probably a shortened phrase "composite solid".

The overall action of the tool is very similar to Part Boolean Fragments, except only the pieces from the first shape are in the result.

Usage
The order of selection is important. Compounds with self-intersections are not allowed (self-intersections sometimes can be accounted for by passing the compound through Part Boolean Fragments)
 * 1) Select the object to be sliced, first, and then some objects to slice with.
 * 1) Invoke the Part Slice command several ways:
 * 2) * Press the [[Image:Part_Slice.svg|24px]] Part Slice button in the Part toolbar
 * 3) * Use the entry in the Part menu


 * 1) Noteː The Objects to slice with must completely separate the object to be sliced. Thus a cube cannot be sliced by a wire, but by a plane derived from an extruded wire for instance.

A Slice parametric object is created. Original objects are hidden, and the result of intersection is shown in 3D view.

Tree structure of Slice
The Slice command creates a sliced object. In the following example a cube is sliced by a face.

The slice is created and each piece of it is united in a Compound.



Properties

 * : Object to be sliced.
 * : List of objects to slice with. (as of FreeCAD v0.17.8053, this property is not displayed in property editor, and can only be accessed via Python).
 * : "Standard", "Split", or "CompSolid". "Split" is default. Standard and Split differ by the action of the tool on aggregation type shapes: if Split, those are separated; otherwise they are kept together (get extra segments).
 * : "fuzziness" value. This is an extra tolerance to apply when searching for intersections, in addition to tolerances stored in the input shapes.

̈Noteː Properties are accessible on the slices inner object, not on the result level.

Creating a Puzzle

 * 1) Switch to [[Image:Workbench_Sketcher.svg|24px]] Sketcher Workbench
 * 2) * Create a new sketch.
 * 3) * Draw a rectangle that will outline the overall shape of the puzzle.
 * 4) * Close the sketch.
 * 1) Switch to [[Image:Workbench_Part.svg|24px]] Part workbench.
 * 2) * Select the sketch, and pick.
 * 1) Switch back to [[Image:Workbench_Sketcher.svg|24px]] Sketcher Workbench
 * 2) * Create another sketch on the same plane.
 * 3) * Using polyline tool, draw the lines that will split the puzzle into pieces.
 * 1) Switch back to [[Image:Workbench_Part.svg|24px]] Part Workbench.
 * 2) * Select the splitter sketch, and apply [[Image:Part_BooleanFragments.svg|24px]] Part Boolean Fragments. This will insert vertices where lines of splitter sketch intersect. Having them is essential for the next step to work.
 * 1) Select the rectangular face, and the BooleanFragments of splitter sketch, and apply [[Image:Part_Slice.svg|24px]] Part Slice.
 * 1) Use [[Image:Part_ExplodeCompound.svg|24px]] Part ExplodeCompound on the sliced face, to break apart the compound made by Part Slice into individual pieces.

Note: Steps 5 and 6 can be done in single click using Part SliceApart

Scripting
The tool can by used in macros and from the python console by using the following function:


 * Creates an empty Slice feature. The 'Base' and 'Tools' properties must be assigned explicitly, afterwards.
 * Returns the newly created object.

Slice can also be applied to plain shapes, without the need to have a document object, via:

This can be useful for making custom Python scripted features.

Example:

The tool itself is implemented in Python, see (GitHub link) within the FreeCAD installation directory.

Tutorials

 * FreeCad 0.18 Part WB using Slice and Slice Apart (English language), author: Ha Gei


 * FreeCAD Slice und Slice Apart und andere Tricks (German language), author: Ha Gei