NurbsCurve 的二維類比是 NurbsSurface,就像自由形式的 NurbsCurve,您可以使用兩種基本方法建構 NurbsSurface:一個是輸入一組基準點,讓 Dynamo 在這些點之間內插,另一個是明確指定曲面的控制點。就像自由形式的曲線,如果設計師很清楚知道要產生的曲面形狀,或如果設計需要曲面通過約束點,內插的曲面會很好用。相反地,如果是要探索各種平滑程度的設計,透過控制點建立的曲面就比較有用。
Copy // python_points_1 is a set of Points generated with
// a Python script found in Chapter 12, Section 10
surf = NurbsSurface .ByPoints (python_points_1);
指定曲面的基本控制點,也可以建立自由形式的 NurbsSurface。就像 NurbsCurve 一樣,控制點可以視為是代表一個有直線段的四邊形網格,這會根據曲面的次數,平滑化成最終的曲面形狀。若要使用控制點來建立 NurbsSurface,請在 NurbsSurface.ByPoints 中包含另外兩個參數,指出基本曲線在曲面兩個方向的次數。
Copy // python_points_1 is a set of Points generated with
// a Python script found in Chapter 12, Section 10
// create a surface of degree 2 with smooth segments
surf = NurbsSurface .ByPoints (python_points_1 , 2 , 2 );
Copy // python_points_1 is a set of Points generated with
// a Python script found in Chapter 12, Section 10
// create a surface of degree 6
surf = NurbsSurface .ByPoints (python_points_1 , 6 , 6 );
Copy // python_points_2, 3, and 4 are generated with
// Python scripts found in Chapter 12, Section 10
c1 = NurbsCurve .ByPoints (python_points_2);
c2 = NurbsCurve .ByPoints (python_points_3);
c3 = NurbsCurve .ByPoints (python_points_4);
loft = Surface .ByLoft ([c1 , c2 , c3]);
Copy pts = {};
pts[ 0 ] = Point .ByCoordinates ( 4 , 0 , 0 );
pts[ 1 ] = Point .ByCoordinates ( 3 , 0 , 1 );
pts[ 2 ] = Point .ByCoordinates ( 4 , 0 , 2 );
pts[ 3 ] = Point .ByCoordinates ( 4 , 0 , 3 );
pts[ 4 ] = Point .ByCoordinates ( 4 , 0 , 4 );
pts[ 5 ] = Point .ByCoordinates ( 5 , 0 , 5 );
pts[ 6 ] = Point .ByCoordinates ( 4 , 0 , 6 );
pts[ 7 ] = Point .ByCoordinates ( 4 , 0 , 7 );
crv = NurbsCurve .ByPoints (pts);
axis_origin = Point .ByCoordinates ( 0 , 0 , 0 );
axis = Vector .ByCoordinates ( 0 , 0 , 1 );
surf = Surface .ByRevolve (crv , axis_origin , axis , 0 ,
360 );