PredecessorShape --> Successor
#所有的规则,都有一个开始的地方 #规则可以随意命名,不过看到的一般都是Lot Lot--> #拉伸函数 extrude(10) #将拉起来的数据存储在下面这个变量中 CompModel
PredecessorShape(Parameters) --> Successor
Lot--> #color函数,给面赋一个颜色 color(1,0,0) #赋过颜色之后,村给Footprint这个变量, #这个变量是带参数的,这里的参数是20 Footprint(20) Footprint(height)--> #向上面拉伸一个高度,用的是上面的参数 extrude(height) #下面这个变量,后面的.应该 #代表的是到此结束的意思。加上了点 #后面就不能再引用了 Envelope.
另外,我试了,上面的代码,最后一行啥也不写貌似也没啥影响。
PredecessorShape --> percentage%:Successor1 percentage%:Successor2 …… else:SuccessorN
注意事项:总的百分比,不能超过100%
Lot--> #这后面的,跟上一个例子基本一样 #不同的地方,就是前面的比例 #经测试,这是随机的比例,挺好 20%:color(1,0,0) Footprint(20) 20%:color(0,1,0) Footprint(30) else:color(0,0,1) Footprint(50) Footprint(height)--> #这部分和前面的例子也是一样的,不多说了 extrude(height) Envelope.
PredecessorShape --> case condition1:Successor1 case condition2:Successor2 …… else:SuccessorN
Lot--> #根据条件进行判断,符合对应的规则,就应用对应的处理 case geometry.area<1500:color(1,0,0) Footprint(20) case geometry.area>2000:color(0,1,0) Footprint(40) else:color(0,0,1) Footprint(60) Footprint(height)--> #这部分和前面的例子也是一样的,不多说了 extrude(height) Envelope.
PredecessorShape --> case condition1:Operation PredecessorShape case condition2:Successor2 …… else:SuccessorN
Lot--> extrude(10) color(rand(),rand(),rand()) comp(f){side:SideFacade | top:Recursive} Recursive--> #开始递归,当面积小于5的时候 #就每次往里面缩一点,并 case geometry.area>5: X. s('0.8,'0.8,'1) extrude(4) color(rand(),rand(),rand()) center(xz) comp(f){side:SideFacade | top:Recursive} else: X.
cityEngine学习了几次,逐渐摸到门道了,也可以做出点模型了。继续加油!
本文分享自微信公众号 - 数据处理与分析(Qing_master)
原文出处及转载信息见文内详细说明,如有侵权,请联系 yunjia_community@tencent.com 删除。
原始发表时间:2019-07-14
本文参与腾讯云自媒体分享计划,欢迎正在阅读的你也加入,一起分享。
我来说两句