Part Slice: Difference between revisions
Renatorivo (talk | contribs) No edit summary |
(Marked this version for translation) |
||
(20 intermediate revisions by 6 users not shown) | |||
Line 2: | Line 2: | ||
<translate> |
<translate> |
||
<!--T:25--> |
<!--T:25--> |
||
{{Docnav |
|||
{{Docnav|[[Part_SliceApart|Slice a part]]|[[Part_XOR|XOR]]|[[Part_Module|Part]]|IconL=Part_SliceApart.svg|IconC=Workbench_Part.svg|IconR=Part_XOR.svg}} |
|||
|[[Part_SliceApart|SliceApart]] |
|||
|[[Part_XOR|XOR]] |
|||
|[[Part_Workbench|Part]] |
|||
|IconL=Part_SliceApart.svg |
|||
|IconR=Part_XOR.svg |
|||
|IconC=Workbench_Part.svg |
|||
}} |
|||
<!--T:1--> |
<!--T:1--> |
||
{{GuiCommand |
|||
⚫ | |||
|Name=Part Slice |
|||
|MenuLocation=Part → Split → Slice to compound |
|||
|Workbenches=[[Part_Workbench|Part]] |
|||
|Version=0.17 |
|||
⚫ | |||
}} |
|||
==Description== |
==Description== <!--T:36--> |
||
<!--T:2--> |
<!--T:2--> |
||
The [[Image:Part_Slice.svg|24px]] [[Part Slice]] |
The [[Image:Part_Slice.svg|24px]] [[Part_Slice|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. |
||
<!--T:3--> |
<!--T:3--> |
||
Line 19: | Line 32: | ||
<!--T:23--> |
<!--T:23--> |
||
There are two commands to slice a shape: [[Image:Part_SliceApart.svg|24px]] [[Part |
There are two commands to slice a shape: [[Image:Part_SliceApart.svg|24px]] [[Part_SliceApart|Part Slice apart]] and [[Image:Part_Slice.svg|24px]] [[Part_Slice|Part Slice to compound]]. They both create a 'Slice' parametric feature, that puts the sliced pieces into a compound. However, [[Image:Part_SliceApart.svg|24px]] [[Part_SliceApart|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. |
||
<!--T:5--> |
<!--T:5--> |
||
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 [[Image:Part_CompoundFilter.svg|24px]] [[Part |
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 [[Image:Part_CompoundFilter.svg|24px]] [[Part_CompoundFilter|Part Compound Filter]] for this purpose. For quick non-parametric access use [[Image:Draft_Downgrade.svg|24px]] [[Draft_Downgrade|Draft Downgrade]]. |
||
<!--T:6--> |
<!--T:6--> |
||
Line 37: | Line 50: | ||
<!--T:10--> |
<!--T:10--> |
||
The overall action of the tool is very similar to [[Image:Part_BooleanFragments.svg|24px]] [[Part |
The overall action of the tool is very similar to [[Image:Part_BooleanFragments.svg|24px]] [[Part_BooleanFragments|Part Boolean Fragments]], except only the pieces from the first shape are in the result. |
||
==Usage== |
==Usage== <!--T:37--> |
||
<!--T:11--> |
<!--T:11--> |
||
# Select the object to be sliced, first, and then some objects to slice with. <br /> 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 [[Image:Part_BooleanFragments.svg|24px]] [[Part_BooleanFragments| |
# Select the object to be sliced, first, and then some objects to slice with. <br /> 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 [[Image:Part_BooleanFragments.svg|24px]] [[Part_BooleanFragments|Part Boolean Fragments]]) |
||
# Invoke the Part Slice command several ways: |
# Invoke the Part Slice command several ways: |
||
#* Press the [[Image:Part_Slice.svg|24px]] [[Part Slice]] button in the Part toolbar |
#* Press the [[Image:Part_Slice.svg|24px]] [[Part_Slice|Part Slice]] button in the Part toolbar |
||
#* Use the {{MenuCommand|Part → Split → Slice}} entry in the Part menu |
#* Use the {{MenuCommand|Part → Split → Slice to compound}} entry in the Part menu |
||
<!--T:29--> |
<!--T:29--> |
||
# Noteː The Objects to slice with must completely separate the object to be sliced. Thus a cube cannot be sliced by a wire |
# 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. |
||
<!--T:12--> |
<!--T:12--> |
||
A Slice parametric object is created. Original objects are hidden, and the result of intersection is shown in [[3D view]]. |
A Slice parametric object is created. Original objects are hidden, and the result of intersection is shown in [[3D_view|3D view]]. |
||
<!--T:30--> |
|||
===Tree structure of Slice === |
|||
The Slice command creates a |
The Slice command creates a sliced object. In the following example a cube is sliced by a face. |
||
<!--T:31--> |
<!--T:31--> |
||
Line 62: | Line 76: | ||
[[Image:Part_SliceTree.png]] |
[[Image:Part_SliceTree.png]] |
||
==Properties== |
==Properties== <!--T:38--> |
||
<!--T:13--> |
<!--T:13--> |
||
Line 70: | Line 84: | ||
* {{PropertyData|Mode}}: "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). |
* {{PropertyData|Mode}}: "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). |
||
* {{PropertyData|Tolerance}}: "fuzziness" value. This is an extra tolerance to apply when searching for intersections, in addition to tolerances stored in the input shapes. |
* {{PropertyData|Tolerance}}: "fuzziness" value. This is an extra tolerance to apply when searching for intersections, in addition to tolerances stored in the input shapes. |
||
<!--T:33--> |
<!--T:33--> |
||
̈Noteː Properties are accessible on the slices inner object, not on the result level. |
|||
==Example== <!--T:14--> |
==Example== <!--T:14--> |
||
Line 80: | Line 93: | ||
<!--T:35--> |
<!--T:35--> |
||
# Switch to [[Image:Workbench_Sketcher.svg|24px]] [[Sketcher Workbench]] |
# Switch to [[Image:Workbench_Sketcher.svg|24px]] [[Sketcher_Workbench|Sketcher Workbench]] |
||
#* Create a new sketch. |
#* Create a new sketch. |
||
#* Draw a rectangle that will outline the overall shape of the puzzle. |
#* Draw a rectangle that will outline the overall shape of the puzzle. |
||
#* Close the sketch.<br />[[image:slice_example_step1.png|320px]] |
#* Close the sketch.<br />[[image:slice_example_step1.png|320px]] |
||
# Switch to [[Image:Workbench_Part.svg|24px]] [[ |
# Switch to [[Image:Workbench_Part.svg|24px]] [[Part_Workbench|Part workbench]]. |
||
#* Select the sketch, and pick {{MenuCommand|Part → |
#* Select the sketch, and pick {{MenuCommand|Part → [[Image:Part_MakeFace.svg|24px]] [[Part_MakeFace|Make face from wires]]}}.<br />[[image:slice_example_step2.png|320px]] |
||
# Switch back to [[Image:Workbench_Sketcher.svg|24px]] [[Sketcher Workbench]] |
# Switch back to [[Image:Workbench_Sketcher.svg|24px]] [[Sketcher_Workbench|Sketcher Workbench]] |
||
#* Create another sketch on the same plane. |
#* Create another sketch on the same plane. |
||
#* Using polyline tool, draw the lines that will split the puzzle into pieces.<br />[[image:slice_example_step3.png|320px]] |
#* Using polyline tool, draw the lines that will split the puzzle into pieces.<br />[[image:slice_example_step3.png|320px]] |
||
# Switch back to [[Image:Workbench_Part.svg|24px]] [[ |
# Switch back to [[Image:Workbench_Part.svg|24px]] [[Part_Workbench|Part Workbench]]. |
||
#* Select the splitter sketch, and apply [[Image:Part_BooleanFragments.svg|24px]] [[ |
#* Select the splitter sketch, and apply [[Image:Part_BooleanFragments.svg|24px]] [[Part_BooleanFragments|Part Boolean Fragments]]. This will insert vertices where lines of splitter sketch intersect. Having them is essential for the next step to work.<br />[[image:slice_example_step4.png|320px]] |
||
# Select the rectangular face, and the BooleanFragments of splitter sketch, and apply [[Image:Part_Slice.svg|24px]] Part Slice.<br />[[image:slice_example_step5.png|320px]] |
# Select the rectangular face, and the BooleanFragments of splitter sketch, and apply [[Image:Part_Slice.svg|24px]] Part Slice.<br />[[image:slice_example_step5.png|320px]] |
||
# Use [[Image:Part_ExplodeCompound.svg|24px]] [[Part ExplodeCompound]] on the sliced face, to break apart the compound made by Part Slice into individual pieces. |
# Use [[Image:Part_ExplodeCompound.svg|24px]] [[Part_ExplodeCompound|Part ExplodeCompound]] on the sliced face, to break apart the compound made by Part Slice into individual pieces. |
||
<!--T:24--> |
<!--T:24--> |
||
'''Note:''' Steps 5 and 6 can be done in single click using [[Image:Part_SliceApart.svg|24px]] [[Part SliceApart]] |
'''Note:''' Steps 5 and 6 can be done in single click using [[Image:Part_SliceApart.svg|24px]] [[Part_SliceApart|Part SliceApart]] |
||
⚫ | |||
<!--T:22--> |
|||
⚫ | |||
* ̈Properties are accessible on the slices inner object, not on the result level. |
|||
* 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. |
|||
* Slicing object must pass BOP check. See [[Image:Part_CheckGeometry.svg|24px]] [[Part_CheckGeometry|Part CheckGeometry]]. |
|||
==Scripting== <!--T:15--> |
==Scripting== <!--T:15--> |
||
<!--T:16--> |
<!--T:16--> |
||
The tool can by used in [[macros]] and from the |
The tool can by used in [[Macros|macros]] and from the [[Python|Python]] console by using the following function: |
||
</translate> |
</translate> |
||
{{Code|code=BOPTools.SplitFeatures.makeSlice(name)}} |
|||
<translate> |
<translate> |
||
Line 112: | Line 133: | ||
Slice can also be applied to plain shapes, without the need to have a document object, via: |
Slice can also be applied to plain shapes, without the need to have a document object, via: |
||
</translate> |
</translate> |
||
{{Code|code=BOPTools.SplitAPI.slice(base_shape, tool_shapes, mode, tolerance = 0.0)}} |
|||
<translate> |
<translate> |
||
<!--T:19--> |
<!--T:19--> |
||
Line 130: | Line 151: | ||
<!--T:21--> |
<!--T:21--> |
||
The tool itself is implemented in Python, see {{FileName|/Mod/Part/BOPTools/SplitFeatures.py}} |
The tool itself is implemented in Python, see {{FileName|/Mod/Part/BOPTools/SplitFeatures.py}} ([https://github.com/FreeCAD/FreeCAD/blob/master/src/Mod/Part/BOPTools/SplitFeatures.py GitHub link]) within the FreeCAD installation directory. |
||
⚫ | |||
⚫ | |||
<!--T: |
==Tutorials== <!--T:40--> |
||
{{Docnav|[[Part_SliceApart|Slice a part]]|[[Part_XOR|XOR]]|[[Part_Module|Part]]|IconL=Part_SliceApart.svg|IconC=Workbench_Part.svg|IconR=Part_XOR.svg}} |
|||
<!--T: |
<!--T:42--> |
||
* [https://www.youtube.com/watch?v=tzHkQaHgrfQ FreeCad 0.18 Part WB using Slice and Slice Apart] (English language), author: Ha Gei |
|||
⚫ | |||
<!--T: |
<!--T:43--> |
||
* [https://www.youtube.com/watch?v=JJAL5JmqqKQ FreeCAD Slice und Slice Apart und andere Tricks] (German language), author: Ha Gei |
|||
⚫ | |||
<!--T:26--> |
|||
{{Docnav |
|||
|[[Part_SliceApart|SliceApart]] |
|||
|[[Part_XOR|XOR]] |
|||
|[[Part_Workbench|Part]] |
|||
|IconL=Part_SliceApart.svg |
|||
|IconR=Part_XOR.svg |
|||
|IconC=Workbench_Part.svg |
|||
}} |
|||
</translate> |
</translate> |
||
⚫ | |||
{{clear}} |
|||
⚫ |
Latest revision as of 09:25, 14 April 2023
Part Slice |
Menu location |
---|
Part → Split → Slice to compound |
Workbenches |
Part |
Default shortcut |
None |
Introduced in version |
0.17 |
See also |
Part Boolean Fragments, Part XOR, Part Join features, Part Boolean |
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.
Above: the pieces were moved apart manually afterwards, to reveal the slicing
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 Compound Filter 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
- Select the object to be sliced, first, and then some objects to slice with.
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) - Invoke the Part Slice command several ways:
- Press the Part Slice button in the Part toolbar
- Use the Part → Split → Slice to compound entry in the Part menu
- 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
Slice
- DataBase: Object to be sliced.
- DataTools: 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).
- DataMode: "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).
- DataTolerance: "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.
Example
Creating a Puzzle
- Switch to Sketcher Workbench
- Switch to Part workbench.
- Select the sketch, and pick Part → Make face from wires.
- Select the sketch, and pick Part → Make face from wires.
- Switch back to Sketcher Workbench
- Switch back to Part Workbench.
- Select the splitter sketch, and apply Part Boolean Fragments. This will insert vertices where lines of splitter sketch intersect. Having them is essential for the next step to work.
- Select the splitter sketch, and apply Part Boolean Fragments. This will insert vertices where lines of splitter sketch intersect. Having them is essential for the next step to work.
- Select the rectangular face, and the BooleanFragments of splitter sketch, and apply Part Slice.
- Use 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
Notes
- The tool was introduced in FreeCAD v0.17.8053. FreeCAD needs to be compiled with OCC 6.9.0 or later; otherwise, the tool is unavailable.
- ̈Properties are accessible on the slices inner object, not on the result level.
- 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.
- Slicing object must pass BOP check. See Part CheckGeometry.
Scripting
The tool can by used in macros and from the Python console by using the following function:
BOPTools.SplitFeatures.makeSlice(name)
- 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:
BOPTools.SplitAPI.slice(base_shape, tool_shapes, mode, tolerance = 0.0)
This can be useful for making custom Python scripted features.
Example:
import BOPTools.SplitFeatures
j = BOPTools.SplitFeatures.makeSlice(name= 'Slice')
j.Base = FreeCADGui.Selection.getSelection()[0]
j.Tools = FreeCADGui.Selection.getSelection()[1:]
The tool itself is implemented in Python, see /Mod/Part/BOPTools/SplitFeatures.py (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
- Primitives: Box, Cylinder, Sphere, Cone, Torus, Tube, Create primitives, Shape builder
- Creation and modification: Extrude, Revolve, Mirror, Fillet, Chamfer, Make face from wires, Ruled Surface, Loft, Sweep, Section, Cross sections, 3D Offset, 2D Offset, Thickness, Projection on surface, Attachment
- Boolean: Make compound, Explode Compound, Compound Filter, Boolean, Cut, Fuse, Common, Connect, Embed, Cutout, Boolean fragments, Slice apart, Slice, XOR
- Measure: Measure Linear, Measure Angular, Measure Refresh, Clear All, Toggle All, Toggle 3D, Toggle Delta
- Getting started
- Installation: Download, Windows, Linux, Mac, Additional components, Docker, AppImage, Ubuntu Snap
- Basics: About FreeCAD, Interface, Mouse navigation, Selection methods, Object name, Preferences, Workbenches, Document structure, Properties, Help FreeCAD, Donate
- Help: Tutorials, Video tutorials
- Workbenches: Std Base, Arch, Assembly, CAM, Draft, FEM, Inspection, Mesh, OpenSCAD, Part, PartDesign, Points, Reverse Engineering, Robot, Sketcher, Spreadsheet, Surface, TechDraw, Test Framework
- Hubs: User hub, Power users hub, Developer hub