I am creating a number of shapes that represent buildings. (See attached.)
I want to have the buildings facing south to be shorter, and progressively taller as you go north.
How would I capture that using shape grammar? Suggestions appreciated!
-Robert
Thanks for the information. Perhaps I can import the JTS geometry library into CityEngine to extend the jython functionality.
Update: Getting JTS into cityengine worked, using this article pyright: jython + the JTS geometry library. Note I had to be
careful with the coordinate system: CityEngine -z is JTS y.
Knowledge about neighboring shapes in CityEngine is really difficult and limited. It's currently limited to the occlusion queries in CGA. If you figure out a way to do it with Python, it's probably the only way to do it.
The next step is for the height of the buildings to respond to the sun location. For example,
I want the buildings along the southern edge of the lot to be low, and the neighboring ones
progressively taller. I haven't figured out how to get the heights of neighboring buildings, so I am
using the python export to get building locations and calculating the height using python.
Unfortunately, with Jython, I cannot import modules like "numpy" so it's becoming a bit
of kluge, doing a system call to a python script from within Cityengine's jython.
I feel I am approaching this problem the wrong way. Suggestions?
If you need to know the positions of the buildings relative to the world, you could also convert scope coordinates to world coordinates using convert() (but using split.index is easier).
convert Function
That is brilliant. Thank you!
Maybe you could use the split.index, like so:
@StartRule Lot <SPAN class="operator token">-</SPAN><SPAN class="operator token">-</SPAN><SPAN class="operator token">></SPAN> alignScopeToAxes<SPAN class="punctuation token">(</SPAN>y<SPAN class="punctuation token">)</SPAN> split <SPAN class="punctuation token">(</SPAN>x<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">{</SPAN><SPAN class="number token">10</SPAN><SPAN class="punctuation token">:</SPAN> Spli<SPAN class="punctuation token">}</SPAN><SPAN class="operator token">*</SPAN> Spli <SPAN class="operator token">-</SPAN><SPAN class="operator token">-</SPAN><SPAN class="operator token">></SPAN> extrude<SPAN class="punctuation token">(</SPAN>split<SPAN class="punctuation token">.</SPAN>index<SPAN class="punctuation token">)</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>
Signed in members can post, follow updates, and more. New here? Register a free account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.