# 曲面：內插、控制點、斷面混成、迴轉

NurbsCurve 的二維類比是 NurbsSurface，就像自由形式的 NurbsCurve，您可以使用兩種基本方法建構 NurbsSurface：一個是輸入一組基準點，讓 Dynamo 在這些點之間內插，另一個是明確指定曲面的控制點。就像自由形式的曲線，如果設計師很清楚知道要產生的曲面形狀，或如果設計需要曲面通過約束點，內插的曲面會很好用。相反地，如果是要探索各種平滑程度的設計，透過控制點建立的曲面就比較有用。

### 內插曲面

``````// 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);``````

### 控制點曲面

``````// 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);``````

``````// 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);``````

### 斷面混成曲面

``````// 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]);``````

### 迴轉曲面

``````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);``````

Last updated