Hello, sorry for the noob question...
I'm new to CADQuery and would like advice. I'm looking to decompose CAD solids into composite solid geometry, which requires a method to iterate over a solid, attempt to split on all faces. If a solid split on a face created more than one body a recursive method would be used to then start again on each new solid. I hav epreviosuly used FreeCAD and BOPTools slice API to carry this out, but am trying to omve to using CADQuery.
I have implemented a basic way of doing this is CADQuery to split on planes, which uses the workplane to split a solid but I would like to extend this to higher order surfaces (cylinders, spheres etc...).
A minimum working example which only works for planes:
# load from STP file
input = cq.importers.importStep("double_rpp.stp")
# iterate over all solids in input STP file
for solid in input.solids().all():
for face in solid.faces().all():
solids_split = face.workplane().split(keepBottom=True, keepTop=True).solids().all()
if len(solids_split) == 1:
continue
else:
print('sucess, split undertaken')
break
assembly = cq.Assembly()
for solid in solids_split:
assembly.add(solid)
display(input)
display(assembly)
I can't seem to find a way to iterate over each solids faces and use the cut tool, when I try the following I get a Null TopoDS_Shape object. I'm missing some fundamental understanding or CADQuesry objects.
Here's my broken attempt to cut on a face:
# load from STP file
input = cq.importers.importStep("double_sphere.stp")
solid_1 = input.solids().all()[0]
face_1 = solid_1.faces().all()[0]
solid_split = solid_1.cut(face_1)
display(input)
display(solid_split)
Any advice on approaches to take would be much appreciated.
Thanks,
Ross