# 几何布尔

*Intersect*、*Trim* 和 *SelectTrim* 主要用于较低维度的几何图形，例如点、曲线和曲面。另一方面，实体几何图形还有一组附加方法用于在构造后修改形状，方法是以与 *Trim* 类似的方式减去材质，并将图元合并到一起以形成更大的整体。

### 并集

*Union* 方法可获取两个实体对象，并在两个对象覆盖的空间之外创建单个实体对象。对象之间的重叠空间会合并为最终形式。本例将球体和立方体合并为单个实体球体-立方体形状：

```js
s1 = Sphere.ByCenterPointRadius(
    CoordinateSystem.Identity().Origin, 6);

s2 = Sphere.ByCenterPointRadius(
    CoordinateSystem.Identity().Origin.Translate(4, 0,
    0), 6);

combined = s1.Union(s2);
```

### 差异

*Difference* 方法类似 *Trim*，从基础实体中减去输入工具实体的内容。在本例中，我们从球体中穿凿出一个小凹穴：

```js
s = Sphere.ByCenterPointRadius(
    CoordinateSystem.Identity().Origin, 6);

tool = Sphere.ByCenterPointRadius(
    CoordinateSystem.Identity().Origin.Translate(10, 0,
    0), 6);

result = s.Difference(tool);
```

### 交集

*Intersect* 方法会返回两个实体输入之间的重叠实体。在以下示例中，*Difference* 已更改为 *Intersect*，并且生成的实体是最初穿凿的缺失空心：

```js
s = Sphere.ByCenterPointRadius(
    CoordinateSystem.Identity().Origin, 6);

tool = Sphere.ByCenterPointRadius(
    CoordinateSystem.Identity().Origin.Translate(10, 0,
    0), 6);

result = s.Intersect(tool);
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://primer2.dynamobim.org/zh-cn/8_coding_in_dynamo/8-2_geometry-with-design-script/9-geometric-booleans.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
