Skip to content

Commit 8aed175

Browse files
committed
implement Tom's comments
1 parent a2fae73 commit 8aed175

File tree

3 files changed

+24
-19
lines changed

3 files changed

+24
-19
lines changed

docs/examples/surface_from_fill.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
nurbscurve5 = NurbsCurve.from_interpolation(points5)
2727
nurbscurve6 = NurbsCurve.from_interpolation(points6)
2828

29-
nurbssurface_4curves = NurbsSurface.from_fill(nurbscurve3, nurbscurve4, nurbscurve5, nurbscurve6, 'curved')
29+
nurbssurface_4curves = NurbsSurface.from_fill(nurbscurve3, nurbscurve4, nurbscurve5, nurbscurve6, style='curved')
3030

3131

3232
# ==============================================================================

src/compas_occ/geometry/curves/nurbs.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -502,7 +502,6 @@ def join(self, curve, precision=1e-4):
502502
----------
503503
curve : :class:`OCCNurbsCurve`
504504
The curve to join.
505-
506505
precision : float, optional
507506
Tolerance for continuity and multiplicity.
508507
@@ -517,19 +516,18 @@ def join(self, curve, precision=1e-4):
517516
self.occ_curve = converter.BSplineCurve()
518517

519518
def joined(self, curve, precision=1e-4):
520-
"""Returns a copy of joining this curve with another curve.
519+
"""Returns a new curve that is the result of joining this curve with another.
521520
522521
Parameters
523522
----------
524523
curve : :class:`OCCNurbsCurve`
525524
The curve to join.
526-
527525
precision : float, optional
528526
Tolerance for continuity and multiplicity.
529527
530528
Returns
531529
-------
532-
:class:`OCCNurbsCurve`
530+
:class:`OCCNurbsCurve` | None
533531
534532
"""
535533
copy = self.copy()
@@ -538,5 +536,3 @@ def joined(self, curve, precision=1e-4):
538536
if success:
539537
copy.occ_curve = converter.BSplineCurve()
540538
return copy
541-
else:
542-
return None

src/compas_occ/geometry/surfaces/nurbs.py

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@ def from_step(cls, filepath):
356356
raise NotImplementedError
357357

358358
@classmethod
359-
def from_fill(cls, curve1, curve2, curve3=None, curve4=None, scheme='stretch'):
359+
def from_fill(cls, curve1, curve2, curve3=None, curve4=None, style='stretch'):
360360
"""Construct a NURBS surface from the infill between two, three or four contiguous NURBS curves.
361361
362362
Parameters
@@ -365,30 +365,39 @@ def from_fill(cls, curve1, curve2, curve3=None, curve4=None, scheme='stretch'):
365365
curve2 : :class:`~compas_occ.geometry.OCCNurbsCurve`
366366
curve3 : :class:`~compas_occ.geometry.OCCNurbsCurve`, optional.
367367
curve4 : :class:`~compas_occ.geometry.OCCNurbsCurve`, optional.
368-
scheme (Literal[’stretch’, ’coons’, ‘curved’], optional) – The scheme according to which the mesh should be subdivided.
368+
style : Literal['stretch', 'coons', 'curved'], optional.
369+
The fill style:
370+
'stretch' gives the flattest patch.
371+
'coons' gives a rounded patch with less depth than that of curved.
372+
'curved' gives with the most rounded patch.
373+
374+
Raises
375+
------
376+
ValueError
377+
If the fill style is not supported.
369378
370379
Returns
371380
-------
372381
:class:`OCCNurbsSurface`
373382
374383
"""
375384

376-
if scheme == 'stretch':
377-
schemeStyle = GeomFill_StretchStyle
378-
elif scheme == 'coons':
379-
schemeStyle = GeomFill_CoonsStyle
380-
elif scheme == 'curved':
381-
schemeStyle = GeomFill_CurvedStyle
385+
if style == 'stretch':
386+
style = GeomFill_StretchStyle
387+
elif style == 'coons':
388+
style = GeomFill_CoonsStyle
389+
elif style == 'curved':
390+
style = GeomFill_CurvedStyle
382391
else:
383392
ValueError('Scheme is not supported')
384393

385394
surface = cls()
386-
if curve3:
387-
occ_fill = GeomFill_BSplineCurves(curve1.occ_curve, curve2.occ_curve, curve3.occ_curve, schemeStyle)
388395
if curve3 and curve4:
389-
occ_fill = GeomFill_BSplineCurves(curve1.occ_curve, curve2.occ_curve, curve3.occ_curve, curve4.occ_curve, schemeStyle)
396+
occ_fill = GeomFill_BSplineCurves(curve1.occ_curve, curve2.occ_curve, curve3.occ_curve, curve4.occ_curve, style)
397+
elif curve3:
398+
occ_fill = GeomFill_BSplineCurves(curve1.occ_curve, curve2.occ_curve, curve3.occ_curve, style)
390399
else:
391-
occ_fill = GeomFill_BSplineCurves(curve1.occ_curve, curve2.occ_curve, schemeStyle)
400+
occ_fill = GeomFill_BSplineCurves(curve1.occ_curve, curve2.occ_curve, style)
392401
surface.occ_surface = occ_fill.Surface()
393402
return surface
394403

0 commit comments

Comments
 (0)