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.
Probably this is the point.
Code: Select all
import FreeCAD
from FreeCAD import Placement, Rotation, Vector
import Part
import BOPTools.SplitFeatures
def setview():
"""Rearrange View."""
FreeCAD.Gui.SendMsgToActiveView("ViewFit")
FreeCAD.Gui.activeDocument().activeView().viewAxometric()
DOC_NAME = "slice"
if FreeCAD.ActiveDocument is not None:
if FreeCAD.ActiveDocument.Name== DOC_NAME:
FreeCAD.closeDocument(DOC_NAME)
DOC = FreeCAD.newDocument(DOC_NAME)
VZOR = Vector(0,0,0)
ROT0 = Rotation(0,0,0)
shape = Part.makeBox(10,10,10)
tool = Part.makePlane(30,30)
tool.Placement = Placement(Vector(-15,-15,5), ROT0)
# mode could be "Standard", "Split", and "CompSolid"
# "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).
# if "CompSolid", return a Compsolid (a set of solids connected by faces)
slice = BOPTools.SplitAPI.slice(shape, [tool], "Split", 1.0)
Part.show(slice, "SliceTS")
print(slice.ShapeType)
shapes = slice.SubShapes
part1 = shapes[0]
part1.Placement = Placement(Vector(50,0,0), ROT0)
Part.show(part1, "slice1")
part2 = shapes[1]
part2.Placement = Placement(Vector(50,0,10), ROT0)
Part.show(part2, "slice2")
setview()
Hope it helps
Carlo D.