AnsweredAssumed Answered

Why Python in CityEngine

Question asked by Mortensen91 on Oct 7, 2016
Latest reply on Oct 18, 2016 by Holisticbynature

I'm a 99% noob when it comes to CityEngine and the whole programming world, but it looks to me as there is the possibility to use python scripts within CityEngine, which have made me curious, why would you do that?.


I have encourtered some problems when writing cga rule files, one of them is that I want to split a shape in two, and then extrude number 1 and split number two into two new "shapes". one part of the secound split will then be extruded so it allways has the same volume as extrusion one, see picture.


But this i have not been able to do as fare as i understand it it is becouse it calculates volume one in one branche of the tree and then it is not able to use the data in another branch, is this something you would use python to or what?


I now that for this particular exmaple there is some matematiks that can solve the problem, i think what i'm looking for is a way to store some data in an attribute and then use it again but in another branch of the tree. 



Another question is I want to import a shapefiles into cityengine, which countain some building footprints, I then want to draw a shape under an amount of building footprints, and then see if a footprint is on top of the shape and if it is then calculate the sqm which is not covered by the footprint. 


thise a basically the tasks at hand and i quess the question is, is this something you do with python and what task can python do in cityengine?. Would it improve my skills in cityengine to understand python? 


Sorry for the long post