Skip to content

Commit fdfb6e6

Browse files
committed
make_compound
1 parent 3f46443 commit fdfb6e6

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

OCCUtils/Construct.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
import warnings
2929
from functools import wraps
3030

31-
from OCC.Core.BRep import BRep_Tool
31+
from OCC.Core.BRep import BRep_Tool, BRep_Builder
3232
from OCC.Core.BRepAdaptor import BRepAdaptor_HCurve
3333
from OCC.Core.BRepBuilderAPI import BRepBuilderAPI_MakeFace, BRepBuilderAPI_Transform, BRepBuilderAPI_Sewing, \
3434
BRepBuilderAPI_MakePolygon, BRepBuilderAPI_MakeWire, BRepBuilderAPI_MakeSolid, BRepBuilderAPI_MakeShell, \
@@ -298,6 +298,20 @@ def make_closed_polygon(*args):
298298
result = poly.Wire()
299299
return result
300300

301+
def make_compound(topology_to_compound):
302+
# type: (Iterable) -> TopoDS_Compound
303+
"""
304+
305+
:type topology_to_compound: iterable
306+
"""
307+
compound = TopoDS_Compound()
308+
builder = BRep_Builder()
309+
builder.MakeCompound(compound)
310+
for shp in topology_to_compound:
311+
builder.Add(compound, shp)
312+
313+
return compound
314+
301315
#===========================================================================
302316
# PRIMITIVES
303317
#===========================================================================

0 commit comments

Comments
 (0)