# 示例

如果要查找有关如何为 Dynamo 开发的示例，请查看以下资源：

#### 样例存储库 <a href="#sample-repositories" id="sample-repositories"></a>

这些样例是 Visual Studio 模板，可用于启动您自己的项目：

* [**ZeroTouchEssentials**](https://github.com/DynamoDS/ZeroTouchEssentials)**：** 用于基本 ZeroTouch 节点的模板。
  * 返回多个输出：[代码](https://github.com/teocomi/HelloDynamo/blob/6c5333d731d58043c12e84cd3244cdbafbe74934/HelloDynamo/HelloNodeModel/HelloNodeModel.cs#L15-L24)
  * 使用 Dynamo 中的原生几何图形对象：[代码](https://github.com/DynamoDS/ZeroTouchEssentials/blob/9917fd8159afc9e7bdb2944c960155a496e0b2dc/ZeroTouchEssentials/ZeroTouchEssentials.cs#L86-L89)
  * 示例特性（查询节点）：[代码](https://github.com/DynamoDS/ZeroTouchEssentials/blob/9917fd8159afc9e7bdb2944c960155a496e0b2dc/ZeroTouchEssentials/ZeroTouchEssentials.cs#L48)
* [**HelloDynamo**](https://github.com/teocomi/HelloDynamo)**：** 用于基本 NodeModel 节点和视图自定义的模板。
  * 基本 NodeModel 模板：[HelloNodeModel.cs](https://github.com/teocomi/HelloDynamo/blob/master/HelloDynamo/HelloNodeModel/HelloNodeModel.cs)
    * 定义节点属性（输入/输出名称、描述、类型）：[代码](https://github.com/teocomi/HelloDynamo/blob/6c5333d731d58043c12e84cd3244cdbafbe74934/HelloDynamo/HelloNodeModel/HelloNodeModel.cs#L15)
    * 如果没有输入，则返回空节点：[代码](https://github.com/teocomi/HelloDynamo/blob/6c5333d731d58043c12e84cd3244cdbafbe74934/HelloDynamo/HelloNodeModel/HelloNodeModel.cs#L34-L36)
    * 创建函数调用：[代码](https://github.com/teocomi/HelloDynamo/blob/6c5333d731d58043c12e84cd3244cdbafbe74934/HelloDynamo/HelloNodeModel/HelloNodeModel.cs#L39)
  * 基本 NodeModel 视图自定义模板：[HelloGui.cs](https://github.com/teocomi/HelloDynamo/blob/master/HelloDynamo/HelloNodeModel/HelloGui.cs)、[HelloGuiNodeView.cs](https://github.com/teocomi/HelloDynamo/blob/master/HelloDynamo/HelloNodeModel/HelloGuiNodeView.cs)、[Slider.xaml](https://github.com/teocomi/HelloDynamo/blob/master/HelloDynamo/HelloNodeModel/Slider.xaml)、[Slider.xaml.cs](https://github.com/teocomi/HelloDynamo/blob/master/HelloDynamo/HelloNodeModel/Slider.xaml.cs)
    * 提醒 UI 某个图元需要更新：[代码](https://github.com/teocomi/HelloDynamo/blob/6c5333d731d58043c12e84cd3244cdbafbe74934/HelloDynamo/HelloNodeModel/HelloGui.cs#L27)
    * 自定义 NodeModel：[代码](https://github.com/teocomi/HelloDynamo/blob/6c5333d731d58043c12e84cd3244cdbafbe74934/HelloDynamo/HelloNodeModel/HelloGuiNodeView.cs#L11)
    * 定义滑块属性：[代码](https://github.com/teocomi/HelloDynamo/blob/6c5333d731d58043c12e84cd3244cdbafbe74934/HelloDynamo/HelloNodeModel/Slider.xaml#L10)
    * 确定滑块的交互逻辑：[代码](https://github.com/teocomi/HelloDynamo/blob/master/HelloDynamo/HelloNodeModel/Slider.xaml.cs)
* [**DynamoSamples**](https://github.com/DynamoDS/DynamoSamples)**：** 用于 ZeroTouch、自定义 UI、测试和视图扩展的模板。
  * [UI 样例](https://github.com/DynamoDS/DynamoSamples/tree/master/src/SampleLibraryUI)
    * 创建基本的自定义 UI 节点：[CustomNodeModel.cs](https://github.com/DynamoDS/DynamoSamples/blob/master/src/SampleLibraryUI/Examples/CustomNodeModel.cs)
    * 创建下拉菜单：[DropDown.cs](https://github.com/DynamoDS/DynamoSamples/blob/master/src/SampleLibraryUI/Examples/DropDown.cs)
  * [测试](https://github.com/DynamoDS/DynamoSamples/tree/master/src/SampleLibraryTests)
    * 系统测试：[HelloDynamoSystemTests.cs](https://github.com/DynamoDS/DynamoSamples/blob/master/src/SampleLibraryTests/HelloDynamoSystemTests.cs)
    * ZeroTouch 测试：[HelloDynamoZeroTouchTests.cs](https://github.com/DynamoDS/DynamoSamples/blob/master/src/SampleLibraryTests/HelloDynamoZeroTouchTests.cs)
  * [ZeroTouch 示例](https://github.com/DynamoDS/DynamoSamples/tree/master/src/SampleLibraryZeroTouch/Examples)：
    * ZeroTouch 节点示例，包括实现 `IGraphicItem` 以影响几何图形渲染的节点：[BasicExample.cs](https://github.com/DynamoDS/DynamoSamples/blob/master/src/SampleLibraryZeroTouch/Examples/BasicExample.cs)
    * 使用 `IRenderPackage` 为几何图形着色的 ZeroTouch 节点示例：[ColorExample.cs](https://github.com/DynamoDS/DynamoSamples/blob/master/src/SampleLibraryZeroTouch/Examples/ColorExample.cs)
  * [视图扩展示例](https://github.com/DynamoDS/DynamoSamples/tree/master/src/SampleViewExtension)：一个 IViewExtension 实现，在单击其 MenuItem 时显示一个无模式窗口。
* [**NodeModelsEssentials**](https://github.com/nonoesp/DynamoNodeModelsEssentials)**：** 用于使用 NodeModel 进行高级 Dynamo 软件包开发的模板。
  * 基本样例：
    * [Error](https://github.com/nonoesp/DynamoNodeModelsEssentials/blob/master/src/Essentials/NodeModelsEssentials/EssentialsError.cs)
    * [MultiOperation](https://github.com/nonoesp/DynamoNodeModelsEssentials/blob/master/src/Essentials/NodeModelsEssentials/EssentialsMultiOperation.cs)
    * [Multiply](https://github.com/nonoesp/DynamoNodeModelsEssentials/blob/master/src/Essentials/NodeModelsEssentials/EssentialsMultiply.cs)
    * [Timeout](https://github.com/nonoesp/DynamoNodeModelsEssentials/blob/master/src/Essentials/NodeModelsEssentials/EssentialsTimeout.cs)
  * 几何图形样例：
    * [CustomPreview](https://github.com/nonoesp/DynamoNodeModelsEssentials/blob/master/src/Essentials/NodeModelsEssentials/GeometryCustomPreview.cs)
    * [SurfaceFrom4Points](https://github.com/nonoesp/DynamoNodeModelsEssentials/blob/master/src/Essentials/NodeModelsEssentials/GeometrySurfaceFrom4Points.cs)
    * [UVPlanesOnSurface](https://github.com/nonoesp/DynamoNodeModelsEssentials/blob/master/src/Essentials/NodeModelsEssentials/GeometryUVPlanesOnSurface.cs)
    * [WobblySurface](https://github.com/nonoesp/DynamoNodeModelsEssentials/blob/master/src/Essentials/NodeModelsEssentials/GeometryWobblySurface.cs)
  * UI 样例：
    * [Button](https://github.com/nonoesp/DynamoNodeModelsEssentials/blob/master/src/Essentials/NodeModelsEssentials/UIButton.cs)
    * [ButtonFunction](https://github.com/nonoesp/DynamoNodeModelsEssentials/blob/master/src/Essentials/NodeModelsEssentials/UIButtonFunction.cs)
    * [CopyableWatch](https://github.com/nonoesp/DynamoNodeModelsEssentials/blob/master/src/Essentials/NodeModelsEssentials/UICopyableWatch.cs)
    * [Slider](https://github.com/nonoesp/DynamoNodeModelsEssentials/blob/master/src/Essentials/NodeModelsEssentials/UISlider.cs)
    * [SliderBound](https://github.com/nonoesp/DynamoNodeModelsEssentials/blob/master/src/Essentials/NodeModelsEssentials/UISliderBound.cs)
    * [State](https://github.com/nonoesp/DynamoNodeModelsEssentials/blob/master/src/Essentials/NodeModelsEssentials/UIState.cs)

[**DynaText**](https://github.com/DynamoDS/DynamoText)**：** 一个用于在 Dynamo 中创建文字的 ZeroTouch 库。

#### 案例研究 <a href="#case-studies" id="case-studies"></a>

第三方开发人员已为该平台做出了令人兴奋的重大贡献，其中许多也是开源的。以下项目是可以使用 Dynamo 实现的特例。

**Ladybug** 是一个 Python 库，可用于加载、分析和修改 EnergyPlus Weather 文件 (epw)。

<https://github.com/ladybug-tools/ladybug>

**Honeybee** 是一个 Python 库，可用于创建、运行和可视化日光 (RADIANCE) 和能量分析 (EnergyPlus/OpenStudio) 的结果。

<https://github.com/ladybug-tools/honeybee>

**Bumblebee** 是用于 Excel 和 Dynamo 互操作性 (GPL) 的插件。

<https://github.com/ksobon/Bumblebee>

**Clockwork** 是一组自定义节点，用于 Revit 相关活动以及其他用途，例如列表管理、数学运算、字符串操作、几何操作（主要是边界框、网格、平面、点、曲面、UV 和向量）和嵌板。

<https://github.com/andydandy74/ClockworkForDynamo>
