Skip to content

Commit 996aba7

Browse files
committed
fixed bug in tesselation and added pluggables
1 parent 85636fe commit 996aba7

File tree

5 files changed

+33
-1
lines changed

5 files changed

+33
-1
lines changed

CHANGELOG.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
99

1010
### Added
1111

12+
* Added `compas_occ.geometry.curves.new_nurbscurve_from_native`.
13+
* Added `compas_occ.geometry.surfaces.new_nurbssurface_from_native`.
14+
1215
### Changed
1316

14-
### Removed
17+
* Fixed bug in `compas_occ.brep.OCCBrep.to_tesselation`.
1518

19+
### Removed
1620

1721
## [1.0.0] 2024-02-01
1822

docs/examples/breps/brep_slice.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@
1313

1414
slice = box.slice(plane)
1515

16+
for edge in slice.edges:
17+
print(edge)
18+
1619
# =============================================================================
1720
# Visualization
1821
# =============================================================================

src/compas_occ/brep/brep.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -962,6 +962,21 @@ def to_tesselation(
962962
node = nodes.Value(i)
963963
points.append(vertices[node - 1])
964964
polylines.append(Polyline(points))
965+
lines = []
966+
for edge in self.edges:
967+
if any(edge.is_same(e) for e in seen):
968+
continue
969+
if edge.is_line:
970+
lines.append(
971+
Polyline([edge.vertices[0].point, edge.vertices[-1].point])
972+
)
973+
elif edge.is_circle:
974+
lines.append(edge.curve.to_polyline())
975+
elif edge.is_ellipse:
976+
lines.append(edge.curve.to_polyline())
977+
elif edge.is_bspline:
978+
lines.append(edge.curve.to_polyline())
979+
polylines += lines
965980
return mesh, polylines
966981

967982
def to_meshes(self, u=16, v=16):

src/compas_occ/geometry/curves/__init__.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@ def new_nurbscurve(cls, *args, **kwargs):
1717
return super(NurbsCurve, cls).__new__(cls)
1818

1919

20+
@plugin(category="factories", requires=["compas_occ"])
21+
def new_nurbscurve_from_native(cls, *args, **kwargs):
22+
return OCCNurbsCurve.from_occ(*args, **kwargs)
23+
24+
2025
@plugin(category="factories", requires=["compas_occ"])
2126
def new_nurbscurve_from_parameters(cls, *args, **kwargs):
2227
return OCCNurbsCurve.from_parameters(*args, **kwargs)

src/compas_occ/geometry/surfaces/__init__.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,11 @@ def new_nurbssurface(cls, *args, **kwargs):
2323
return super(NurbsSurface, cls).__new__(cls)
2424

2525

26+
@plugin(category="factories", requires=["compas_occ"])
27+
def new_nurbssurface_from_native(cls, *args, **kwargs):
28+
return OCCNurbsSurface.from_occ(*args, **kwargs)
29+
30+
2631
@plugin(category="factories", requires=["compas_occ"])
2732
def new_nurbssurface_from_parameters(cls, *args, **kwargs):
2833
return OCCNurbsSurface.from_parameters(*args, **kwargs)

0 commit comments

Comments
 (0)