Attributes rule

2337
11
05-28-2013 10:21 AM
LukeCzar
New Contributor III
Hi Matthias,


Quick question, we use the gdb file with attributes already inside each room,  for instance, one floor has lower walls the other upper - in attributes, so we would like to create a new rule that would extrude lower walls 2feet and upper 4 feet, how do we use python to make the program read from the attributes that are already in gdb ?



?ukasz
0 Kudos
11 Replies
by Anonymous User
Not applicable
Lukasz,

If you have a file GDB from which you are importing attributed shapes, you will want to use CGA rules (Python not needed here) to read those attributes and use the attribute data to help create the generated model. To do this, first create an attribute in your CGA rule, like this:

attr MatchingNameGoesHere = 42  # (default value)

The CGA attribute name must match exactly (case sensitive) the attribute in the GDB. Next, apply this rule to the shapes in question. Upon applying this rule, CE will see the matching names and then connect the CGA attribute in the Inspector to the Object Attribute coming from the GDB. If it does not occur automatically, or if the rule was previously applied to this shape, you can manually make this connection by clicking the Attribute Connection Editor next to the attribute value in the inspector. This will only work of the names match. If you need for the names to not match, then you can get the same effect using the Layer Attributes option inside the Attribute Connection Editor.

Does this work for you?

Chris
0 Kudos
LukeCzar
New Contributor III
Yes!!!

Thanks a lot Chris



Lukasz
0 Kudos
gulhunduran
New Contributor
I have building footprints with the attribute "height", but I want to use these height values with my Rule attribute "BuildingHeight". I mean I dont want to use my object attribute name as rule attribute name. How can I use object attribute values without using the same name?
0 Kudos
MatthiasBuehler1
Frequent Contributor II
by mapping the value ..

attr height = 0
attr buildingHeight = height
0 Kudos
gulhunduran
New Contributor
After doing so, value was still zero. Then, to map the values I opened the Attribute Connection Editor dialog but it says there is no object attribute named "BuildingHeight". What am I supposed to do now?
0 Kudos
MatthiasBuehler1
Frequent Contributor II
Hi !

play around a bit with the values.


-> break down each step you need:
maybe to start, just print() all the values which come from the footprints. once you have your values of interest, just redirect the value to your attr. I see you're using the Connection Editor, so you're on a good way.

It must be something very small, so check each step you wrote in code.

hope you figure this out ..
0 Kudos
gulhunduran
New Contributor
Actually, I'm not familiar with coding. That's why my code is very simple:) Can you please tell me what is wrong with this rule:

attr height = 0
attr buildingHeight = height

Lot-->extrude(world.y, buildingHeight)

Thank you so much for your help:)
0 Kudos
MatthiasBuehler1
Frequent Contributor II
Hi,


This code will use the value 0 for the extrusion unless you can point the attr height to an imported attribute which has a realistic value.

I'd recommend you watch the tutorial videos 1 -6 before diving into writing code beforehand. This stuff will be covered.

Find them here :
http://forums.arcgis.com/threads/64843-CityEngine-Collection-RESOURCES-FAQ-HELP


This will help you.

Matt
0 Kudos
gulhunduran
New Contributor
Hi,
It worked perfectly! Thanks for your support!
0 Kudos