Dynamo
Primer for v2.0
简体中文
简体中文
  • 关于
  • 简介
    • 什么是 Dynamo 以及它是如何工作的?
    • Primer 用户手册、Dynamo 社区和平台
  • Dynamo 设置
  • 用户界面
    • 工作空间
    • 库
  • 节点和导线
  • 基本节点和概念
    • 节点索引
    • 计算设计的几何图形
      • 几何图形概述
      • 向量、平面和坐标系
      • 点
      • 曲线
      • 曲面
      • 实体
      • 网格
    • 程序的构建块
      • 数据
      • 数学
      • 逻辑
      • 字符串
      • 颜色
    • 使用列表进行设计
      • 什么是列表
      • 使用列表
      • 列表的列表
      • n 维列表
    • Dynamo 中的词典
      • 什么是词典
      • 词典节点
      • 代码块中的词典
      • Revit 使用案例
  • 自定义节点和软件包
    • 自定义节点
      • 自定义节点简介
      • 创建自定义节点
      • 发布到库
    • 软件包
      • 软件包简介
      • 软件包案例研究 - Mesh Toolkit
      • 开发软件包
      • 发布软件包
      • Zero-Touch 输入
  • 适用于 Revit 的 Dynamo
    • Revit 连接
    • 选择
    • 编辑
    • 创建
    • 自定义
    • 记录
  • Dynamo for Civil 3D
    • Civil 3D 连接
    • 快速入门
    • 节点库
    • 样例工作流
      • 道路
        • 灯杆放置
      • 浇口面
        • 服务设施放置
      • 公共设施
        • 重命名结构
      • 轨道
        • 间隙包络
      • 勘测
        • 点编组管理
    • 高级主题
      • 对象绑定
      • Python 和 Civil 3D
    • Dynamo Player
    • 有用的软件包
    • 资源
  • Forma Beta 版中的 Dynamo
    • 在 Forma 中设置 Dynamo Player
    • 在 Dynamo Player 中添加和共享图形
    • 在 Dynamo Player 中运行图形
    • Dynamo 计算服务与 Desktop Dynamo 的差异
  • 在 Dynamo 中编码
    • 代码块和 DesignScript
      • 什么是代码块
      • DesignScript 语法
      • 简写
      • 函数
    • 使用 DesignScript 的几何图形
      • DesignScript 几何图形基础知识
      • 几何基本体
      • 向量数学
      • 曲线:内插和控制点
      • 平移、旋转和其他变换
      • 曲面:内插、控制点、放样、旋转
      • 几何参数化
      • 相交和修剪
      • 几何布尔
      • Python 点生成器
    • Python
      • Python 节点
      • Python 和 Revit
      • 设置自己的 Python 模板
    • 语言更改
  • 最佳做法
    • 图形策略
    • 脚本编写策略
    • 脚本参考
    • 管理您的程序
    • 在 Dynamo 中高效处理大型数据集
  • 样例工作流
    • 快速入门工作流
      • 参数化花瓶
      • 吸引器点
    • 概念索引
  • 开发人员入门
    • 从源代码构建 Dynamo
      • 从源代码构建 DynamoRevit
      • 在 Dynamo 中管理和更新依赖项
    • 为 Dynamo 开发
      • 快速入门
      • Zero-Touch 案例研究 - 网格节点
      • 在 Zero-Touch 节点中执行 Python 脚本 (C#)
      • 进一步了解 Zero-Touch
      • 高级 Dynamo 节点自定义
      • 在 Dynamo 软件包中使用 COM(互操作)类型
      • NodeModel 案例研究 - 自定义 UI
      • 更新 Dynamo 2.x 的软件包和 Dynamo 库
      • 更新 Dynamo 3.x 的软件包和 Dynamo 库
      • 扩展程序
      • 为 Dynamo 2.0+ 定义自定义软件包组织
      • Dynamo 命令行界面
      • Dynamo 集成
      • 为 Dynamo For Revit 开发
      • 发布软件包
      • 从 Visual Studio 构建软件包
      • 软件包形式的扩展
    • 拉取请求
    • 测试期望
    • 示例
  • 附录
    • 常见问题解答
    • 可视化编程和 Dynamo
    • 资源
    • 发行说明
    • 有用的软件包
    • 示例文件
    • 主体集成图
    • 下载 PDF
    • Dynamo 键盘快捷键
Powered by GitBook
On this page
  • 坐标系
  • 点
  • 线
  • 三维基本体 - 立方体、圆锥体、圆柱体、球体等
Edit on GitHub
Export as PDF
  1. 在 Dynamo 中编码
  2. 使用 DesignScript 的几何图形

几何基本体

PreviousDesignScript 几何图形基础知识Next向量数学

Last updated 2 years ago

坐标系

尽管 Dynamo 能够创建各种复杂的几何形状,但简单的几何基本体构成任何计算设计的支柱:直接以最终设计形式表示或用作生成更复杂几何体的脚手架。

虽然不是严格的一块几何体,但 CoordinateSystem 是构建几何体的重要工具。CoordinateSystem 对象可记录位置和几何变换(如旋转、调节和缩放)。

以 x = 0、y = 0、z = 0 的点为中心创建 CoordinateSystem,不进行旋转、缩放或调节变换,只需调用 Identity 构造函数:

// create a CoordinateSystem at x = 0, y = 0, z = 0,
// no rotations, scaling, or sheering transformations

cs = CoordinateSystem.Identity();

具有几何变换的 CoordinateSystems 超出本章的范围,但另一个构造函数允许您在特定点 CoordinateSystem.ByOriginVectors 创建坐标系:

// create a CoordinateSystem at a specific location,
// no rotations, scaling, or sheering transformations
x_pos = 3.6;
y_pos = 9.4;
z_pos = 13.0;

origin = Point.ByCoordinates(x_pos, y_pos, z_pos);
identity = CoordinateSystem.Identity();

cs = CoordinateSystem.ByOriginVectors(origin,
    identity.XAxis, identity.YAxis, identity.ZAxis);

点

最简单的几何基本体是一个点,表示三维空间中的零维位置。如前所述,可以通过几种不同的方式在特定坐标系中创建点:Point.ByCoordinates 使用指定的 x、y 和 z 坐标创建点;Point.ByCartesianCoordinates 使用指定的 x、y 和 z 坐标在特定坐标系中创建点;Point.ByCylindricalCoordinates 使用半径、旋转角度和高度创建位于圆柱体上的点;Point.BySphericalCoordinates 使用半径和两个旋转角度创建位于球体上的点。

本例说明在各种坐标系中创建的点:

// create a point with x, y, and z coordinates
x_pos = 1;
y_pos = 2;
z_pos = 3;

pCoord = Point.ByCoordinates(x_pos, y_pos, z_pos);

// create a point in a specific coordinate system
cs = CoordinateSystem.Identity();
pCoordSystem = Point.ByCartesianCoordinates(cs, x_pos,
    y_pos, z_pos);

// create a point on a cylinder with the following
// radius and height
radius = 5;
height = 15;
theta = 75.5;

pCyl = Point.ByCylindricalCoordinates(cs, radius, theta,
    height);

// create a point on a sphere with radius and two angles

phi = 120.3;

pSphere = Point.BySphericalCoordinates(cs, radius,
    theta, phi);

线

下一个较高维度的 Dynamo 基本体是一条线段,表示两个端点之间的无限多个点。可以通过构造函数 Line.ByStartPointEndPoint 明确指定两个边界点,或者通过 Line.ByStartPointDirectionLength 在该方向指定起点、方向和长度来创建直线。

p1 = Point.ByCoordinates(-2, -5, -10);
p2 = Point.ByCoordinates(6, 8, 10);

// a line segment between two points
l2pts = Line.ByStartPointEndPoint(p1, p2);

// a line segment at p1 in direction 1, 1, 1 with
// length 10
lDir = Line.ByStartPointDirectionLength(p1,
    Vector.ByCoordinates(1, 1, 1), 10);

三维基本体 - 立方体、圆锥体、圆柱体、球体等

Dynamo 有表示三维中大多数基本类型的几何基本体的对象:立方体,使用 Cuboid.ByLengths 创建;圆锥体,使用 Cone.ByPointsRadius 和 Cone.ByPointsRadii 创建;圆柱体,使用 Cylinder.ByRadiusHeight 创建;球体,使用 Sphere.ByCenterPointRadius 创建。

// create a cuboid with specified lengths
cs = CoordinateSystem.Identity();

cub = Cuboid.ByLengths(cs, 5, 15, 2);

// create several cones
p1 = Point.ByCoordinates(0, 0, 10);
p2 = Point.ByCoordinates(0, 0, 20);
p3 = Point.ByCoordinates(0, 0, 30);

cone1 = Cone.ByPointsRadii(p1, p2, 10, 6);
cone2 = Cone.ByPointsRadii(p2, p3, 6, 0);

// make a cylinder
cylCS = cs.Translate(10, 0, 0);

cyl = Cylinder.ByRadiusHeight(cylCS, 3, 10);

// make a sphere
centerP = Point.ByCoordinates(-10, -10, 0);

sph = Sphere.ByCenterPointRadius(centerP, 5);