Peyep CGA 函数参考几何标注 · 2025.1
版本首页查看 demo →
← 返回 2025.1 分类导航

几何标注 Geometry Tagging · 3 个函数

为几何面打标签 / 删标签,供后续规则按标签筛选

tag native ✓ cpp-fast ✓ 已验证 29 条 · silver 官方文档 ↗ #
为几何打标签,供后续规则筛选
签名(2 种重载)
tag(name)
tag(name, components)
参数说明
参数类型说明
namestringA string that defines the tag.
componentsselector
官方说明(英文原文)

The tag operation assigns the specified name as a tag to all components. Any valid string is supported as name, except reserved wildcards characters (?, *), which are filtered out. Tags can be hierarchically grouped using the name separator "."

For examples using tags refer to Boolean 3D and Rule inlining.

我方已验证示例:learning case #93(verified_silver)· 点击展开代码 · 示例过大,请复制源码到 demo 运行
extension CurbWall --> CurbWall.
extension Surface --> Surface.


@Hidden
attr shapeType = ""
@Hidden
attr sidewalkSide = ""


@Hidden
import Lane_Queries : "Streets/Imports/Lane_Queries.cga"
@Hidden
import Street_Materials : "Streets/Imports/Elements/Street_Materials.cga"

@Order(1)
@Range(min=0.0, max=0.5, stepsize=0.01, restricted=false)
attr Height = defaultHeight

@Order(2)
@Range(min=0.0, max=1.0, stepsize=0.01, restricted=false)
attr Width = defaultWidth

@Order(3)
@Enum(valuesAttr=curbSi…
deleteTags native ✓ cpp-fast ✓ 已验证 19 条 · silver 官方文档 ↗ #
删除几何标签
签名(3 种重载)
deleteTags()
deleteTags(tagQuery)
deleteTags(tagQuery, components)
参数说明
参数类型说明
tagQuerystringThe query defining which tags to delete. See also Geometry Tagging: Essential Knowledge
componentsselector
官方说明(英文原文)

The deleteTags operation deletes tags from the geometry. If a tagQuery is provided, only matching tags are deleted. If components are specified, only their tags are deleted.

我方已验证示例:learning case #14(verified_silver)· 点击展开代码 · 示例过大,请复制源码到 demo 运行
##############################################
# Extensions
#

@Order(1)
@Description("Highest horizontal 2D shape on the top of the mass.") 
extension Rooftop(ParapetHeight, FloorCount) --> color(0.55,0.65,0.55) Rooftop.

@Order(2)
@Description("Horizontal 2D shapes without any floorplates directly above (but not the roof).")
extension Terrace(FloorHeight, FloorLevel) --> color(0.5,0.7,0.5) Terrace.

@Order(3)
@Description("Horizontal 2D shapes on the actual floor level.") 
extension Floorplat…
setTagsFromEdgeAttrs native ✓ cpp-fast ✓ 已验证 1 条 · silver 官方文档 ↗ #
从边属性生成几何标签
签名(1 种重载)
setTagsFromEdgeAttrs()
官方说明(英文原文)

The setTagsFromEdgeAttrs operation converts string edge attributes stored on the initial shape to edge tags stored on the current shape's geometry. It samples one element from each string attribute array for each face edge of the current geometry and stores them as tags on that edge.

The edge attribute /edgeattr/ attributeName creates tags of the form "edgeattr.attributeName.sampledValue".

官方示例(共 4 个,展示前 3 个) · 点击展开
Visualizer --> 
    comp(e) { isTagged("edgeattr.orientations.front") 
                 : GreenEdge
            | isTagged("edgeattr.orientations.side")  
                 : BlueEdge }

Lot --> setTagsFromEdgeAttrs()
        Visualizer
Lot --> s(10,0,10)
        primitiveDisk(12)
        setTagsFromEdgeAttrs()
        Visualizer
Lot --> setTagsFromEdgeAttrs()
        setback(8) { isTagged("edgeattr.orientations.front")
                        : Visualizer }
我方已验证示例:learning case #224(verified_silver)· 点击展开代码 · 在 demo 中运行 →
/* Misc functions: convert, getTreeKey, getGeoCoord, getMaterial, print, report, label, tag, deleteTags, setTagsFromEdgeAttrs, set, NIL, insert, insertAlongUV */
Lot -->
  extrude(10)
  print(convert("position", "scope", "world", "x", 0, 0, 0))
  print(getTreeKey())
  print(getGeoCoord("lon"))
  print(getMaterial("shape", "all"))
  print("Hello CGA")
  report("height", 10)
  label("building")
  tag("facade")
  deleteTags("temp")
  setTagsFromEdgeAttrs()
  set(material.color.r, 1)
  print("Done")…