|
1 | 1 | import os |
2 | 2 |
|
3 | 3 | from compas.geometry import Frame |
4 | | -from compas_occ.conversions.shapes import Box |
5 | | -from compas_occ.brep.datastructures import BRepShape |
| 4 | +from compas.geometry import Box, Cylinder |
| 5 | +from compas_occ.brep import BRep |
| 6 | + |
| 7 | +from compas_view2.app import App |
| 8 | +from compas_view2.objects import Collection |
6 | 9 |
|
7 | 10 | from OCC.Core.BRepFilletAPI import BRepFilletAPI_MakeFillet |
8 | 11 |
|
9 | 12 | HERE = os.path.dirname(__file__) |
10 | | -FILE = os.path.join(HERE, '__fillet.stp') |
| 13 | +FILE = os.path.join(HERE, "fillet.stp") |
| 14 | + |
| 15 | +box = Box(Frame.worldXY(), 1.8, 1.8, 2) |
| 16 | +box.frame.point.z += 0.2 |
| 17 | +box = BRep.from_box(box) |
11 | 18 |
|
12 | | -box = BRepShape(Box(Frame.worldXY(), 1, 1, 1).to_occ_shape()) |
13 | 19 | fillet = BRepFilletAPI_MakeFillet(box.occ_shape) |
| 20 | +for edge in box.edges: |
| 21 | + fillet.Add(0.1, edge.occ_edge) |
| 22 | +fillet.Build() |
| 23 | + |
| 24 | +void = BRep() |
| 25 | +void.occ_shape = fillet.Shape() |
| 26 | + |
| 27 | +shape = BRep.from_box(Box(Frame.worldXY(), 2, 2, 2)) |
| 28 | +shape = shape - void |
| 29 | + |
| 30 | +cylinder = Cylinder((([1, 1, 0], [0, 0, 1]), 0.4), 3) |
| 31 | +cylinder = BRep.from_cylinder(cylinder) |
| 32 | + |
| 33 | +shape = shape + cylinder |
| 34 | + |
| 35 | +viewer = App() |
14 | 36 |
|
15 | | -for edge in box.edges(): |
16 | | - fillet.Add(0.1, edge) |
| 37 | +viewmesh = shape.to_viewmesh() |
| 38 | +viewer.add(viewmesh[0], show_edges=False) |
| 39 | +viewer.add(Collection(viewmesh[1]), linewidth=2) |
17 | 40 |
|
18 | | -shape = BRepShape(fillet.Shape()) |
19 | | -shape.to_step(FILE) |
| 41 | +viewer.run() |
0 commit comments