通知:E拓建筑网正式更名为拓筑在线!

拓筑在线

 找回密码
 快速注册

QQ登录

只需一步,快速开始

微信登录

微信扫一扫,快速登录

GH中数据选取的语法规则变更(DataTree selection rules)


[版块:参数化设计] [分类:经验教程] [复制链接] 报告无效帖子查看: 2793|回复: 1   
拓邑团练|zdjdevil 发表于 2014-8-13 14:53:32 | 显示全部楼层
发帖得20e币  e币充值  开通VIP会员  快速免费获取e币
今天在处理一组树状数据结构的时候用到split tree这个电池,发现原先的masks的语法规则发生了变化,之前例如我需要提取前6个branches,需要写0-6即可,但是今天一直出错,上网一搜才发现在0.9版本后数据选取的规则发生了变化,现在需要写成0 to 6。为了方便大家之后在其他地方产生疑惑的查询,将作者David Rutten解释帖引用并提供链接,很简单的内容就不翻译了哈。顺带说一句,其实基本上对于树状结构的处理都可以通过Param Viewer转换成List的问题再用Tree Branch转回,但是既然都有这些直接处理树状结构的命令,还是应该多多挖掘其中的强大,例如下面内容会提到的类似编程语言的?和!的用法,会在某些时候给你带来意想不到的便捷。(单位没法上传图片就没法一一截图了,大家探索愉快!)
From David Rutten:

Imagine we have the following data tree, containing a bunch of textual characters:

[size=1em]{0;0} = [a,e,i,o,u,y]
{0;1} = [ä,ë,ê,ï,î,ö,ô,õ,ü,û,ÿ,y]
{1;0} = [b,c,d,f,g,h,j,k,l,m,n,p,q,r,s,t,v,w,x,z]
{1;1} = [ç,ĉ,č,ĝ,ř,š,ş,ž]

There are a total of four branches {0;0}, {0;1}, {1;0} and {1;1}. The first branch contains all the vowels that are part of the standard English alphabet. The second branch contains all non-standard vowels and branches three and four contain the standard and non-standard consonants respectively.


So what if we want to select from this tree only the standard vowels? Basically include everything in the first branch and disregard everything else. We can use the [Tree Split] component with a selection rule to achieve this:

[size=1em]{0;0}

This selection rule hard-codes the number zero in both tree path locations. It doesn't define an item index rule, so all items in {0;0} will be selected.


If we want all the vowels (both standard and non-standard), then we have several options:

[size=1em]{0;?}         = select all branches that start with 0
[size=1em]{0;(0,1)}    = select all branches that start with 0 and end in either 0 or 1
[size=1em]{0;(0 to 1)} =    ......................................... and end in the range 0 to 1.

Conversely, selecting all standard vowels and consonants while disregarding all non-standard character can be achieved with rules as follows:

[size=1em]{?;0}
[size=1em]{(0,1);0}
[size=1em]{(0 to 1);0}

It is also possible to select items from each branch in addition to limiting the selection to specific branches. In this case another rule stated in square brackets needs to be appended:

[size=1em]{0;?}[0 to 2]

The above rule will select the first three vowels from the standard and the non-standard lists.


Basically, rules work in a very consistent way, but there are some syntax conventions you need to know. The first thing to realize is that every individual piece of data in a data-tree can be uniquely and unambiguously identified by a collection of integers. One integer describes its index within the branch and the others are used to identify the branch within the tree. As a result a rule for selection items always looks the same:

[size=1em]{A;B;C;...;Z}              where A, B, C, Z and i represent rules.

It's very similar to the Path Mapper syntax except it uses square brackets instead of parenthesis for the index (the Path Mapper will follow suit soon, but that won't be a breaking change). You always have to define the path selector rule in between curly brackets. You can supply any number of rules as long as you separate them with semi-colons.

The index rule is optional, but -when provided- it has to be encased in square brackets after the path selection rule(s).


The following rule notations are allowed:

[size=1em]*  Any number of integers in a path

[size=1em]?  Any single integer

[size=1em]6  Any specific integer

[size=1em]!6  Anything except a specific integer

[size=1em](2,6,7)  Any one of the specific integers in this group.

[size=1em]!(2,6,7)  Anything except one of the integers in this group.

[size=1em](2 to 20)  Any integer in this range (including both 2 and 20).

[size=1em]!(2 to 20) Any integer outside this range.

[size=1em](0,2,...)  Any integer part of this infinite sequence. Sequences have to be at least two integers long, and every subsequent integer has to be bigger than the previous one (sorry, that may be a temporary limitation, don't know yet).

[size=1em](0,2,...,48)  Any integer part of this finite sequence. You can optionally provide a single sequence limit after the three dots.

[size=1em]!(3,5,...)  Any integer not part of this infinite sequence. The sequence doesn't extend to the left, only towards the right. So this rule would select the numbers 0, 1, 2, 4, 6, 8, 10, 12 and all remaining even numbers.

[size=1em]!(7,10,21,...,425)  Any integer not part of this finite sequence.

Furthermore, it is possible to combine two or more rules using the boolean and/or operators. If you want to select the first five items in every list of a datatree and also the items 7, 12 and 42, then the selection rule would look as follows:

[size=1em]{*}[(0 to 4) or (6,11,41)]

The asterisk allows you to include all branches, no matter what their paths looks like.


It is at present not possible to use the parenthesis to define rule precedence, rules are always evaluated from left to right. It is at present also not possible to use negative integers to identify items from the end of a list.


原始链接http://www.grasshopper3d.com/for ... ree-selection-rules





评分

参与人数 1e币 +5 收起 理由
DanielJin + 5 爆料兼分享,分享总让我们知更多。

查看全部评分

拓邦元帅|沧月 发表于 2014-8-13 19:41:15 | 显示全部楼层
发帖得20e币  e币充值  开通VIP会员  快速免费获取e币
相关的变更还有表达式的写法
您需要登录后才可以回帖 登录 | 快速注册 微信登录

《风水与建筑》PDF版本
《风水与建筑》PDF版本
清晰度还算不错的一本电子书,不过有经济能力的最好买纸质书,也是对作者的支持。 [sell]链接:https://pan.baidu.com/s/1c39VwQ0 密码:tp
  102602882  覃媛媛最后回复于 2025-04-22 电子版图书

《建筑设计资料集》(第3版)1-8全套(免费分享)
《建筑设计资料集》(第3版)1-8全套(免费分享)
《建筑设计资料集》(第3版)1-8全套 **** 本内容被作者隐藏 ****
  静宝贝  覃媛媛最后回复于 2025-04-22 电子版图书

Enscape高级渲染参数预设合集(宝藏参数)
Enscape高级渲染参数预设合集(宝藏参数)
和所有软件的参数预设类似,仅仅需要在场景中简单加载渲染参数,即可得到已经调整好的渲染效果。让效果更上一层楼! 包含百余款渲染
  sadapple  shank11最后回复于 2025-04-21 虚拟化表现

23J909_工程做法图集更新变化
23J909_工程做法图集更新变化
近期接触的05与23J909_工程做法,发现编号变化了,好像做法没什么变化,其他友友看也是吗?
  QIN·S  zzb739811最后回复于 2025-04-20 建筑师讨论区

23J909 工程做法  更新啦!
23J909 工程做法 更新啦!
23J909代替05J909 18年过去了,不容易呀~ 另外屋面保护层40厚配14的钢筋 应该是印刷错误,欢迎大家纠错,讨论~
  huazai_1991  zzb739811最后回复于 2025-04-20 建筑图集

airpak3.0软件下载 有安装教程 有帮助文件
airpak3.0软件下载 有安装教程 有帮助文件
airpak3.0软件,带教程!!!!!! 软件下载地址: [sell=5]链接: https://pan.baidu.com/s/1snnsw0W_J6uIYe1dDixMmw 提取码: qqi3[/sell]
  zheng878577  王剑30314最后回复于 2025-04-19 绿色化分析

90%的商场导视正在压制空间场景的溢价能力?
90%的商场导视正在压制空间场景的溢价能力?
在商业空间竞争日益激烈的今天,导视系统早已不再是冷冰冰的“路标”,而是悄然进化为空间美学的“点睛之笔”。 当消费者走进一座购物中心,最先被吸引的
  空间印象  czg081128最后回复于 2025-04-19 建筑师讨论区

【民宿设计】
【民宿设计】
链接在最后,欢迎评论。 百度网盘下载链接: [sell=15]链接: https://pan.baidu.com/s/1586V0eERFBD1HLTGRpIh8A 提取码: p9mp[/sell]
  薛鹏鹏  麻..最后回复于 2025-04-18 大学生讨论区

老K系列——《景观细部图集》上册
老K系列——《景观细部图集》上册
本册内容主要讲以下几个方面的详细做法: 1、压顶、墙帽与组砌方式 2、独立式墙体 3、镂空花隔墙 4、挡土墙
  king2548  wtangameqq最后回复于 2025-04-17 电子版图书

中粮别墅合院 中式 SU模型(含图)
中粮别墅合院 中式 SU模型(含图)
本资料除了SKP模型,还含有SU导图、效果图、渲染小样等图片,有很好的学习参考价值。百度网盘下载链接(收集于网络,仅供学习交流,侵
  小迷妹建筑梦  wtangameqq最后回复于 2025-04-17 SketchUp模型

老K系列——《景观细部图集》下册
老K系列——《景观细部图集》下册
本册内容主要讲以下几个方面的详细做法: 1、廊、棚架、拱门 及墓地门 2、凉棚、露台和小屋 3、铺面板和木板路
  king2548  walabc最后回复于 2025-04-16 电子版图书

GB 55031-2022 民用建筑通用规范(正式版含条文解释)
GB 55031-2022 民用建筑通用规范(正式版含条文解释)
GB 55031-2022 民用建筑通用规范(正式版含条文解释) 3月1号执行
  huazai_1991  1806965520最后回复于 2025-04-16 规范&图集&标准

老K系列——《景观细部图集》中册
老K系列——《景观细部图集》中册
本册内容主要讲以下几个方面的详细做法: 1、车行路的铺设 2、步行路的铺设 3、台阶与坡道 4、边缘、路缘、
  king2548  walabc最后回复于 2025-04-16 电子版图书

附下载地址天正T20v8.0 7.0 5.0 2014最新版建筑结构水暖电专业适配CAD2023 2022 20...
附下载地址天正T20v8.0 7.0 5.0 2014最新版建筑结构水暖电专业适
附下载地址 天正T20v8.0 7.0 6.0 5.0 3.0 2014最新版建筑结构水暖电专业适配CAD2023 2022 2021 2018 下载地址: **** 本内容被作者隐藏 ****
  hooxm  wtangameqq最后回复于 2025-04-16 图形化处理

中国最美50家民宿院子
中国最美50家民宿院子
编者按:本文来自微信公众号新微设计(公众号ID:land-2013),本站经授权转载。 注:文中大多数案例摘自《最美民宿》丛书当中,共3部,收录了100家当
  深圳老梁  wtangameqq最后回复于 2025-04-16 项目实践·作品库

4个著名古建的纸模,有兴趣的同学可以试试。
4个著名古建的纸模,有兴趣的同学可以试试。
网上收集来的,目测淘宝上也有卖标准模型的,不过挺贵。 这个直接拿去彩印就可以拼了。
  hellolinxiang  wtangameqq最后回复于 2025-04-16 参考素材

MAT新作|舟山海街11号民宿Ⅱ
MAT新作|舟山海街11号民宿Ⅱ
项目缘起海街11号民宿完成于五年前,当时采用的增设阳台改变外立面的策略改变了当地原有方块形民宅的局限,带来了新的内外感观。随着海街11号的名声鹊起,这种设
  深圳老梁  麻..最后回复于 2025-04-16 项目实践·作品库

一大波民宿酒店
一大波民宿酒店
分享一句话:我的工作不是要给出我的灵魂,只是为了收钱和不给出我的灵魂 直接上图,绝对的好资料,一大波民宿合集袭来,赶紧收入囊中吧 [s
  xuelian  麻..最后回复于 2025-04-16 参考素材

官方综合交流QQ群(更多):

240721746

拓筑在线——面向建筑师群体的

设计交流论坛、软件学习社区、资料下载网站及企业服务平台!

微信扫一扫关注我们

微信公众号

拓筑小助手

GMT+8, 2025-4-22 18:21 , Processed in 0.118399 second(s), 18 queries , Gzip On, MemCached On.    拓筑在线 ( 粤ICP备11043922号 )

Powered by Discuz! X3.4  © 2011-2023 拓筑在线

快速回复 返回顶部 返回列表