Skip to content

Commit 3e0c29c

Browse files
committed
add brep from sweep
1 parent eb4504c commit 3e0c29c

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

src/compas_occ/brep/brep.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from typing import List, Tuple
1+
from typing import List, Tuple, Union
22

33
import compas.geometry
44
import compas.datastructures
@@ -59,6 +59,7 @@
5959
from OCC.Core.TopTools import TopTools_IndexedDataMapOfShapeListOfShape
6060
from OCC.Core.TopTools import TopTools_ListIteratorOfListOfShape
6161
from OCC.Core.TopExp import topexp_MapShapesAndUniqueAncestors
62+
from OCC.Core.BRepOffsetAPI import BRepOffsetAPI_MakePipe
6263

6364
# from OCC.Core.TopExp import topexp_MapShapesAndAncestors
6465
# from OCC.Core.TopExp import topexp_FirstVertex
@@ -638,13 +639,18 @@ def from_faces(cls, faces: List[BRepFace]) -> "BRep":
638639

639640
@classmethod
640641
def from_extrusion(cls, curve, vector) -> "BRep":
642+
"""Construct a BRep by extruding a closed curve along a direction vector."""
641643
pass
642644

643645
@classmethod
644-
def from_sweep(cls, profile, path) -> "BRep":
645-
pass
646+
def from_sweep(cls, profile: Union[BRepEdge, BRepFace], path: BRepLoop) -> "BRep":
647+
"""Construct a BRep by sweeping a profile along a path."""
648+
brep = cls()
649+
brep.occ_shape = BRepOffsetAPI_MakePipe(
650+
path.occ_wire, profile.occ_shape
651+
).Shape()
652+
return brep
646653

647-
# create pipe
648654
# create patch
649655
# create offset
650656

0 commit comments

Comments
 (0)