Select to view content in your preferred language

Control percentage of big lots and small lots in a Dynamic block subdivision operation

1465
6
09-08-2018 02:01 AM
AbeleGiandoso
Frequent Contributor

Hi

When I'm subdividing blocks Dynamically from a street network..

Is there a way to specify a portion of lots whose area will be kept larger,so that I can assign larger buildings rules to them, like parks, churches etc?

I'm doing a fantasy city, there is no real world data involved.

For instance, to tell CE to keep 10% of lots bigger than 100 square meters and with a side bigger than 8 meters,

keep 5% of lots bigger than 70 square meters and smaller than 100 sq m and with a side bigger than 6 meters and smaller than 9

and the rest bigger than 35 sq meters and smaller than 77 sq m and witha side bigger than 3 meters and smaller than 6?

All of this, and this is important, keeping it dynamic, so that the streetwidth attribute is kept in each lot and the lot remember if tgth are inner, outer and street facing. 

I tried using CGA to subdivide the lots and it does the job, BUT the lots forget if they are inner or outer or corner and they loose the streetwidth attribute, which is fundamental. 

I'd be happy to subdivide in cga if there was a way to keep these information in the final lots.

I don't know anything about python,but maybe there is a way? 

Wouldn't it be a nice feature to add for a future release?

Any help on this would be a huge help 

Thanks

A

0 Kudos
6 Replies
AbeleGiandoso
Frequent Contributor

I see that there are these 2 commands in python 

CE.subdivideShapes

CE.computeFirstStreetEdges

Does it means it is possible to create a custom block to lot dynamic subdivision  (using if, ifelse end else conditions) and than compute the streetwidth of each lot?

Does

CE.subdivideShapes

calculates which lots are inner outer or corner and the street width?

Or if it does not, can these elements be calculated for each lot?

I am trying to wrap my head around python, but to say I am a beginner is being kind.

Any help would be massively appreciated

Thanks

A

0 Kudos
DavidWasserman
Frequent Contributor

Hi Abele Giandoso‌,

I see your challenge. Subdividing with CGA can often be block transferring attributes and can be "blocky" too. I think Python is the correct way to set up your scene. 

I think you are looking at the right functions, one approach to build your medieval city is to create a district layer (assign an object attribute to districts from the generation, I realize you have no data). This district layer might denote elements such specific quarters etc. This is an optional element. 
I think then you have a few options:

Option 1: 

  • Generate your city- set all the blocks to be one shape - set lotAreaMin to a huge number. 
  • Set up a for loop to iterate through all blocks - subdivide shapes on the large blocks. Set the percentages of time you want to split into smaller shapes of a target size based on what you outlined above 
  • Set up a define first edge routine. It should at least establish inner/out lots. 
    • This crude, but might be easier to program. 

Option 2: 

  • You might be able to iterate through each block object and change its block parameters based on your percentage allocations you said above. 
  • This way you just iterate through your blocks and set their lot generation parameters to match your desired allocation. You will have to check their parameters before trying this though. 
  • Set setAttribute() for examples below: 
  • # set block parameter 'shapeCreation' of block 'BlockSouth_8' to false
    #  and make sure parameter source is USER
    block = ce.getObjectsFrom(ce.scene, ce.withName("'BlockSouth_8'"))[0]
    ce.setAttribute(block, '/ce/block/shapeCreation', False)
    ce.setAttributeSource(block, '/ce/block/shapeCreation', "USER")
    # set street parameter 'streetWidth' on segment 'ShapeFile Segment 3148' to 20
David Wasserman, AICP
AbeleGiandoso
Frequent Contributor

Hi David Wasserman!

thank you so much for the assistance

I have a question, which I tried to exemplificate in the above image.

What I am trying to achieve is to have a specific percentage of large lots inside a single Block. So basically have less huge buildings and many small buildings, completely excluding middle sized lots and accordingly to parameters I set. The default irregularity parameter creates a very even result instead which, it seems to me, is not very representative of how cities are structured. 

I would LOVE for additional controls to be introduced o the dynamic subdivision stage. 

If I understand, you are suggesting to use python to have each block be subdivided with different parameters, correct? But this won't change the distribution of huge and small lots inside the block itself right? It will still produce an even distribution of small medium and large lots like in the left example I fear 😕

Question 2:

Set up a define first edge routine. It should at least establish inner/out lots. 

  • This crude, but might be easier to program. 
# set street parameter 'streetWidth' on segment 'ShapeFile Segment 3148' to 20

Can you elaborate a bit more on this step? 

How can I tell CE to define Inner, outer, corner and streetwidth exactly as in the dynamic subdivision procedure? If you set thestreetwidth parameter of the lot to an arbitrary "20" it will not be a mirror of the width of the street nearby right? It will just be a 20 no matter what correct?

How does CE gets the streetwidth from the nearby street segments to the lots? 

I greatly appreciated your help BTW

Thanks
Abele

DavidWasserman
Frequent Contributor

HI Abele Giandoso

I think I understand. This is a little more complicated to control the block. My thought there would be to either use CGA on a rule level to get better control or see if you can use python to iterate through lot/shape objects after subdivision. 


My thought was you could need to subdivided the shape in the block, then set their first edge. See docs on Help - Block Parameters for details on that. 

To set the first edge, I think you would run clean up shapes from python, and make sure that you set the first edge. 

See here:

Set First Edge. This operation sets the first edge of a face to the currently selected edge. This step is often needed to orient a face's "zero" edge towards a street (e.g. for placing the buildings front correctly). If a face is selected, the highlighted gradient line indicates the first edge (with gradient from vertex 0 to vertex 1).

David Wasserman, AICP
AbeleGiandoso
Frequent Contributor

Hi David Wasserman

Last question, Does using  "Set First Edge" in Python breaks the Dynamic shapes and turn them into static Shapes? Does it even works on Dynamic Shapes?

If I understand correctly the Set First Edge command is only available for Dynamic Shapes

Ideally I'd like to keep the whole thing dynamic. 

Thanks!

0 Kudos
DavidWasserman
Frequent Contributor

That is a good question. I would have to run it to find out. I have not actually tried the workflow I am writing up, but I am trying to think of an approach that matched my understanding of the python API. If you try it let me know. 

David Wasserman, AICP