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

拓筑在线

 找回密码
 快速注册

QQ登录

只需一步,快速开始

微信登录

微信扫一扫,快速登录

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


[版块:参数化设计] [分类:经验教程] [复制链接] 报告无效帖子查看: 2963|回复: 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币
相关的变更还有表达式的写法
您需要登录后才可以回帖 登录 | 快速注册 微信登录

昆明东风里:TOD 上的云南文化策展地
昆明东风里:TOD 上的云南文化策展地
当五星红旗在风中飘扬,在举国同庆的日子里,我们见证着、经历着国家的繁荣昌盛、风华正茂。 七十六年前的今天,当第一面五星红旗在北京天安门广场升起,远
  空间印象  空间印象最后回复于 2025-10-29 建筑师讨论区

以“四维沉浸”导演一场室内亲子乐园的消费游乐戏剧
以“四维沉浸”导演一场室内亲子乐园的消费游乐戏剧
回想一下节日期间,家庭出游群体作为消费主力军,各大亲子室内乐园里人潮涌动、热闹非凡,人气爆棚的景象至今仍历历在目。 ©Hello-SASA 据《2024
  空间印象  空间印象最后回复于 2025-10-23 建筑师讨论区

【By DanielJin】由浅入深学grasshopper BASIC 01
【By DanielJin】由浅入深学grasshopper BASIC 01
大家好,我的《Grasshopper从入门到进阶》课程已经开课了。 有兴趣欢迎关注:https://www.tuozhu123.com/course-54.html 前言:个人由于要出国读研,对参数
  DanielJin  芯茹芷水最后回复于 2025-10-22 参数化设计

解锁桂林新玩法:状元文化如何激活千亿消费?
解锁桂林新玩法:状元文化如何激活千亿消费?
一句“桂林山水甲天下”让广西桂林旅游业长青数百年,也束缚了桂林旅游业数百年,从“靠山吃山”到“坐吃山空”,虽然说法有些极端,但也道破了这些年桂林旅游
  空间印象  空间印象最后回复于 2025-10-22 建筑师讨论区

思考:gh程序修剪曲线
思考:gh程序修剪曲线
最近有童鞋提出的一个gh修剪曲线的问题,虽然用rhino可以简单实现,但用gh思考一下也比较锻炼解题思路。解决方法有简单的,有稍微复杂的,有局限的,有普遍适用
  沧月  veer最后回复于 2025-10-20 参数化设计

grasshopper算容积率
grasshopper算容积率
因为比较初级,写下来一是记录一下避免今后忘记,二是提供初学者一些参考和比较详细的电池说明。 先上一张打包的电池示意图 下个模型玩玩,大家也可以用自己
  xuhuiwen329  veer最后回复于 2025-10-20 参数化设计

我的渲染作品
我的渲染作品
  MrWay  veer最后回复于 2025-10-20 参数化设计

grasshopper的困扰
grasshopper的困扰
作为初学者,现在对数据的工具栏感到很困扰,有些命令看起来就像神秘的黑洞一样深奥,但同时也深深地吸引着我去了解。所以,希望能在若干年以后,我也能自豪地和
  linux0009  veer最后回复于 2025-10-20 参数化设计

大水牛出品GH+ghpython入门教程
大水牛出品GH+ghpython入门教程
资料收集于网络,仅供学习研究。百度网盘下载链接: [sell]链接:https://pan.baidu.com/s/1MjhW_8pvMaiMC5gmwzr8iQ 提取码:4spn[/sell]
  我是大嘴猴  lpggyyds最后回复于 2025-10-20 参数化设计

双曲面拟合plane压弧线单曲的方法及尝试
双曲面拟合plane压弧线单曲的方法及尝试
一直都发的revit做的玩意~~~今天发个gh做的玩意~~~ 前一阵子看群里有人接曲面幕墙的活。就心血来潮想研究下怎么拟合曲面~~~~昨天晚上有空做了一个出来。思
  lzeaf  veer最后回复于 2025-10-20 参数化设计

参数化旋转楼梯(已上传思路图,电池图)
参数化旋转楼梯(已上传思路图,电池图)
网上看到RICHIE大神的作品,模仿一下~全参数控制~起始端为XZ方向上的几个点(见图)然后连线取中点在Y方向上偏移,然后其他形态由GRAPH MAPPER控制,不难,有兴
  S65510630  veer最后回复于 2025-10-20 参数化设计

【学堂 建模】GH编织练习
【学堂 建模】GH编织练习
闲来无事 用GH作了一个编织 GH图 GH版本是0.914的
  yymenh  veer最后回复于 2025-10-20 参数化设计

【SEG出品】GH讲解之Preference(上)
【SEG出品】GH讲解之Preference(上)
首先,很开心的告诉大家,E拓参数化板块有自己的独立域名啦!以后大家可以输入csh.eeeetop.com即可访问参数化板块。 大家没有发现参数化板块的UI比主页要简洁一
  DanielJin  veer最后回复于 2025-10-20 参数化设计

农村自建房造型设计
农村自建房造型设计
前面两个是大致的平面布局,后面是一些想要的风格意向,但是现在造型被限制的很死,场地限制,整体平面布局偏正方形,因为节假日居住的人数较多,目前平面设置了
  安徽阿才  hzl龙最后回复于 2025-10-17 建筑师讨论区

GBT50104-2010 建筑制图标准规范
GBT50104-2010 建筑制图标准规范
GBT50104-2010 建筑制图标准规范
  喜啦啦  喜啦啦最后回复于 2025-10-16 快速发帖

城市更新文本
城市更新文本
放上一些截图 **** 本内容被作者隐藏 ****
  牧野先生  evan298最后回复于 2025-10-15 设计文本

Lumion 10.5 解压即可使用 免断网破解版
Lumion 10.5 解压即可使用 免断网破解版
看到好多小伙伴安装lumion其他版本的时候出现各种各样的问题,因为繁琐的步骤和其他问题总有人安装失败,这次提供的版本解压即可使用,不需要断网 破解 替换文件
  sadapple  18082364985最后回复于 2025-10-15 虚拟化表现

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

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

240721746

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

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

微信扫一扫关注我们

微信公众号

拓筑小助手

GMT+8, 2025-10-30 01:19 , Processed in 0.090287 second(s), 18 queries , Gzip On, MemCached On.    拓筑在线 ( 粤ICP备11043922号 )

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

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