元編程參考文件

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 構建器
所屬包
電腦輔助設計