Skip to content

Commit 3ec3c6f

Browse files
committed
small changes and fixes
1 parent 0eb8cfe commit 3ec3c6f

File tree

4 files changed

+20
-7
lines changed

4 files changed

+20
-7
lines changed

docs/examples/breps/brep_from_booleans.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33
from compas.geometry import Box, Cylinder
44
from compas_view2.app import App
55

6+
from compas.tolerance import TOL
7+
8+
TOL.lineardeflection = 0.1
9+
610
R = 1.4
711
YZ = Frame.worldYZ()
812
ZX = Frame.worldZX()

src/compas_occ/brep/__init__.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,11 @@ def from_native(*args, **kwargs):
6868
return OCCBrep.from_native(*args, **kwargs)
6969

7070

71+
@plugin(category="factories", requires=["compas_occ"])
72+
def from_planes(*args, **kwargs):
73+
return OCCBrep.from_planes(*args, **kwargs)
74+
75+
7176
@plugin(category="factories", requires=["compas_occ"])
7277
def from_polygons(*args, **kwargs):
7378
return OCCBrep.from_polygons(*args, **kwargs)

src/compas_occ/brep/brep.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -725,6 +725,7 @@ def from_extrusion(
725725
cls,
726726
profile: Union[OCCBrepEdge, OCCBrepFace],
727727
vector: Vector,
728+
cap_ends: bool = False,
728729
) -> "OCCBrep":
729730
"""
730731
Construct a BRep by extruding a closed curve along a direction vector.
@@ -736,6 +737,9 @@ def from_extrusion(
736737
"""
737738
from OCC.Core.BRepPrimAPI import BRepPrimAPI_MakePrism
738739

740+
if cap_ends:
741+
raise NotImplementedError
742+
739743
brep = cls()
740744
brep.native_brep = BRepPrimAPI_MakePrism(
741745
profile.occ_shape,
@@ -1436,7 +1440,7 @@ def trim(self, plane: compas.geometry.Plane) -> None:
14361440
"""
14371441
from compas_occ.occ import split_shapes
14381442
from compas_occ.occ import compute_shape_centreofmass
1439-
from compas.geometry import is_point_infrontof_plane
1443+
from compas.geometry import is_point_behind_plane
14401444

14411445
if isinstance(plane, Frame):
14421446
plane = Plane.from_frame(plane)
@@ -1448,7 +1452,7 @@ def trim(self, plane: compas.geometry.Plane) -> None:
14481452
occ_shape = None
14491453
for test in results:
14501454
point = compute_shape_centreofmass(test)
1451-
if is_point_infrontof_plane(point, plane):
1455+
if is_point_behind_plane(point, plane):
14521456
occ_shape = test
14531457
break
14541458
if occ_shape:

src/compas_occ/geometry/curves/__init__.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
from .curve2d import OCCCurve2d # noqa : F401
2-
from .curve import OCCCurve # noqa : F401
2+
from .curve import OCCCurve
33
from .nurbs import OCCNurbsCurve
44

5-
from compas.geometry import Curve
6-
from compas.geometry import NurbsCurve
75
from compas.plugins import plugin
86

97

108
@plugin(category="factories", requires=["compas_occ"])
119
def new_curve(cls, *args, **kwargs):
12-
return super(Curve, cls).__new__(cls)
10+
curve = object.__new__(OCCCurve)
11+
return curve
1312

1413

1514
@plugin(category="factories", requires=["compas_occ"])
1615
def new_nurbscurve(cls, *args, **kwargs):
17-
return super(NurbsCurve, cls).__new__(cls)
16+
curve = object.__new__(OCCNurbsCurve)
17+
return curve
1818

1919

2020
@plugin(category="factories", requires=["compas_occ"])

0 commit comments

Comments
 (0)