几何创建 Geometry Creation · 18 个函数
从初始地块生成体块:拉伸、包络、屋顶、基础图元等
envelope(direction, maxHeight, frontBaseHeight, frontAngle, backBaseHeight, backAngle)
envelope(direction, maxHeight, frontBaseHeight, frontAngle, backBaseHeight, backAngle, sideBaseHeight, sideAngle)
envelope(direction, maxHeight, frontBaseHeight, frontAngle, backBaseHeight, backAngle, rightBaseHeight, rightAngle, leftBaseHeight, leftAngle)
envelope(direction, maxHeight, baseHeights, angles)
| 参数 | 类型 | 说明 |
|---|---|---|
| direction | selector | { normal | world.up }—Direction along which the envelope is erected. |
| maxHeight | float | Maximum height of the envelope in meters. If this height is reached, the volume is cut and sealed horizontally. |
| frontBaseHeight | float | Base height of the front sides in meters. |
| frontAngle | float | Slope angle of front sides in degrees. |
| backBaseHeight | float | Base height of the back sides in meters. |
| backAngle | float | Slope angle of back sides in degrees. |
| sideBaseHeight | float | Base height of both the right and left sides in meters. |
| sideAngle | float | Slope angle of both the right and left sides in degrees. |
| rightBaseHeight | float | Base height of the right sides in meters. |
| rightAngle | float | Slope angle of right sides in degrees. |
| leftBaseHeight | float | Base height of the left sides in meters. |
| leftAngle | float | Slope angle of the left sides in degrees. |
| baseHeights | float[] | Base heights, one value per edge. |
| angles | float[] | Slope angles, one value per edge. |
The envelope operation creates a building envelope above each face of the current shape's geometry. Each edge of the face is classified according to the street.front, street.back, street.right, street.left, street.side selectors. Sides with the according baseHeights are then built perpendicular to the face. Finally, sloped planes are added at the top of each side, with the according slope angle. Evaluation of the street.xxx selectors is based on the streetWidth attribute, see Auto-generated street width attributes. If the attribute is not available, component selection falls back to the object.xxx selectors.
Per edge control
One version of envelope allows for specification of baseHeights and angles per edge via arrays. The array must be in face-edge order, i.e. the first element is for the first edge of the first face, the second element is for the second edge of the first face, and so on. Shared edges are considered separately for each face. If the array does not contain enough elements, default values (0 for baseHeight and 90 degrees for the angle) are used. This allows to e.g. write
envelope(direction, maxHeight, frontBaseHeight, frontAngle, backBaseHeight, backAngle)as
envelope(direction, maxHeight,
comp(fe) { street.front = frontBaseHeight | street.back = backBaseHeight },
comp(fe) { street.front = frontAngle | street.back = backAngle | all = 90 })envelope() operation parameters. The baseHeight and angle parameters of the other sides are analogue.street.front, street.back, street.right, street.left, street.side selectors are applied on a lot of a block (with auto-generated streetWidth attributes).Component tags
The operation automatically applies semantic component tags to the resulting face components:
| Blue: original face. Yellow: vertical base faces. Orange: sloped faces. Red: side faces from holes. Green: top face at max height. |
For more information on working with component tags, refer to:
官方示例 · 点击展开
Lot-->
setback(10) { street.front : color(0,1,0)
FrontYard |
remainder : Building }
Building-->
envelope(normal, 50, 15, 30)我方已验证示例:envelope(verified_gold)· 点击展开代码 · 在 demo 中运行 →
@StartRule Lot --> primitiveQuad(7, 15) extrude(4) envelope(45) color(0.7, 0.8, 0.9)
extrude(extrusionType, distance)
| 参数 | 类型 | 说明 |
|---|---|---|
| distance | float | How many units to extrude. |
The extrude operation extrudes the shape. Each face polygon of all meshes in the geometry asset is taken and extruded along the face normal or a given direction as specified by the extrusion type. The scope orientation is set in the following way:
- x-axis direction is kept as much as possible (old x-axis is projected to the plane orthogonal to extrusion direction).
- y-axis along the extrusion direction.
- z-axis normal to the two above.
The scope's sizes are adjusted to tightly fit the extruded geometry. If distance is negative, the scope.sy attribute will be negative.
Texture coordinates are inherited from the shape.
Note:
Edges can also be extruded, e.g., when working on shapes created fromcomp(e|fe)
. See
examples.
Component tags
The operation automatically applies semantic component tags to the resulting face components:
| Blue: original face. Yellow: side faces. Red: side faces from holes. Green: extruded face. |
For more information on working with component tags, refer to:
官方示例(共 11 个,展示前 3 个) · 点击展开
Lot --> extrude(10)
Lot --> extrude(face.normal,10)
Lot --> extrude(vertex.normal,10)
我方已验证示例:基础挤出 + 颜色(verified_gold)· 点击展开代码 · 在 demo 中运行 →
@Range(min=0, max=20, step=0.5)
attr height = 10
attr roofColor = "#333333"
@StartRule
Lot -->
primitiveQuad(7, 15)
extrude(height)
color(1,0.5,0.2)
comp(f){side:Facade|top:Roof}
Facade --> split(y) { ~1 : Floor }*
Floor --> color(0.7,0.75,0.8)
Roof --> roofHip(30) color(roofColor)
The footprint operation creates a 2D geometry that is the orthogonal projection of the current shape's geometry onto the plane scope.y=0.
官方示例 · 点击展开
Example -->
i("building.obj")
ShowAsset.
Footprint(scope.sy)
Footprint(height) -->
footprint()
extrude(height)
set(material.opacity, 0.25)我方已验证示例:learning case #125(verified_silver)· 点击展开代码 · 在 demo 中运行 →
/* footprint operation example */
Lot -->
extrude(10)
footprint()
color("#ffff00")
i(filePath, upAxisOfGeometry)
i(filePath, upAxisOfGeometry, insertMode)
i(filePath, upAxisOfGeometry, insertMode, cleanupMode)
| 参数 | 类型 | 说明 |
|---|---|---|
| filePath | string | Name of the geometry asset to insert. See Asset and texture search for information about search locations. |
The i operation reads a geometry asset (3D model, polygon mesh) from a file and inserts it into the scope of the current shape. The asset is transformed such that its bounding box coincides with the scope.
If one or more of the scope's sizes sx, sy and sz (i.e. width, height or depth) are zero the scope is modified as follows:
- If all three sizes of the scope are zero, such a point-like scope serves as origin for the asset to be inserted. Therefore, the size vector of the scope is set to the sizes of the asset’s bounding box i.e.
scope.sx= asset.sx,scope.sy= asset.sy andscope.sz= asset.sz. Similarly, thescopeis translated with the values from the asset, i.e.scope.tx+= asset.tx ,scope.ty+= asset.ty andscope.tz+= asset.tz. As a consequence, the inserted asset has not been modified and its original dimensions are completely preserved. - If two sizes are zero, such a line-like scope is modified relative to the non-zero size. For example, if only the height (
scope.sy) is non-zero, the following scaling value is calculated: scalexz =scope.sy/asset.sy. The size modifications are then:scope.sx= scalexz*asset.sx andscope.sz= scalexz*asset.sz. Accordingly, the position of the scope is modified for the two corresponding axes withscope.tx+=scalexz*asset.tx andscope.tz+= scalexz*asset.tz. Thus the inserted asset is uniformly scaled i.e. the proportions of the asset are completely preserved. - If one of the sizes is zero, the scope's size is modified relative to the average of the two non-zero sizes. For example, if the depth (
scope.sz) is zero, the following calculation is performed:scope.sz= (scope.sx/asset.sx +scope.sy/asset.sy)*0.5*asset.sz. Note that the position of thescopeis not modified.
Note:
- If the current shape has trim planes (generated in a component split), the model is cut with the trim planes. Trim planes can be enabled and disabled by the trim attribute. Use the geometry.isInstanced function to check if an inserted asset was trimmed. See example below.
- A collection of basic geometries are available as built-in assets.
官方示例(共 7 个,展示前 3 个) · 点击展开
Lot-->
extrude(47)
comp(f) { side : Facade
| top : X }
Facade-->
split(y) { { ~1 : X
| ~8 : Floor }*
| ~1 : X }
Floor-->
split(x) { { ~1 : X
| ~5 : Window }*
| ~1 : X }Window-->
i("window.obj")Head-->
s(0,0,0)
i("beethoven.obj")我方已验证示例:learning case #78(verified_silver)· 点击展开代码 · 示例过大,请复制源码到 demo 运行
/** * File: Fence_On_Graph.cga * Created: 18 Nov 2015 17:11:40 GMT * Author: Esri R&D Center Zurich */ /* Input shape: street shape (shape with UVs), street width >= base_depth Fences are created along the u direction of the street shape. Notes on Occlusion: * Occlusion Labels: The fence parts (post, middle, base post, base middle, upper post, upper middle) are each labeled with the given occlusionLabel. These labeled parts are meant to be occluders which can be found when te…
insertAlongUV(uvSet, filePath, height, heightDirection, heightAlignment)
| 参数 | 类型 | 说明 |
|---|---|---|
| uvSet | float | Number of texture coordinates set (integer number in [0,9]). The numbering corresponds to the texture layers of the material attribute, see also Texturing: Essential knowledge. |
| filePath | string | File path of the geometry asset to insert. See Asset Search for information about search locations. The remarks about supported asset formats for the insert operation also apply here. |
| height | float | The height of the inserted geometry in the world coordinate system. |
The
| |
The asset is cut and bent to a new geometry that fits into the uv space of the initial shape. On a shape with a uv-set assigned, use split and texturing operations such as normalizeUV, rotateUV, and scaleUV to setup the uvs according to your needs. |
Note:
The asset is only mapped onto triangles and quads of the current shape.
Considerations
- The new geometry does not inherit the vertex normals of the asset. You can recompute vertex normals using setNormals or softenNormals.
- The asset is cut in order to fit it onto the uv space. This creates coplanar edges and collinear vertices which can be removed using cleanupGeometry.
- Unlike the insert operation, the creation of a new geometry breaks instancing. Furthermore, trimming is not applied automatically.
官方示例(共 7 个,展示前 3 个) · 点击展开
const width = assetInfo("barrier.obj", sx)
const height = assetInfo("barrier.obj", sy)
Street --> split(v, unitSpace, 0) {
width : InsertBarrier |
~1 : Street. |
width : InsertBarrier |
~1 : Street. |
width : InsertBarrier }
InsertBarrier -->
rotateUV(0, 90)
normalizeUV(0, u, collectiveAllFaces)
insertAlongUV(0, "barrier.obj", height)const width = assetInfo("barrier.obj", sz)
InsertBarrier -->
normalizeUV(0, u, collectiveAllFaces)
insertAlongUV(0, "barrier.obj", height)const width = assetInfo("guardrail.obj", sx)
const height = assetInfo("guardrail.obj", sy)
const depth = assetInfo("guardrail.obj", sz)
Street -->
alignScopeToAxes(y)
split(v, unitSpace, 0) { depth : rotateUV(0, 180)
InsertGuardrail
| ~1 : NIL
| depth : InsertGuardrail }
InsertGuardrail -->
normalizeUV(0, v, collectiveAllFaces)
tileUV(0, ~width, 0)
insertAlongUV(0, "guardrail.obj", height)我方已验证示例:learning case #78(verified_silver)· 点击展开代码 · 示例过大,请复制源码到 demo 运行
/** * File: Fence_On_Graph.cga * Created: 18 Nov 2015 17:11:40 GMT * Author: Esri R&D Center Zurich */ /* Input shape: street shape (shape with UVs), street width >= base_depth Fences are created along the u direction of the street shape. Notes on Occlusion: * Occlusion Labels: The fence parts (post, middle, base post, base middle, upper post, upper middle) are each labeled with the given occlusionLabel. These labeled parts are meant to be occluders which can be found when te…
offset(distance, keepFaces)
| 参数 | 类型 | 说明 |
|---|---|---|
| distance | float | The offset distance, negative or positive. |
| keepFaces | selector | { all | inside | border }—Selects which faces to keep. all is default. |
The offset operation constructs offset polygons at distance distance for each face of the current shape's geometry. Depending on the sign of the parameter, offset polygons are constructed in the interior (negative sign) or in the exterior (positive sign), respectively.
Note:
The resulting shape contains both the offset polygons and the border faces (that is the difference between the original faces and the offset polygons). If only the offset polygons are needed, the corresponding faces can simply be extracted by using a component split (see examples below). Alternatively, an offset selector can be supplied as a second parameter.
Scope
The scope's size is adapted to the new geometry.
Occluder shape
In case an offset selector is applied an occluder shape is automatically generated before the offset is applied. The occluder shape is made available for unlabeled occlusion queries.
Compontent tags
The operation propagates existing component tags to the resulting geometry. See the section about tag propagation for more information on working with component tags.
官方示例 · 点击展开
attr blue = "#3957A5"
attr yellow = "#F2BB1D"
Lot --> offset(-3) A
A --> comp(f) { inside: I | border: O }
I --> color(blue)
O --> color(yellow)我方已验证示例:offset(verified_gold)· 点击展开代码 · 在 demo 中运行 →
@StartRule Lot --> primitiveQuad(7, 15) extrude(0.2) offset(-1) color(0.8, 0.8, 0.9)
primitiveCone(sides)
primitiveCone(sides, radius, height)
| 参数 | 类型 | 说明 |
|---|---|---|
| sides | float | Number of subdivisions of the cone surface. There must be at least 3 sides. The default value is 16. |
| radius | float | Radius of the cone. |
| height | float | Height of the cone. |
The primitiveCone operation inserts a cone geometry into the scope of the current shape.
- If no
radiusandheightare given the bounding box coincides with the scope. Zero scope sizes are handled the same way as in the i operation. - If dimensions are specified the cone is positioned in the xz-center of the scope lying on y=0.
The cone has texture coordinates on the first texture layer (COLORMAP).
官方示例 · 点击展开
Lot-->
primitiveCone()
texture("builtin:uvtest.png")Lot-->
primitiveCone(8,10,15 )
texture("builtin:uvtest.png")我方已验证示例:primitiveCone(verified_gold)· 点击展开代码 · 在 demo 中运行 →
@StartRule Lot --> primitiveCone(16, 2, 5) color(0.9, 0.7, 0.4)
primitiveCube(width, height, depth)
| 参数 | 类型 | 说明 |
|---|---|---|
| width | float | Width of the cube. |
| height | float | Height of the cube. |
| depth | float | Depth of the cube. |
The primitiveCube operation inserts a cube geometry into the scope of the current shape.
- If no
width,heightanddepthare given the bounding box coincides with the scope. Zero scope sizes are handled the same way as in the i operation. - If dimensions are specified the cube is positioned in the xz-center of the scope lying on y=0.
The cube has texture coordinates on the first texture layer (COLORMAP).
官方示例 · 点击展开
Lot-->
primitiveCube()
texture("builtin:uvtest.png")Lot-->
primitiveCube(10,15,20)
texture("builtin:uvtest.png")我方已验证示例:primitiveCube(verified_gold)· 点击展开代码 · 在 demo 中运行 →
@StartRule Lot --> primitiveCube(4, 3, 2) color(0.6, 0.7, 0.8)
primitiveCylinder(sides)
primitiveCylinder(sides, radius, height)
| 参数 | 类型 | 说明 |
|---|---|---|
| sides | float | Number of subdivisions of the cylindrical surface. There must be at least 3 sides. The default value is 16. |
| radius | float | Radius of the cylinder. |
| height | float | Height of the cylinder. |
The primitiveCylinder operation inserts a cylinder geometry into the scope of the current shape.
- If
radiusandheightaren't given the bounding box coincides with the scope. Zero scope sizes are handled the same way as in theioperation. - If dimensions are specified the cylinder is positioned in the xz-center of the scope lying on y=0.
The cylinder has texture coordinates on the first texture layer (COLORMAP).
官方示例 · 点击展开
Lot-->
primitiveCylinder()
texture("builtin:uvtest.png")Lot-->
primitiveCylinder(8,10,15)
texture("builtin:uvtest.png")我方已验证示例:primitiveCylinder(verified_gold)· 点击展开代码 · 在 demo 中运行 →
@StartRule Lot --> primitiveCylinder(16, 1.5, 4) color(0.7, 0.7, 0.8)
primitiveDisk(nVertices)
primitiveDisk(nVertices, radius)
| 参数 | 类型 | 说明 |
|---|---|---|
| nVertices | float | Number of vertices at the boundary of the disk. There must be at least 3 vertices. The default value is 16. |
| radius | float | Radius of the disk. |
The primitiveDisk operation inserts a disk geometry into the scope of the current shape.
- If the
radiusisn't given the bounding box coincides with the scope. Zero scope sizes are handled the same way as in the i operation. - If
radiusis specified the disk is positioned in the xz-center of the scope lying on y=0.
If one scope size is zero while the 2 other sizes are not zero the disk will be inserted with respect to the plane defined by the valued scope sizes.
The disk has texture coordinates on the first texture layer (COLORMAP).
官方示例 · 点击展开
Lot-->
rotateScope(-90, 0, 0) // scope.sz is 0
primitiveDisk()
texture("builtin:uvtest.png")Lot-->
rotateScope(-90, 0, 0) // scope.sz is 0
primitiveDisk(8,10)
texture("builtin:uvtest.png")我方已验证示例:learning case #168(verified_silver)· 点击展开代码 · 在 demo 中运行 →
version "2023.1"
attr baseHeight = 1.5
attr hallHeight = 7
attr domeHeight = 5
attr minaretHeight = 12
@StartRule
Lot -->
extrude(baseHeight)
color("#F5F5DC")
primitiveCube()
Courtyard
Courtyard -->
split(x) { ~3 : PrayerHall | ~1 : Minaret }
PrayerHall -->
color("#FFF8DC")
extrude(hallHeight)
primitiveCube()
Dome
Dome -->
color("#48D1CC")
primitiveSphere(2.5)
Lantern
Lantern -->
color("#FFD700")
primitiveCylinder(6, 0.2, 1)
Minaret -->
color("#F5F5DC")
extrude(minaretHeig…
primitiveQuad(width, length)
| 参数 | 类型 | 说明 |
|---|---|---|
| width | float | Width of the quad. |
| length | float | Length of the quad. |
The primitiveQuad operation inserts a quad geometry into the scope of the current shape.
- If
widthandlengtharen't given the bounding box coincides with the scope. Zero scope sizes are handled the same way as in theioperation. - If dimensions are specified the quad is positioned in the xz-center of the scope lying on y=0.
If one scope size is zero while the 2 other sizes are not zero the quad will be inserted with respect to the plane defined by the valued scope sizes.
The quad has texture coordinates on the first texture layer (COLORMAP).
官方示例 · 点击展开
Lot-->
rotateScope(0, 0, 90) // scope.sx is 0
primitiveQuad()
texture("builtin:uvtest.png")Lot-->
rotateScope(0, 0, 90) // scope.sx is 0
primitiveQuad(10,20)
texture("builtin:uvtest.png")我方已验证示例:基础挤出 + 颜色(verified_gold)· 点击展开代码 · 在 demo 中运行 →
@Range(min=0, max=20, step=0.5)
attr height = 10
attr roofColor = "#333333"
@StartRule
Lot -->
primitiveQuad(7, 15)
extrude(height)
color(1,0.5,0.2)
comp(f){side:Facade|top:Roof}
Facade --> split(y) { ~1 : Floor }*
Floor --> color(0.7,0.75,0.8)
Roof --> roofHip(30) color(roofColor)
primitiveSphere(sides, divisions)
primitiveSphere(sides, divisions, radius)
| 参数 | 类型 | 说明 |
|---|---|---|
| sides | float | Number of subdivisions along latitude of the sphere. There must be at least 3 sides. The default value is 16. |
| divisions | float | Number of subdivisions along longitude of the sphere. There must be at least 3 sides. The default value is 16. |
| radius | float | Radius of the sphere. |
The primitiveSphere operation inserts a sphere geometry into the scope of the current shape.
- If
radiusisn't given the bounding box coincides with the scope. Zero scope sizes are handled the same way as in theioperation. - If
radiusis specified the sphere is positioned in the xz-center of the scope lying on y=0.
The sphere has texture coordinates on the first texture layer (COLORMAP).
官方示例 · 点击展开
Lot-->
primitiveSphere()
texture("builtin:uvtest.png")Lot-->
primitiveSphere(8,4,10)
texture("builtin:uvtest.png")我方已验证示例:基础体:球 / 圆柱(verified_gold)· 点击展开代码 · 在 demo 中运行 →
@StartRule Lot --> primitiveSphere(2) Sphere Lot2 --> primitiveCylinder(1,3) Cyl Sphere --> t(-3,1.5,0) color(0.8,0.3,0.3) Cyl --> t(3,1.5,0) color(0.3,0.5,0.8)
roofGable(angle, overhangX)
roofGable(angle, overhangX, overhangY)
roofGable(angle, overhangX, overhangY, even)
roofGable(angle, overhangX, overhangY, even, index)
roofGable(valueType, value)
roofGable(valueType, value, overhangX)
roofGable(valueType, value, overhangX, overhangY)
roofGable(valueType, value, overhangX, overhangY, even)
| 参数 | 类型 | 说明 |
|---|---|---|
| angle | float | Angle of the roof-planes (generation byAngle). |
| overhangX | float | Overhang distance for overhangs perpendicular to ridges, measured perpendicular to the shape edges (on the roof). |
| overhangY | float | Overhang distance for overhangs in the direction of the ridges, measured perpendicular to the shape edges (on the roof). |
| even | bool | Whether to make the roof gable even or not. If true, non-planar faces can originate. |
| index | float | Edge index to control the orientation of the ridge. |
| valueType | selector | { byAngle | byHeight }—Type of roof generation. |
| value | float | Angle or height of the roof-planes as specified by valueType. |
The roofGable operation builds a gable roof perpendicular to
each face of the current shape's geometry. The orientation of the
ridges is automatically computed (except in the indexed case). At
all non-ridge (eave) edges, a plane is generated with a given angle
or height wrt. the polygon plane. The planes are cut with each
other to form the roof faces:
- If
overhangXis set, the roof faces overlap along the eave edges by this distance. Overhang distances are measured perpendicular to the edges (on the roof planes). - If
overhangYis set, the roof faces overlap in the direction of the ridges by this distance. Overhang distances are measured perpendicular to the shape edges (on the roof planes). - If
evenis set totrue, the gable edges are forced to be horizontal. In this case, non-planar roof faces can originate. - If
indexis set, the ridge is forced to be oriented in the direction of the edge index.Caution:
This only works on convex shapes with a single face. The
evenparameter is neglected.
Note:
The connectivity of the roof mesh is optimized for trim plane generation to cut bricks inserted into the roof planes (see examples below).
Scope
The scope orientation is set in the following way:
- x-axis direction is kept as much as possible (old x-axis is projected to the plane of the first face).
- y-axis along the face normal of the first face.
- z-axis normal to the two above.
The scope's sizes are adjusted to tightly fit the extruded geometry.
Component tags
The operation automatically applies semantic component tags to the resulting face components:
| Blue: original face. Yellow: pediment faces. Green: roof faces. |
For more information on working with component tags, refer to:
官方示例(共 4 个,展示前 3 个) · 点击展开
Lot -->
extrude(10) Mass
Mass -->
comp(f) { top : Top
| all : X }
Top -->
roofGable(30, 2, 1) RoofRoof -->
set(trim.horizontal, true)
comp(f) { all : X }Lot -->
extrude(10) Mass
Mass -->
comp(f) { top : Top
| all : X }
Top -->
roofGable(30, 1, 1, false) Roof我方已验证示例:roofGable(verified_gold)· 点击展开代码 · 在 demo 中运行 →
@StartRule
Lot -->
primitiveQuad(7, 15)
extrude(5)
comp(f) { top: Roof | side: Wall }
Roof --> roofGable(35) color(0.6, 0.3, 0.2)
Wall --> color(0.75, 0.72, 0.68)
roofHip(angle, overhang)
roofHip(angle, overhang, even)
roofHip(valueType, value)
roofHip(valueType, value, overhang)
roofHip(valueType, value, overhang, even)
| 参数 | 类型 | 说明 |
|---|---|---|
| angle | float | Angle of the roof-planes generation (byAngle). |
| overhang | float | Overhang distance for overhangs perpendicular to ridges, measured perpendicular to the shape edges (on the roof). |
| even | bool | Whether to make the roof hip even or not. If true, non-planar faces originate. |
| valueType | selector | { byAngle | byHeight }—Type of roof generation. |
| value | float | Angle or height of the roof-planes as specified by valueType. |
The roofHip operation builds a hip roof perpendicular to
each face of the current shape's geometry. At every edge, a plane is generated with a given angle or height
wrt. the polygon plane. All planes are cut with each other to form
the roof faces.
If overhang is set, the roof faces overlap the original shape by this distance.
Overhang distances are measured perpendicular to the shape edges
(on the roof planes).
If even is set to true, the
hip edges are forced to be horizontal. In this case, non-planar
roof faces originate.
Note:
The connectivity of the roof mesh is optimized for trim plane generation to cut bricks inserted into the roof planes (see examples below).
Scope
The scope orientation is set in the following way:
- x-axis direction is kept as much as possible (old x-axis is projected to the plane of the first face).
- y-axis along the face normal of the first face.
- z-axis normal to the two above.
The scope's sizes are adjusted to tightly fit the extruded geometry.
Component tags
The operation automatically applies semantic component tags to the resulting face components:
| Blue: original face. Green: roof faces. |
For more information on working with component tags, refer to:
官方示例(共 4 个,展示前 3 个) · 点击展开
Lot -->
extrude(10) Mass
Mass -->
comp(f) { top : Top
| all : X }
Top -->
roofHip(30, 2) RoofRoof -->
set(trim.horizontal, true)
comp(f) { all : X }Lot -->
extrude(10) Mass
Mass -->
comp(f) { top : Top
| all : X }
Top -->
roofHip(45, 1, false) Roof我方已验证示例:基础挤出 + 颜色(verified_gold)· 点击展开代码 · 在 demo 中运行 →
@Range(min=0, max=20, step=0.5)
attr height = 10
attr roofColor = "#333333"
@StartRule
Lot -->
primitiveQuad(7, 15)
extrude(height)
color(1,0.5,0.2)
comp(f){side:Facade|top:Roof}
Facade --> split(y) { ~1 : Floor }*
Floor --> color(0.7,0.75,0.8)
Roof --> roofHip(30) color(roofColor)
roofPyramid(valueType, value)
| 参数 | 类型 | 说明 |
|---|---|---|
| angle | float | Angle of the roof-planes generation (byAngle). |
| valueType | selector | { byAngle | byHeight }—Type of roof generation. |
| value | float | Angle or height of the roof-planes as specified by valueType. |
The roofPyramid operation builds a pyramid roof perpendicular to each face of the current
shape's geometry. The polygon center (average of all vertices) gets
extruded along the face normal by the given height and connected to
all polygon vertices. The new triangles are the roof faces. If an
angle is given the height is chosen such that the angle between
roof triangle 1 and the polygon is as specified.
Note:
The connectivity of the roof mesh is optimized for trim plane generation to cut bricks inserted into the roof planes (see examples below).
Scope
The scope orientation is set in the following way:
- x-axis direction is kept as much as possible (old x-axis is projected to the plane of the first face).
- y-axis along the face normal of the first face.
- z-axis normal to the two above.
The scope's sizes are adjusted to tightly fit the extruded geometry.
Component tags
The operation automatically applies semantic component tags to the resulting face components:
| Blue: original face. Green: roof faces. |
For more information on working with component tags, refer to:
官方示例 · 点击展开
Lot -->
extrude(10) Mass
Mass -->
comp(f) { top : Top
| all : X }
Top -->
roofPyramid(30) RoofRoof -->
comp(f) { all : X }我方已验证示例:roofPyramid(verified_gold)· 点击展开代码 · 在 demo 中运行 →
@StartRule
Lot -->
primitiveQuad(7, 15)
extrude(5)
comp(f) { top: Roof | side: Wall }
Roof --> roofPyramid(45) color(0.6, 0.3, 0.2)
Wall --> color(0.75, 0.72, 0.68)
| 参数 | 类型 | 说明 |
|---|---|---|
| valueType | selector | { byAngle | byHeight }—Type of roof generation. |
| value | float | Angle or height of the roof-planes as specified by valueType. |
The roofRidge operation builds a roof perpendicular to each face of the current shape's geometry. In contrast to the roofHip operation and the roofGable operation only one ridge is constructed. On arbitrary shapes no hips or gables are created but the shape outline becomes part of two angled roof planes.
The ridge is oriented wrt. the x-axis of the scope. Namely, the resulting ridge is parallel to the scope's x-axis projected to the face plane. To orient the ridge align the scope using operations like alignScopeToGeometry, alignScopeToGeometryBBox or rotateScope.
Note:
The connectivity of the roof mesh is optimized for trim plane generation to cut bricks inserted into the roof planes (see examples below).
Scope
The scope orientation is set in the following way:
- x-axis direction is kept as much as possible (old x-axis is projected to the plane of the first face).
- y-axis along the face normal of the first face.
- z-axis normal to the two above.
The scope's sizes are adjusted to tightly fit the extruded geometry.
Component tags
The operation automatically applies semantic component tags to the resulting face components:
| Blue: original face. Yellow: side faces. Red: side faces from holes. Green: roof faces. |
For more information on working with component tags, refer to:
官方示例(共 5 个,展示前 3 个) · 点击展开
Lot --> extrude(10) Mass
Mass --> comp(f) { top : Top | side = Sides. }
Top --> roofRidge(byAngle, 30) Roof Roof --> set(trim.horizontal, true)
comp(f) { all : Face. }Lot --> extrude(10) Mass
Mass --> comp(f) { top : Top | side = Sides. }
Top --> alignScopeToGeometryBBox(xy)
roofRidge(byAngle, 30)我方已验证示例:learning case #184(verified_silver)· 点击展开代码 · 在 demo 中运行 →
/* roofRidge operation example */
Lot -->
extrude(8)
roofRidge("height", 4)
color("#cc8844")
roofShed(angle, index)
roofShed(valueType, value)
roofShed(valueType, value, index)
| 参数 | 类型 | 说明 |
|---|---|---|
| angle | float | Angle of the roof-plane generation (byAngle). |
| index | float | Edge index (thus integral value) to specify the orientation of the shed roof. |
| valueType | selector | { byAngle | byHeight }—Type of roof generation. |
| value | float | Angle or height of the roof-planes as specified by valueType. |
The roofShed operation builds a shed roof perpendicular to each face of the current
shape's geometry. At edge
index
(default value 0), a plane is generated with a given angle or
height wrt. the polygon plane.
If index is set, the roof plane is oriented to the specified edge.
Note:
The connectivity of the roof mesh is optimized for trim plane generation to cut bricks inserted into the roof planes (see examples below).
Scope
The scope orientation is set in the following way:
- x-axis direction is kept as much as possible (old x-axis is projected to the plane of the first face).
- y-axis along the face normal of the first face.
- z-axis normal to the two above.
The scope's sizes are adjusted to tightly fit the extruded geometry.
Component tags
The operation automatically applies semantic component tags to the resulting face components:
| Blue: original face. Yellow: side faces. Red: side faces from holes. Green: roof faces. |
For more information on working with component tags, refer to:
官方示例 · 点击展开
Lot -->
extrude(10) Mass
Mass -->
comp(f) { top : Top
| all : X }
Top -->
roofShed(10, 3) RoofRoof -->
comp(f) { all : X }我方已验证示例:learning case #166(verified_silver)· 点击展开代码 · 在 demo 中运行 →
version "2023.1"
attr naveHeight = 10
attr aisleHeight = 6
attr towerHeight = 14
attr spireHeight = 5
@StartRule
Lot -->
split(x) { ~1 : Aisle | ~2 : Nave | ~1 : Aisle }
Nave -->
color("#D3D3D3")
extrude(naveHeight)
primitiveCube()
NaveRoof
NaveRoof -->
color("#696969")
roofGable(naveHeight * 0.3, 0.3, 0.5)
Aisle -->
color("#C0C0C0")
extrude(aisleHeight)
primitiveCube()
AisleRoof
AisleRoof -->
color("#808080")
roofShed(aisleHeight * 0.25, 0.5)
Tower -->
color("#A9A9A9")
ext…
| 参数 | 类型 | 说明 |
|---|---|---|
| height | float | How many units to extrude. |
The taper operation tapers the shape (i.e. forms a pyramid over a polygon). The first polygon of the first mesh in the geometry asset is taken and tapered along the face normal through the polygon's center of gravity. The scope orientation is set in the following way:
- x-axis direction is kept as much as possible (old x-axis is projected to the face plane)
- y-axis along the face normal (taper direction)
- z-axis normal to the two above
The scope's sizes are adjusted to tightly fit the extruded geometry. If height is < 0, the scope.sy attribute will be < 0 and the taper will be downwards.
Component tags
The operation automatically applies semantic component tags to the resulting face components:
" " | Blue: original face. Yellow: side faces. |
For more information on working with component tags, refer to:
官方示例 · 点击展开
Lot--> taper(10)
我方已验证示例:learning case #107(verified_silver)· 点击展开代码 · 在 demo 中运行 →
@Description("CityEngine CGA 几何操作函数示例 - extrude / comp / roof / offset / mirror / normals")
@Group("几何操作")
@Order(32)
// ============================================================
// 几何操作 Geometry Operations
// 演示 extrude, comp, roof*, offset, envelope, mirror, normals 等
// ============================================================
@StartRule
Lot --> OperationShowcase
OperationShowcase -->
split(x) { ~8: ExtrudeDemo
| ~8: RoofHipDemo
| ~8: RoofGableDemo
…