规则内联与三维布尔 Rule Inlining and Boolean 3D · 4 个函数
体块并 / 交 / 差运算与规则内联
inline subdivision
inline { operations }
inline(geometryMergeStrategy) Rule
inline(geometryMergeStrategy) subdivision
inline(geometryMergeStrategy) { operations }
| 参数 | 类型 | 说明 |
|---|---|---|
| geometryMergeStrategy | selector | |
| Syntax options: | — |
The inline keyword triggers the immediate derivation of the specified rule, subdivision operation, or shape operation sequence. The resulting shapes are then automatically merged into a single shape that replaces the current shape. In case it results in a single shape, it is taken as is. If it results in multiple shapes, their geometries are combined according to the geometryMergeStrategy. By default (if no strategy is specified) the geometries are just appended.
If the inlined shapes have conflicting material attributes, each shape's material is written to the geometry, meaning that all materials are preserved. For other attributes, the value of the current shape is kept if the inlined shapes have conflicting values or if more than one set operation has occurred.
Concept
This is the initial shape. | |
|
Two rules are applied to the initial shape:
This can be observed in the Model Hierarchy where both rules represent the root of a separate shape subtree. The leaf shapes in the full shape tree collectively form the visible model. | |
Inlining Essentially, an inlined rule can be used like a built-in shape operation (e.g., extrude) to directly modify the current shape. The subtree generated by an inlined rule (e.g., |
Geometry merge strategy
The correct geometryMergeStrategy depends on the modeling objective:
appendDefault. Used to simply collect the geometries of multiple shapes and put them into a single mesh. No geometry cleanup is performed and all components are kept as is.
unifyUsed to combine the geometries of intersecting shapes with Boolean operations. Intersecting faces get topologically connected and inner faces are removed.
recomposeUsed to topologically recombine the geometries of subdivided shapes. Shapes are automatically reconnected at shared vertices and edges, see Shape Recomposition. The strategy can be used to recombine shapes created with, for example, the split or comp operations.
官方示例(共 9 个,展示前 3 个) · 点击展开
Init -->
primitiveCube
print("start: " + geometry.nVertices)
inline comp(f) { all: SetColor }
print("inline: " + geometry.nVertices)
rampValue = comp.index/comp.total
SetColor -->
set(material.opacity, 0.9)
color(colorRamp("spectrum", rampValue))Init -->
primitiveCube
print("start: " + geometry.nVertices)
inline(recompose) comp(f) { all: SetColor }
print("inline(recompose): " + geometry.nVertices)Init -->
inline { LayoutA LayoutB }
ChooseLayout
LayoutA --> offset(-15, border) tag("LayoutA")
LayoutB --> split(x) { 15: tag("LayoutB") Lot.
| ~10: NIL }*
taggedArea(name) =
sum(comp(f) { isTagged(name): geometry.area })
ChooseLayout -->
case taggedArea("LayoutA") > taggedArea("LayoutB"):
inline Extract("LayoutA")
Mass
else:
inline Extract("LayoutB")
Mass
Extract(name) -->
comp(f, noAlign) { isTagged(name)= Extract. }
Mass --> extrude(30)我方已验证示例:learning case #70(verified_silver)· 点击展开代码 · 在 demo 中运行 →
/* Set the material. Option to fully or partially override material. Input shape: * any Notes: * Full_Override=true (default): * Override all material attrs. * Full_Override=false: * Only override material attrs defined in selected material file. Do not override any other material attrs. * If a color already exists on the input shape, and the selected material does not have a color but has a colormap, then the existing color will continue to exist. The existing color is multiplied wi…
| 参数 | 类型 | 说明 |
|---|---|---|
| operationsA | — | A sequence of operations applied on the current shape for operand A. |
| operationsB | — | A sequence of operations applied on the current shape for operand B. |
The union, intersect, and subtract operations perform a Boolean operation with the result of the inlined operationsA (operand A) and the result of the inlined operationsB (operand B). The operands are constructed analogous to using inline(unify), i.e. the shapes resulting from the derivation of operationsA (or operationsB) are first merged using a Boolean union operation.
The first operand A determines the resulting shape and rule attributes and specifies which material is used for overlapping geometry. In case the operands have conflicting material attributes, their materials are first written to the geometry, ensuring that all material properties are preserved.
Component tags
The operations automatically apply semantic component tags to the resulting face components:
| Faces from operand A (blue) Faces from operand B (green) Intersection edges (orange) | |
Note:
For overlapping faces (2D intersection) both"bool.A" and "bool.B" are applied.For more information on working with component tags, refer to Auto-tags and Tag propagation.
Open and closed operands
Boolean operations are well defined in 2D (planar planes) and in 3D for closed meshes. In 3D, open operands (planes and meshes with holes) are assumed closed as long as boundaries are not intersected. See the reference table and the example below.
The common use cases of "Plane subtract Volume" and "Plane intersect Volume" are facilitated using the "bool" auto-tags in a subsequent comp operation. This is illustrated in the following example:
| | |
| ||
Reference Table
Both operands closed | Open and closed operand Plane normal pointing up | Open and closed operand Plane normal pointing down | Open and closed operand Only partially intersecting | |
Input operands | ||||
| ||||
| ||||
| ||||
| ||||
| ||||
官方示例(共 16 个,展示前 3 个) · 点击展开
Blue --> color("#0399F5")
Green --> color("#09DE1F")
Yellow --> color("#FADB19")
Purple --> color("#8D09DE")
Red --> color("#FF360A")
Orange --> color("#FA9100")Left --> subtract { Cube | Cylinder }
Right --> subtract { Cylinder | Cube }
Cube --> primitiveCube
Blue
Cylinder --> t(3,3,3)
primitiveCylinder
GreenLeft --> union { Quad | Circle }
Right --> union { Circle | Quad }
Quad --> primitiveQuad
Blue
Circle --> t(3,0,3)
primitiveDisk
Green| 参数 | 类型 | 说明 |
|---|---|---|
| operationsA | — | A sequence of operations applied on the current shape for operand A. |
| operationsB | — | A sequence of operations applied on the current shape for operand B. |
The union, intersect, and subtract operations perform a Boolean operation with the result of the inlined operationsA (operand A) and the result of the inlined operationsB (operand B). The operands are constructed analogous to using inline(unify), i.e. the shapes resulting from the derivation of operationsA (or operationsB) are first merged using a Boolean union operation.
The first operand A determines the resulting shape and rule attributes and specifies which material is used for overlapping geometry. In case the operands have conflicting material attributes, their materials are first written to the geometry, ensuring that all material properties are preserved.
Component tags
The operations automatically apply semantic component tags to the resulting face components:
| Faces from operand A (blue) Faces from operand B (green) Intersection edges (orange) | |
Note:
For overlapping faces (2D intersection) both"bool.A" and "bool.B" are applied.For more information on working with component tags, refer to Auto-tags and Tag propagation.
Open and closed operands
Boolean operations are well defined in 2D (planar planes) and in 3D for closed meshes. In 3D, open operands (planes and meshes with holes) are assumed closed as long as boundaries are not intersected. See the reference table and the example below.
The common use cases of "Plane subtract Volume" and "Plane intersect Volume" are facilitated using the "bool" auto-tags in a subsequent comp operation. This is illustrated in the following example:
| | |
| ||
Reference Table
Both operands closed | Open and closed operand Plane normal pointing up | Open and closed operand Plane normal pointing down | Open and closed operand Only partially intersecting | |
Input operands | ||||
| ||||
| ||||
| ||||
| ||||
| ||||
官方示例(共 16 个,展示前 3 个) · 点击展开
Blue --> color("#0399F5")
Green --> color("#09DE1F")
Yellow --> color("#FADB19")
Purple --> color("#8D09DE")
Red --> color("#FF360A")
Orange --> color("#FA9100")Left --> subtract { Cube | Cylinder }
Right --> subtract { Cylinder | Cube }
Cube --> primitiveCube
Blue
Cylinder --> t(3,3,3)
primitiveCylinder
GreenLeft --> union { Quad | Circle }
Right --> union { Circle | Quad }
Quad --> primitiveQuad
Blue
Circle --> t(3,0,3)
primitiveDisk
Green| 参数 | 类型 | 说明 |
|---|---|---|
| operationsA | — | A sequence of operations applied on the current shape for operand A. |
| operationsB | — | A sequence of operations applied on the current shape for operand B. |
The union, intersect, and subtract operations perform a Boolean operation with the result of the inlined operationsA (operand A) and the result of the inlined operationsB (operand B). The operands are constructed analogous to using inline(unify), i.e. the shapes resulting from the derivation of operationsA (or operationsB) are first merged using a Boolean union operation.
The first operand A determines the resulting shape and rule attributes and specifies which material is used for overlapping geometry. In case the operands have conflicting material attributes, their materials are first written to the geometry, ensuring that all material properties are preserved.
Component tags
The operations automatically apply semantic component tags to the resulting face components:
| Faces from operand A (blue) Faces from operand B (green) Intersection edges (orange) | |
Note:
For overlapping faces (2D intersection) both"bool.A" and "bool.B" are applied.For more information on working with component tags, refer to Auto-tags and Tag propagation.
Open and closed operands
Boolean operations are well defined in 2D (planar planes) and in 3D for closed meshes. In 3D, open operands (planes and meshes with holes) are assumed closed as long as boundaries are not intersected. See the reference table and the example below.
The common use cases of "Plane subtract Volume" and "Plane intersect Volume" are facilitated using the "bool" auto-tags in a subsequent comp operation. This is illustrated in the following example:
| | |
| ||
Reference Table
Both operands closed | Open and closed operand Plane normal pointing up | Open and closed operand Plane normal pointing down | Open and closed operand Only partially intersecting | |
Input operands | ||||
| ||||
| ||||
| ||||
| ||||
| ||||
官方示例(共 16 个,展示前 3 个) · 点击展开
Blue --> color("#0399F5")
Green --> color("#09DE1F")
Yellow --> color("#FADB19")
Purple --> color("#8D09DE")
Red --> color("#FF360A")
Orange --> color("#FA9100")Left --> subtract { Cube | Cylinder }
Right --> subtract { Cylinder | Cube }
Cube --> primitiveCube
Blue
Cylinder --> t(3,3,3)
primitiveCylinder
GreenLeft --> union { Quad | Circle }
Right --> union { Circle | Quad }
Quad --> primitiveQuad
Blue
Circle --> t(3,0,3)
primitiveDisk
Green