object attribute

07-17-2018 09:49 AM
New Contributor

Hi, all!

First time to ask questions here.

I am currently considering how to connect the parameters in "Object Attributes" with attributes that pre-defined in CGA rule files. I imitate the lines in "Building_From_OpenStreetMap.cga" which could use the parameter in "object attributes" in terms of "Levels".

Likewise, I will paste what I wrote in rule files. If anyone can make it happen without using Python, plsssss teach me.

PS: two shortcuts were made manually which will be time-consuming when it comes to tremendous parameters need to be connected.

attr NBayNumbers = _getNBayNumbers
attr building__Nbay__x = -1

attr estimatedNBayNumbers =defaultNBayNumbers

const defaultNBayNumbers= 8

hasNBayNumbers = building__Nbay__x != -1

_getNBayNumbers =
case hasNBayNumbers :

0 Kudos
1 Reply
Esri Regular Contributor

I'm not sure what you're asking because it seems like you've achieved what you wanted.

It looks like you successfully connected the object attribute building__Nbay__x to the rule attribute NBayNumbers by connecting it as a layer attribute (drop down arrow next to attr in Inspector -> Connect Attribute -> Layer attribute).  If you do it this way, you don't need all the code.  You would just need the line which creates the rule attribute NBayNumbers.

If you would rather have rule attributes be automatically connected to object attributes (without having to go through the Connection Editor), then you need to make the rule attribute in the cga code have the same name as the object attribute.  Then, when you assign the rule file to the shape, the rule attribute will be automatically connected to object attributes with exactly the same name.  (Note that the auto connect doesn't happen if you change the code after the rule is already assigned to the shape.  Just reassign the rule in this case.)

0 Kudos