# 交集和修剪

Dynamo 針對所有幾何圖形都定義了 Intersect 方法，表示理論上，任何幾何圖形部分都可以與其他任何幾何圖形部分相交。某些交集本來就沒有意義，例如牽涉到點 (Point) 的交集，因為產生的物件永遠都是輸入點本身。下表概述物件之間其他可能的交集組合。下表概述各種交集運算的結果：

### Intersect (交集)

 與： Surface Curve Plane Solid Surface Curve Point Point、Curve Surface Curve Point Point Point Curve Plane Curve Point Curve Curve Solid Surface Curve Curve Solid

``````// python_points_5 is a set of Points generated with
// a Python script found in Chapter 12, Section 10

surf = NurbsSurface.ByPoints(python_points_5, 3, 3);

WCS = CoordinateSystem.Identity();

pl = Plane.ByOriginNormal(WCS.Origin.Translate(0, 0,
0.5), WCS.ZAxis);

// intersect surface, generating three closed curves
crvs = surf.Intersect(pl);

crvs_moved = crvs.Translate(0, 0, 10);``````

Trim 方法與 Intersect 方法非常類似之處在於幾乎是針對每個幾何圖形定義。不過，Trim 的限制遠比 Intersect 還多。

### Trim (修剪)

 使用： Point Curve Plane Surface Solid 對： Curve 是 否 否 否 否 Polygon - 否 是 否 否 Surface - 是 是 是 是 Solid - - 是 是 是

``````// python_points_5 is a set of Points generated with
// a Python script found in Chapter 12, Section 10

surf = NurbsSurface.ByPoints(python_points_5, 3, 3);

tool_pts = Point.ByCoordinates((-10..20..10)<1>,
(-10..20..10)<2>, 1);

tool = NurbsSurface.ByPoints(tool_pts);

pick_point = Point.ByCoordinates(8, 1, 3);

result = surf.Trim(tool, pick_point);``````

Last updated