I have downloaded some polygons from OSM and in their attributes table is a field named TYPE. I have populated that field with 2 types : blocks and houses.
I have imported the shapes into City Engine and after started a new cga rule. I set a Minimum Height of 30 and a Maximum Height of 50. Depending of their type I want to extrude my polygons : houses = 30 and blocks = 50.
My cga rule doesn`t work. Also, the source for type is the object attributes.
Could you help me please?
P.S.: the rule looks like this :
attr Type = "type"
attr MinHeight = 30
attr MaxHeight = 50
Footprint (type) -->
case type == "bloc" : extrude (world.y, 50) Mass
case type == "casa" : extrude (world.y, 30) Mass
Solved! Go to Solution.
This rule won't work, because the start rule (Footprint) cannot be parameterized with (type):
1. Change: "Footprint (type) -->" to "Footprint -->" (does not need to be parameterized, since the Type attribute is like a global variable that is already visible anywhere in the rule.)
2. Change: case type == "bloc" to case Type == "bloc", since Type is the case-specific attribute you are testing.
Does this work?
I will try this immediately.
Another question if you could help me:
Let`s say that I have 2 types of attributes in my polygon attributes table : "blocks" and "houses" and I have already created 2 cga. rules named the same for those 2 types of buildings.
How should I write a new rule that in function of those 2 types of attributes, on those polygons would apply the another 2 types of rules?
( For those polygons that have "blocks" in attribute table to apply the "block" rule and for houses the same)
Thank you !
If you already have two rules for each type you can use this (but both rules' Inspectors will be visible, which is not an intuitive UI):
import block: "Block.cga"
import house: "House.cga"
attr Type = "Block"
case Type == "Block": block.YourBlockStartRule
case Type == "House": house.YourHouseStartRule
import bloc : "Blocuri.cga"
import casa : "Case.cga"
attr Type = "bloc"
case Type == "Bloc":bloc.Bloc
case Type == "Casa":casa.Casa1
else : NIL
I`m not sure why is not working. I attached a print.