Skip to content

Commit 021e117

Browse files
committed
add mini examples
1 parent 22a18dd commit 021e117

File tree

1 file changed

+55
-0
lines changed
  • src/compas_occ/geometry/surfaces

1 file changed

+55
-0
lines changed

src/compas_occ/geometry/surfaces/nurbs.py

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,61 @@ class OCCNurbsSurface(NurbsSurface):
8686
----------
8787
name : str, optional
8888
The name of the curve
89+
90+
Examples
91+
--------
92+
Construct a surface from points...
93+
94+
.. code-block:: python
95+
96+
from compas.geometry import Point
97+
from compas_occ.geometry import OCCNurbsSurface
98+
99+
points = [
100+
[Point(0, 0, 0), Point(1, 0, 0), Point(2, 0, 0), Point(3, 0, 0)],
101+
[Point(0, 1, 0), Point(1, 1, 2), Point(2, 1, 2), Point(3, 1, 0)],
102+
[Point(0, 2, 0), Point(1, 2, 2), Point(2, 2, 2), Point(3, 2, 0)],
103+
[Point(0, 3, 0), Point(1, 3, 0), Point(2, 3, 0), Point(3, 3, 0)],
104+
]
105+
106+
surface = OCCNurbsSurface.from_points(points=points)
107+
108+
Construct a surface from points...
109+
110+
.. code-block:: python
111+
112+
from compas.geometry import Point
113+
from compas_occ.geometry import OCCNurbsSurface
114+
115+
points = [
116+
[Point(0, 0, 0), Point(1, 0, +0), Point(2, 0, +0), Point(3, 0, +0), Point(4, 0, +0), Point(5, 0, 0)],
117+
[Point(0, 1, 0), Point(1, 1, -1), Point(2, 1, -1), Point(3, 1, -1), Point(4, 1, -1), Point(5, 1, 0)],
118+
[Point(0, 2, 0), Point(1, 2, -1), Point(2, 2, +2), Point(3, 2, +2), Point(4, 2, -1), Point(5, 2, 0)],
119+
[Point(0, 3, 0), Point(1, 3, -1), Point(2, 3, +2), Point(3, 3, +2), Point(4, 3, -1), Point(5, 3, 0)],
120+
[Point(0, 4, 0), Point(1, 4, -1), Point(2, 4, -1), Point(3, 4, -1), Point(4, 4, -1), Point(5, 4, 0)],
121+
[Point(0, 5, 0), Point(1, 5, +0), Point(2, 5, +0), Point(3, 5, +0), Point(4, 5, +0), Point(5, 5, 0)],
122+
]
123+
124+
weights = [
125+
[1.0, 1.0, 1.0, 1.0, 1.0, 1.0],
126+
[1.0, 1.0, 1.0, 1.0, 1.0, 1.0],
127+
[1.0, 1.0, 1.0, 1.0, 1.0, 1.0],
128+
[1.0, 1.0, 1.0, 1.0, 1.0, 1.0],
129+
[1.0, 1.0, 1.0, 1.0, 1.0, 1.0],
130+
[1.0, 1.0, 1.0, 1.0, 1.0, 1.0],
131+
]
132+
133+
surface = OCCNurbsSurface.from_parameters(
134+
points=points,
135+
weights=weights,
136+
u_knots=[1.0, 1 + 1/9, 1 + 2/9, 1 + 3/9, 1 + 4/9, 1 + 5/9, 1 + 6/9, 1 + 7/9, 1 + 8/9, 2.0],
137+
v_knots=[0.0, 1/9, 2/9, 3/9, 4/9, 5/9, 6/9, 7/9, 8/9, 1.0],
138+
u_mults=[1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
139+
v_mults=[1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
140+
u_degree=3,
141+
v_degree=3,
142+
)
143+
89144
"""
90145

91146
def __init__(self, name=None):

0 commit comments

Comments
 (0)