How to split parcels into lots using Python?

775
3
10-18-2022 11:50 PM
Vita_Vonanli
New Contributor II

Hi there!

I am using Python in CityEngine and I want to split my shapes (I treated them as parcels) into various size of lots. I have known "ce.subdivideShapes" can do this like the tool in menu bar (Shapes > Subdivide...), but errors occured many times using this.

So I want to know if there is another way to split parcels into lots? I have seen a case video about this for Transit Oriented Development simulations (seen here), and it mentioned python scripting (as shown below) but no details about how to complete this...

Vita_Vonanli_0-1666161865554.jpeg

What's more, I knew the key algorithm of Recursive Subdivision in CityEngine is OBB (Oriented Bounding Box), so it will be greatly appreciated if anyone can give suggestion about how to implement the OBB algorithm in python code!

Thanks!

Tags (2)
0 Kudos
3 Replies
CherylLau
Esri Regular Contributor

Instead of using ce.subdivideShapes(), another way to subdivide parcels into lots would be to write a cga rule that uses splits.  The cga rule can be assigned in python (ce.setRuleFile(), ce.setStartRule()), then generated (ce.generateModels()), and converted to shapes (ce.convertModelsToShapes()).  Here is a simple cga rule that creates the first example (top right in your screenshot) with some randomness built in:

 

 

Parcel -->
	split(z) { 'rand(0.3,0.7): split(x) { 'rand(0.4,0.6): Lot.
										| ~1: Lot. }
			 | ~1: Lot. }

 

 

One random result looks like:

split_result.png

 

0 Kudos
Vita_Vonanli
New Contributor II

Thanks for your reply! I have tried this method before, but it seemed the resulting split lots cannot 'Report' property/attributes respectively. That means, the input parcel is still one shape, but I want every subdivided lots to report their own areas/perimeters/or building heights generated later....So i think split in cga cannot fufill my needs, or it can do this but I haven't found out yet? 

0 Kudos
CherylLau
Esri Regular Contributor

After assigning the subdivision rule to the parcels, you would have to generate it and convert the models to shapes.  Then, each lot will be a separate shape which has its own attributes and can report its own values.

0 Kudos