Floor area based rules.

629
5
04-03-2012 06:23 PM
JesseGould
New Contributor
I'm trying to create a rule that depending on the floor area of a shape a cube is built or 'grafted' onto that original shape.  For example for every 100sq.m of floor area i get 20sq.m of cube attached to the shape. 

Is this possible? and where do i begin?

thanks in advance!

jesse
0 Kudos
5 Replies
MatthiasBuehler1
Frequent Contributor II
hi ..

yes, things like this are possible, though I need some more input.

can you post a picture of what you'd like to have as a result ?

let me know. :)
0 Kudos
JesseGould
New Contributor
Its now become more of a conditional statement rule. I've uploaded the rule file and the map that gives us a few errors. we tried to write in a condition that states when the lot is placed on a red part of the map a "window" is created and when it is placed on the black it is a "wall"

any help would be great!

thanks
Jesse
0 Kudos
MatthiasBuehler1
Frequent Contributor II
hi ..

it is very important to understand that since CE works in a tree structure, you have to pass information down each shape if you want to reuse it further down the rules.

e.g. if you use a comp(f) to split off a facade, any prior knowledge of the other shapes is gone. to pass the Lot area down, you do this best by using a 'Generic Attribute'.

-->

attr Footprint_Area = 0

Lot -->
    set (Footprint_Area, geometry.area)
    extrude(world.y, 20)
    comp(f) {all : Printer}
    
Printer -->
    print (Footprint_Area)



an other input is to split directly after the extrude : this will again create closed volumes after the split, which you then can comp(f) in a second step.
0 Kudos
DavidOConnor
New Contributor
I'm trying to remember the lot dimensions, and later use it to translate a subset.  I'm not sure why, but it doesn't work for me though.  I'm getting an error: Undefined rule:set

I'm using CityEngine 2010, maybe this wasn't a feature of this build?


attr LotScopeX = 0 

Lot -->
 set( LotScopeX, scope.sx )
 Footprint

. // other script

t(lotScopeX,0,0)

0 Kudos
MatthiasBuehler1
Frequent Contributor II
hey ..

important input. set() existed already before 2011, but it did not work on attributes.

the 'generic attributes' as mentioned, are only working that way in CE 2011 and newer.

In your case, you'll have to pass the values as Rule parameters like this :

[ You may see that this may get a little ugly if you have lots and lots of parameters ]

Lot -->
    FootprintValues(scope.sx, scope.sy, scope.sz)

FootprintValues(xDim, yDim, zDim) -->
    print (xDim)
    print (yDim)
    print (zDim)


note that 'xDim' is just a name. you can name this freely !
0 Kudos