# How do I calculate a value between two object attributes within a range

1593
6
10-02-2014 04:17 AM
Occasional Contributor

I will try to explain this, and hopefully it will make sense 😉

I got a building building height left and a building height right. Since they are delivered from Lidar, those are not completely equal, but can vary with 0.3 m for a gable roof. What I would like to do is to get the color “red” if left and right minus each other has a range from -0.3 to 0.3

In Ecxel it could look like this:

=IF(AND(Left-Right>=-0.3; Left-Right <=0.3);"Yes"; "Shape") So this brings a Yes if my calculation is between -0.3 and 0.3.

6 Replies
Regular Contributor

Hey !

How does your data look that you are evaluating ?

Is it geometry ?

Let me know ..

Matt

Matthias Buehler

----------------------------------

Garsdale Design Limited
matthias.buehler@garsdaledesign.co.uk

www.garsdaledesign.co.uk

Occasional Contributor

This is attribute values on a building footprint. I got left, right, front, back, center height. If left, right front, back height is between a small range, but the center height is 2 m above, I would know that this is a roofHip. If let’s say left, right and center is between a small height range, but front and back is 2 m below, then we have a roofGable.

In that way I need to set up a rule that take all these different combinations and equal a roof type, which would be straight forward if my Lidar height left, right and so on had the exact same height, but they of course got a little variation

Occasional Contributor

The rint function will round up and down, and will then be able to calculate the roof form. So I’m ready to move forward again. This seems a lot easier to do it like that, instead of writing it in a rule.

I started out by filed calculation in ArcMAP, whit gave me the idea, and a little searching in the help file got me going, then I can maintain my original attributes, and don’t have to get 5 more object attributes inside CityEngine

Occasional Contributor

Of course that didn’t work, since I could have a value with 2.499 that would go to 2 and 2.501 would go to 3 😞

Regular Contributor

Hey ..

sorry for the late reply ..

well, you can encode such heuristics in CGA, but that's a bit complicated..

before going on with this, did you find a solution yet ?

Cheers!

Matt

Matthias Buehler