How to set default block parameters

1172
7
Jump to solution
08-05-2014 12:10 AM
PetrBocharnikov
New Contributor

Hello!

In my project I face a problem that, when I draw new streets and subdivide an existing block, new blocks do not take block parameters I have previously set. For instance, if I want to connect selected road segment on the left with the selected segment on the right, I will get two new blocks, which do not pick parameters of the block that is there now.

This is troublesome, because I am trying to set up a system where one can interactively create various urban block configurations in an area by editing and adjusting street network. The idea is that the buildings will be then automatically redrawn. The problem is that I rely not only on CGA script, but also on particular block parameters, 12 m offset split into 1 m wide lots, for the buildings generation.

Any suggestions how I can control the new blocks parameters? I am aware of Street Creation Settings dialogue, but I am only able to set the subdivision type and the rule file for new blocks there.

Petr

perspective-5.png

0 Kudos
1 Solution

Accepted Solutions
PascalMueller
New Contributor III

Hello Petr

Thanks for the response. I try to summarize:

  • Currently, CE uses the existing/nearest settings when you draw/split a new block - if this is not the case, then it would be a bug.
  • However, you do not like this "smart" behavior and would prefer that each new block has always the same default parameters, correct?

If so, I'd recommend to make a small Python script that takes the selected block and sets your preferred values. You can attach the scripts in the GUI in the menu bar.

Kind regards

Pascal

View solution in original post

7 Replies
MatthiasBuehler
Regular Contributor

hi .. I'm not sure if I don't follow..

can you make a step by step example ?

Matt

0 Kudos
PetrBocharnikov
New Contributor

Hi Matt,

Thank you for responding. I will try to clarify.

My goal is to create a continuous building along the perimeter of an urban block. I begin with Offset Subdivision, which has offset width of 12m and InnerLot subdivision switched off.

Then I need to take care of existing buildings. My work-around for this problem is to draw exclusion zones around the existing buildings - the black rectangles under the buildings is my map layer. I set offset lots to be 1m wide and extrude the lots on the condition that the map layer is white under the lot. This way I get new building mass only in the areas that neither overlap with the existing buildings nor with the shades they cast.


perspective-6.png

So far so good. But having set up my mapping layer and CGA script, I want to to utilize Dynamic Street Layouts to interactively draw new streets. In my example, I want to draw a street across the urban block. This would allow me to have an interactive system of drawing and adjusting urban blocks.

I this point I have a problem:

perspective-7.png

I have two new blocks now, which have default settings for OffsetWidth, subdivisionRecursive and lotWidthMin. As I mentioned, I am able to set the subdivision type and the rule file for new blocks in Street Creation Settings, but not these parameters. So my system doesn't work.

How can I set OffsetWidth, subdivisionRecursive and lotWidthMin for the new blocks - can I hardcode it somehow?

Petr

0 Kudos
PascalMueller
New Contributor III

Hi Petr

Impressive setup. Which version of CE are you using?

Thanks

Pascal

0 Kudos
PetrBocharnikov
New Contributor

Hi Pascal,

Thank you! I am using 2014 version. Would you have any suggestions on how I can proceed?

I like the idea that with Dynamic City Layouts, I can interactively edit street network, while all building masses are instantly updated. However, to make that work for urban planning purposes, I would need to be able control the default settings for new urban blocks. Otherwise, there is an extra step: after each edit, I would need to go back to the parameters of the new blocks and set them up manually.

Petr

0 Kudos
PascalMueller
New Contributor III

Hello Petr

Thanks for the response. I try to summarize:

  • Currently, CE uses the existing/nearest settings when you draw/split a new block - if this is not the case, then it would be a bug.
  • However, you do not like this "smart" behavior and would prefer that each new block has always the same default parameters, correct?

If so, I'd recommend to make a small Python script that takes the selected block and sets your preferred values. You can attach the scripts in the GUI in the menu bar.

Kind regards

Pascal

PetrBocharnikov
New Contributor

Hello Pascal,

I have now been able to get back to the issue.

You are right that it is a bag: when I drew a new network in a new file, the blocks were 'picking up' parameters from surrounding blocks. That is good news.

I don't want to redraw my network, though, so I thought to try Python solution. Here is a script I made:

'''

Created on 26 August 2014

@author: Petr Bocharnikov

'''

from scripting import *

# get a CityEngine instance

ce = CE()

def blockParameters(offset, area, width):

    selectedBlocks = ce.getObjectsFrom(ce.scene, ce.isBlock)

    for block in selectedBlocks:

        ce.setAttribute(blocks,'/ce/block/offsetWidth', 12)

        ce.setAttribute(blocks,'/ce/block/subdivisionRecursive', False)

        ce.setAttribute(blocks,'/ce/block/lotAreaMin', 12)

        ce.setAttribute(blocks,'/ce/block/lotAreaMax', 12)

        ce.setAttribute(blocks,'/ce/block/lotWidthMin', 1)

What do I need to add so that the script modifies the default block parameters? I am not sure how I can do that.

Petr

0 Kudos
MatthiasBuehler
Regular Contributor

Hi Petr,

What is missing, does your script not work properly ?

Let me know ..

Matt

0 Kudos