Hi Elena !
This is quite advanced stuff.
The idea would be not that you change the CGA code, but you drive specific attributes via a Python script.
Steps:
1] generate the models once, with reports for your target values
2] get the reports via Python ( using the script based exporter )
3] do the calculations with that info ( at the end of the script based export )
4] write the resulting new attribute values to the shapes ( at the end of the script based export )
5] re-generate the models again with the new attributes
The problem I see in your specific task is that you try to COMBINE shapes like this. This is not really possible in CityEngine.
If possible, try to do ALL PREPROCESSING in ArcGIS, then bring the clean geometries and attributes to CityEngine for the 3D Model generation based on those inputs. CityEngine was not designed for such analysis tasks.
I can give you a little test example which shows you a possible workflow of the above steps, but I guess you will not be satisfied with it for what you're searching.
Let me know what you think !
Kind greetings !!
Matthias