元编程参考文档

CAD 构建器

32 个节点

本页内容 32

CAD 构建器

函数

Creates an empty session with a fixed, positive modeling tolerance.

签名
CAD 构建器(容差: 数字) -> Cad Builder
CadBuilder CadBuilder(double tolerance = 1E-06)

参数

名称类型默认值说明
容差数字1E-06

返回

CAD 构建器Cad Builder
所属发行版
元编程(教育版)元编程(专业版)
可用的图种类
事件 例程 状态机状态
声明于
CAD 构建器
所属包
计算机辅助设计

添加

函数

Adds a model by set union, applying the current placement first. Throws on failure without changing the current model.

签名
添加(Cad Builder: Cad Builder, 模型: Cad Model)
void Add(CadBuilder Cad Builder, CadModel model)

参数

名称类型默认值说明
Cad BuilderCad Builder—
模型Cad Model—
所属发行版
元编程(教育版)元编程(专业版)
可用的图种类
事件 例程 状态机状态
声明于
CAD 构建器
所属包
计算机辅助设计

追加

函数

Adds a model as separate bodies without fusing them.

签名
追加(Cad Builder: Cad Builder, 模型: Cad Model)
void Append(CadBuilder Cad Builder, CadModel model)

参数

名称类型默认值说明
Cad BuilderCad Builder—
模型Cad Model—
所属发行版
元编程(教育版)元编程(专业版)
可用的图种类
事件 例程 状态机状态
声明于
CAD 构建器
所属包
计算机辅助设计

构建

函数

Returns the current immutable snapshot with no copying or regeneration.

签名
构建(Cad Builder: Cad Builder) -> Cad Model
CadModel Build(CadBuilder Cad Builder)

参数

名称类型默认值说明
Cad BuilderCad Builder—

返回

结果Cad Model
所属发行版
元编程(教育版)元编程(专业版)
可用的图种类
事件 例程 状态机状态
声明于
CAD 构建器
所属包
计算机辅助设计

清空

函数

Removes all bodies, retaining the placement stack.

签名
清空(Cad Builder: Cad Builder)
void Clear(CadBuilder Cad Builder)

参数

名称类型默认值说明
Cad BuilderCad Builder—
所属发行版
元编程(教育版)元编程(专业版)
可用的图种类
事件 例程 状态机状态
声明于
CAD 构建器
所属包
计算机辅助设计

着色块

函数

重载 1/2

签名
着色块
    Cad Builder: Cad Builder
    颜色: 颜色
    子块: Action<Cad Builder>
void Color(
    CadBuilder Cad Builder,
    ColorElement color,
    Action<CadBuilder> children)

Adds everything a block builds, painted: OpenSCAD's color(c) { ... } (Cad.Color). A colour painted over another replaces it, as OpenSCAD's outer color() does.

参数

名称类型默认值说明
Cad BuilderCad Builder—
颜色颜色—The colour, its alpha how opaque.
子块Action<Cad Builder>—The block, given a session of its own.

重载 2/2

签名
按名称着色块
    Cad Builder: Cad Builder
    颜色: 文本
    不透明度: 数字
    子块: Action<Cad Builder>
void Color(
    CadBuilder Cad Builder,
    string color,
    double alpha,
    Action<CadBuilder> children)

Adds everything a block builds, painted a colour written as OpenSCAD writes one: color("red") { ... }, color("#ff8000", 0.5) { ... } (Cad.ColorOf).

参数

名称类型默认值说明
Cad BuilderCad Builder—
颜色文本—A colour's name, as CSS and OpenSCAD name colours, or "#rgb", "#rgba", "#rrggbb" or "#rrggbbaa".
不透明度数字—How opaque, from 0 to 1, times any alpha the text gives.
子块Action<Cad Builder>—The block, given a session of its own.
所属发行版
元编程(教育版)元编程(专业版)
可用的图种类
事件 例程 状态机状态
声明于
CAD 构建器
所属包
计算机辅助设计

切除

函数

Subtracts a model after applying the current placement.

签名
切除(Cad Builder: Cad Builder, 模型: Cad Model)
void Cut(CadBuilder Cad Builder, CadModel model)

参数

名称类型默认值说明
Cad BuilderCad Builder—
模型Cad Model—
所属发行版
元编程(教育版)元编程(专业版)
可用的图种类
事件 例程 状态机状态
声明于
CAD 构建器
所属包
计算机辅助设计

差集块

函数

Adds the first child of a block less every other: OpenSCAD's difference() { ... }. A block that adds nothing adds nothing.

签名
差集块(Cad Builder: Cad Builder, 子块: Action<Cad Builder>)
void Difference(
    CadBuilder Cad Builder,
    Action<CadBuilder> children)

参数

名称类型默认值说明
Cad BuilderCad Builder—
子块Action<Cad Builder>—The block, given a session of its own.
所属发行版
元编程(教育版)元编程(专业版)
可用的图种类
事件 例程 状态机状态
声明于
CAD 构建器
所属包
计算机辅助设计

差集组

函数

Runs a nested construction in an independent session, then subtracts its completed union as one atomic edit.

签名
差集组(Cad Builder: Cad Builder, 操作: Action<Cad Builder>)
void DifferenceGroup(
    CadBuilder Cad Builder,
    Action<CadBuilder> action)

参数

名称类型默认值说明
Cad BuilderCad Builder—
操作Action<Cad Builder>—
所属发行版
元编程(教育版)元编程(专业版)
可用的图种类
事件 例程 状态机状态
声明于
CAD 构建器
所属包
计算机辅助设计

子项

函数

The children added so far, in order, each placed: what a scoped operation given this session's block works on.

签名
子项(Cad Builder: Cad Builder) -> Cad Model 数组
CadModel[] Children(CadBuilder Cad Builder)

参数

名称类型默认值说明
Cad BuilderCad Builder—

返回

结果Cad Model 数组
所属发行版
元编程(教育版)元编程(专业版)
可用的图种类
事件 例程 状态机状态
声明于
CAD 构建器
所属包
计算机辅助设计

当前模型

函数

The current immutable evaluated snapshot.

签名
当前模型(Cad Builder: Cad Builder) -> Cad Model
CadModel Current(CadBuilder Cad Builder)

参数

名称类型默认值说明
Cad BuilderCad Builder—

返回

结果Cad Model
所属发行版
元编程(教育版)元编程(专业版)
可用的图种类
事件 例程 状态机状态
声明于
CAD 构建器
所属包
计算机辅助设计

公差

函数

The tolerance used by builder boolean edits, in model units.

签名
公差(Cad Builder: Cad Builder) -> 数字
double Tolerance(CadBuilder Cad Builder)

参数

名称类型默认值说明
Cad BuilderCad Builder—

返回

结果数字
所属发行版
元编程(教育版)元编程(专业版)
可用的图种类
事件 例程 状态机状态
声明于
CAD 构建器
所属包
计算机辅助设计

凸包块

函数

Adds the convex hull of everything a block builds: OpenSCAD's hull() { ... } (Cad.Hull: exact for solids of flat faces and for solids standing upright between two heights, the hull of their tessellation otherwise).

签名
凸包块(Cad Builder: Cad Builder, 子块: Action<Cad Builder>)
void Hull(CadBuilder Cad Builder, Action<CadBuilder> children)

参数

名称类型默认值说明
Cad BuilderCad Builder—
子块Action<Cad Builder>—The block, given a session of its own.
所属发行版
元编程(教育版)元编程(专业版)
可用的图种类
事件 例程 状态机状态
声明于
CAD 构建器
所属包
计算机辅助设计

求交

函数

Keeps the intersection with a model after applying the current placement.

签名
求交(Cad Builder: Cad Builder, 模型: Cad Model)
void Intersect(CadBuilder Cad Builder, CadModel model)

参数

名称类型默认值说明
Cad BuilderCad Builder—
模型Cad Model—
所属发行版
元编程(教育版)元编程(专业版)
可用的图种类
事件 例程 状态机状态
声明于
CAD 构建器
所属包
计算机辅助设计

交集块

函数

Adds what every child of a block has in common: OpenSCAD's intersection() { ... }.

签名
交集块(Cad Builder: Cad Builder, 子块: Action<Cad Builder>)
void Intersection(
    CadBuilder Cad Builder,
    Action<CadBuilder> children)

参数

名称类型默认值说明
Cad BuilderCad Builder—
子块Action<Cad Builder>—The block, given a session of its own.
所属发行版
元编程(教育版)元编程(专业版)
可用的图种类
事件 例程 状态机状态
声明于
CAD 构建器
所属包
计算机辅助设计

线性拉伸块

函数

重载 1/2

签名
线性拉伸块
    Cad Builder: Cad Builder
    高度: 数字
    二维子块: Action<Cad Shape Builder>
void LinearExtrude(
    CadBuilder Cad Builder,
    double height,
    Action<CadShapeBuilder> children)

Adds a flat shape a block draws, carried up the Z axis: OpenSCAD's linear_extrude(height) { ... }.

参数

名称类型默认值说明
Cad BuilderCad Builder—
高度数字—How high, in model units.
二维子块Action<Cad Shape Builder>—The block, drawing in a flat session of its own.

重载 2/2

签名
扭转拉伸块
    Cad Builder: Cad Builder
    高度: 数字
    居中: 真否
    扭转: 数字
    X 向缩放: 数字
    Y 向缩放: 数字
    二维子块: Action<Cad Shape Builder>
void LinearExtrude(
    CadBuilder Cad Builder,
    double height,
    bool centered,
    double twist,
    double scaleX,
    double scaleY,
    Action<CadShapeBuilder> children)

Adds a flat shape a block draws, carried up the Z axis turning and scaling: OpenSCAD's linear_extrude(height, center, twist, scale) { ... } (Cad.LinearExtrude; the twist is in radians, counter-clockwise).

参数

名称类型默认值说明
Cad BuilderCad Builder—
高度数字—How high, in model units.
居中真否—Centred on Z = 0 in height.
扭转数字—How far the top is turned, in radians, counter-clockwise seen from +Z.
X 向缩放数字—The top's scale along X.
Y 向缩放数字—The top's scale along Y.
二维子块Action<Cad Shape Builder>—The block, drawing in a flat session of its own.
所属发行版
元编程(教育版)元编程(专业版)
可用的图种类
事件 例程 状态机状态
声明于
CAD 构建器
所属包
计算机辅助设计

闵可夫斯基和块

函数

Adds the Minkowski sum of everything a block builds, each child added to the next: OpenSCAD's minkowski() { ... } (Cad.Minkowski: exact for a solid and a ball, for solids standing upright, and for polyhedra; the sum of a tessellation otherwise).

签名
闵可夫斯基和块
    Cad Builder: Cad Builder
    子块: Action<Cad Builder>
void Minkowski(
    CadBuilder Cad Builder,
    Action<CadBuilder> children)

参数

名称类型默认值说明
Cad BuilderCad Builder—
子块Action<Cad Builder>—The block, given a session of its own.
所属发行版
元编程(教育版)元编程(专业版)
可用的图种类
事件 例程 状态机状态
声明于
CAD 构建器
所属包
计算机辅助设计

镜像块

函数

Adds what a block builds, mirrored in the plane through the origin square to a direction: OpenSCAD's mirror([x, y, z]) { ... }.

签名
镜像块
    Cad Builder: Cad Builder
    法向 X: 数字
    法向 Y: 数字
    法向 Z: 数字
    子块: Action<Cad Builder>
void Mirror(
    CadBuilder Cad Builder,
    double x,
    double y,
    double z,
    Action<CadBuilder> children)

参数

名称类型默认值说明
Cad BuilderCad Builder—
法向 X数字—The mirror plane's normal, along X.
法向 Y数字—Along Y.
法向 Z数字—Along Z.
子块Action<Cad Builder>—The block, given a session of its own.
所属发行版
元编程(教育版)元编程(专业版)
可用的图种类
事件 例程 状态机状态
声明于
CAD 构建器
所属包
计算机辅助设计

矩阵变换块

函数

Adds what a block builds under a transform: OpenSCAD's multmatrix(m) { ... }.

签名
矩阵变换块
    Cad Builder: Cad Builder
    变换: Transform
    子块: Action<Cad Builder>
void MultMatrix(
    CadBuilder Cad Builder,
    Transform transform,
    Action<CadBuilder> children)

参数

名称类型默认值说明
Cad BuilderCad Builder—
变换Transform—An invertible affine transform.
子块Action<Cad Builder>—The block, given a session of its own.
所属发行版
元编程(教育版)元编程(专业版)
可用的图种类
事件 例程 状态机状态
声明于
CAD 构建器
所属包
计算机辅助设计

弹出变换

函数

Restores the preceding placement; throws if the stack is empty.

签名
弹出变换(Cad Builder: Cad Builder)
void PopTransform(CadBuilder Cad Builder)

参数

名称类型默认值说明
Cad BuilderCad Builder—
所属发行版
元编程(教育版)元编程(专业版)
可用的图种类
事件 例程 状态机状态
声明于
CAD 构建器
所属包
计算机辅助设计

压入变换

函数

Pushes a local placement. Nested placements compose parent*local; PopTransform restores the parent.

签名
压入变换(Cad Builder: Cad Builder, 局部: Transform)
void PushTransform(CadBuilder Cad Builder, Transform local)

参数

名称类型默认值说明
Cad BuilderCad Builder—
局部Transform—
所属发行版
元编程(教育版)元编程(专业版)
可用的图种类
事件 例程 状态机状态
声明于
CAD 构建器
所属包
计算机辅助设计

调整尺寸块

函数

Adds what a block builds, scaled about the origin to a size: OpenSCAD's resize([x, y, z], auto) { ... }.

签名
调整尺寸块
    Cad Builder: Cad Builder
    X 尺寸: 数字
    Y 尺寸: 数字
    Z 尺寸: 数字
    自动: 真否
    子块: Action<Cad Builder>
void Resize(
    CadBuilder Cad Builder,
    double x,
    double y,
    double z,
    bool auto,
    Action<CadBuilder> children)

参数

名称类型默认值说明
Cad BuilderCad Builder—
X 尺寸数字—The new size along X; zero to leave it.
Y 尺寸数字—The new size along Y; zero to leave it.
Z 尺寸数字—The new size along Z; zero to leave it.
自动真否—Scale the directions given zero with the others.
子块Action<Cad Builder>—The block, given a session of its own.
所属发行版
元编程(教育版)元编程(专业版)
可用的图种类
事件 例程 状态机状态
声明于
CAD 构建器
所属包
计算机辅助设计

按 XYZ 旋转块

函数

重载 1/2

签名
按 XYZ 旋转块
    Cad Builder: Cad Builder
    绕 X: 数字
    绕 Y: 数字
    绕 Z: 数字
    子块: Action<Cad Builder>
void Rotate(
    CadBuilder Cad Builder,
    double x,
    double y,
    double z,
    Action<CadBuilder> children)

Adds what a block builds, turned about the X, Y and Z axes in that order: OpenSCAD's rotate([x, y, z]) { ... }, in radians.

参数

名称类型默认值说明
Cad BuilderCad Builder—
绕 X数字—The turn about X, first.
绕 Y数字—The turn about Y, second.
绕 Z数字—The turn about Z, last.
子块Action<Cad Builder>—The block, given a session of its own.

重载 2/2

签名
绕轴旋转块
    Cad Builder: Cad Builder
    角度: 数字
    轴: Vector3d
    子块: Action<Cad Builder>
void Rotate(
    CadBuilder Cad Builder,
    double angle,
    Vector3d axis,
    Action<CadBuilder> children)

Adds what a block builds, turned about an axis through the origin: OpenSCAD's rotate(a, [x, y, z]) { ... }, in radians.

参数

名称类型默认值说明
Cad BuilderCad Builder—
角度数字—How far, in radians, right-handed about the axis.
轴Vector3d—The axis's direction.
子块Action<Cad Builder>—The block, given a session of its own.
所属发行版
元编程(教育版)元编程(专业版)
可用的图种类
事件 例程 状态机状态
声明于
CAD 构建器
所属包
计算机辅助设计

旋转拉伸块

函数

Adds a flat shape a block draws, turned about the Z axis: OpenSCAD's rotate_extrude(angle) { ... } (Cad.RotateExtrude; the angle is in radians).

签名
旋转拉伸块
    Cad Builder: Cad Builder
    角度: 数字
    二维子块: Action<Cad Shape Builder>
void RotateExtrude(
    CadBuilder Cad Builder,
    double angle,
    Action<CadShapeBuilder> children)

参数

名称类型默认值说明
Cad BuilderCad Builder—
角度数字—How far round, in radians.
二维子块Action<Cad Shape Builder>—The block, drawing in a flat session of its own.
所属发行版
元编程(教育版)元编程(专业版)
可用的图种类
事件 例程 状态机状态
声明于
CAD 构建器
所属包
计算机辅助设计

缩放块

函数

Adds what a block builds, scaled about the origin: OpenSCAD's scale([x, y, z]) { ... }.

签名
缩放块
    Cad Builder: Cad Builder
    X 向: 数字
    Y 向: 数字
    Z 向: 数字
    子块: Action<Cad Builder>
void Scale(
    CadBuilder Cad Builder,
    double x,
    double y,
    double z,
    Action<CadBuilder> children)

参数

名称类型默认值说明
Cad BuilderCad Builder—
X 向数字—The factor along X.
Y 向数字—The factor along Y.
Z 向数字—The factor along Z.
子块Action<Cad Builder>—The block, given a session of its own.
所属发行版
元编程(教育版)元编程(专业版)
可用的图种类
事件 例程 状态机状态
声明于
CAD 构建器
所属包
计算机辅助设计

设置

函数

Replaces the current model on success. Ignores placement; useful for fillets, shells, undo and restoring snapshots.

签名
设置(Cad Builder: Cad Builder, 模型: Cad Model)
void Set(CadBuilder Cad Builder, CadModel model)

参数

名称类型默认值说明
Cad BuilderCad Builder—
模型Cad Model—
所属发行版
元编程(教育版)元编程(专业版)
可用的图种类
事件 例程 状态机状态
声明于
CAD 构建器
所属包
计算机辅助设计

变换当前模型

函数

Transforms all current geometry; does not change the placement used for subsequent additions.

签名
变换当前模型(Cad Builder: Cad Builder, 变换: Transform)
void TransformCurrent(
    CadBuilder Cad Builder,
    Transform transform)

参数

名称类型默认值说明
Cad BuilderCad Builder—
变换Transform—
所属发行版
元编程(教育版)元编程(专业版)
可用的图种类
事件 例程 状态机状态
声明于
CAD 构建器
所属包
计算机辅助设计

平移块

函数

Adds what a block builds, moved: OpenSCAD's translate([x, y, z]) { ... }. The block's children are one child here.

签名
平移块
    Cad Builder: Cad Builder
    X: 数字
    Y: 数字
    Z: 数字
    子块: Action<Cad Builder>
void Translate(
    CadBuilder Cad Builder,
    double x,
    double y,
    double z,
    Action<CadBuilder> children)

参数

名称类型默认值说明
Cad BuilderCad Builder—
X数字—How far along X.
Y数字—How far along Y.
Z数字—How far along Z.
子块Action<Cad Builder>—The block, given a session of its own.
所属发行版
元编程(教育版)元编程(专业版)
可用的图种类
事件 例程 状态机状态
声明于
CAD 构建器
所属包
计算机辅助设计

尝试设置

函数

Attempts to replace Current without throwing for a geometric failure. Argument errors still throw. No state changes on failure.

签名
尝试设置 -> Cad Evaluation
    Cad Builder: Cad Builder
    模型: Cad Model
CadEvaluation TrySet(CadBuilder Cad Builder, CadModel model)

参数

名称类型默认值说明
Cad BuilderCad Builder—
模型Cad Model—

返回

结果Cad Evaluation
所属发行版
元编程(教育版)元编程(专业版)
可用的图种类
事件 例程 状态机状态
声明于
CAD 构建器
所属包
计算机辅助设计

并集组

函数

Runs a nested construction in an independent session, then unions the completed model as one atomic edit. Exceptions leave the parent unchanged.

签名
并集组(Cad Builder: Cad Builder, 操作: Action<Cad Builder>)
void UnionGroup(
    CadBuilder Cad Builder,
    Action<CadBuilder> action)

参数

名称类型默认值说明
Cad BuilderCad Builder—
操作Action<Cad Builder>—
所属发行版
元编程(教育版)元编程(专业版)
可用的图种类
事件 例程 状态机状态
声明于
CAD 构建器
所属包
计算机辅助设计

应用变换

函数

Executes a placement scope and restores placement even if the action throws. Successful individual edits remain committed, each a child of this session.

签名
应用变换
    Cad Builder: Cad Builder
    局部: Transform
    操作: Action<Cad Builder>
void WithTransform(
    CadBuilder Cad Builder,
    Transform local,
    Action<CadBuilder> action)

参数

名称类型默认值说明
Cad BuilderCad Builder—
局部Transform—
操作Action<Cad Builder>—
所属发行版
元编程(教育版)元编程(专业版)
可用的图种类
事件 例程 状态机状态
声明于
CAD 构建器
所属包
计算机辅助设计

开始

函数

Creates an empty session from a graph node.

签名
开始(容差: 数字) -> Cad Builder
CadBuilder Begin(double tolerance = 1E-06)

参数

名称类型默认值说明
容差数字1E-06

返回

结果Cad Builder
所属发行版
元编程(教育版)元编程(专业版)
可用的图种类
事件 例程 状态机状态
声明于
CAD 构建器
所属包
计算机辅助设计