compare the length of two different shapes

742
3
10-18-2012 03:05 AM
ElenaBalossino
New Contributor
Hi,

we are just beginners with City Engine and we would like to know if it's possible to compare the size (length and area) of two different shapes.
We created a grid and assigned a name to each rectangle, and what we want the software do is to compare the length of the edge (scope.sx) of square A1 to the edge of square B1 (see the attached image) and if they are the same, delete the line between them.

Is it possible?

Thank you in advance!
0 Kudos
3 Replies
MatthiasBuehler1
Frequent Contributor
Hi !

In CityEngine, a 3D Model is generated by using 1 shape plus 1 cga rule. Thus, each shape produces 1 Model. In this process in CGA, the shapes can not communicate with each other or query information about other shapes.

Thus, the process you describe is not possible. Maybe will in future versions.

The metadata which 'spans across' multiple shapes must be fed in the form of attributes to each shape so it's assigned rule knows what to do.

You can use Python scripting to collect such data and set attributes ( or do it manually ).

* * *

I'd recommend you start with the Tutorials and Tutorial videos if you're a beginner.
http://forums.arcgis.com/threads/64843-CityEngine-Collection-RESOURCES-FAQ-HELP


Have fun !

Matt
0 Kudos
ElenaBalossino
New Contributor
Thank you for your reply. How does the integration between CGA shape grammar rules and the Python script work? Could you suggest me a way to collect such data with Python?
Thanks again.
0 Kudos
MatthiasBuehler1
Frequent Contributor
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
0 Kudos