Unequal offset

2440
9
Jump to solution
03-21-2013 07:51 PM
PriyankaMehta
New Contributor
Hi,
  I am quite new to City Engine CGA rules.
I am trying to understand the offset and split rules.

I am using this simple script from the help file

attr red   = "#FF0000" attr green = "#008000" attr offsetval = -5 attr extrudeval = 20   Lot --> offset(offsetval) A  A   --> comp(f) { inside: I | border: O } I   --> color(red) #I --> extrude(extrudeval) O   --> color(green)


My original lot shape is a rectangle. Please see attached image.[ATTACH=CONFIG]22866[/ATTACH]
Basically I don't want equal offset on all 4 sides. I want to control the amount of offset on each side and also treat each of that side with a different attribute.
For eg. Front  --> color (blue) offset (-4)
           Back -- > color(red) offset (-1)
           Left    }   and so on...
           Right

Any help is much appreciated.

Thanks & Regards,
Priyanka
Tags (2)
0 Kudos
1 Solution

Accepted Solutions
MatthiasBuehler1
Frequent Contributor II
Hi Priyanka !


Which version of CityEngine are you using ?

Those 'selectors' street.front and so have changed a bit, so I think you may have an older version.

To make this work, check your CGA reference (setback) and see which selectors you have available. Code is not missing, just the synatax may have changed.

Let me know, ok ?



Matt

View solution in original post

0 Kudos
9 Replies
MatthiasBuehler1
Frequent Contributor II
Hi !

Check the CGA reference about the ther operations. In your case, check especially setback() and shapeL(), shapeO() and shapeU().


Here's some example code :

@Group("Ground Level Setbacks",1)
attr Front_Yard_Depth = 5
@Group("Ground Level Setbacks")
attr Rear_Yard_Depth = 5
@Group("Ground Level Setbacks")
attr Side_Yard_Width = 5

@Group("Buildable Volume",2) @Order(1)
attr Max_Height = 15
@Group("Buildable Volume") @Order(2)
attr Setback_Angle = 60
@Group("Buildable Volume") @Order(3)
attr Front_Baseheight = 10
@Group("Buildable Volume") @Order(4)
attr Rear_Baseheight = Max_Height+0.1
@Group("Buildable Volume") @Order(5)
attr Side_Baseheight = Max_Height+0.1
@Group("Buildable Volume") @Order(6)
attr Color = "#ffff00"

@Group("Options") @Hidden
attr Opacity = 0.5
@Group("Options") @Hidden
attr Show_Shell = true
@Group("Options") @Hidden
attr Floor_Height = 3.7

@Hidden
attr lotArea = 0
@Hidden
attr bldgArea = 0

Lot -->
 case !Show_Shell: NIL else:
  set(lotArea,geometry.area())
  setback(Front_Yard_Depth) { street.front: NIL | remainder: 
   setback(Rear_Yard_Depth) { street.back: NIL | remainder: 
     setback(Side_Yard_Width) { street.side: NIL | remainder: 
     BuildableArea 
    }
   }
  }
  
BuildableArea -->
 set(bldgArea,geometry.area())
 envelope(Max_Height, Front_Baseheight, Setback_Angle, Rear_Baseheight, Setback_Angle, Side_Baseheight, Setback_Angle)
  BuildableVolume
  
BuildableVolume -->
  color(Color)
  set(material.opacity,Opacity)
  report("Lot Area (m2)",lotArea)
  report("Max Building Area (m2)",bldgArea)
  report("GFA Potential (m2)",geometry.volume/Floor_Height)
  report("FAR Potential",geometry.volume/Floor_Height/lotArea)
  
  
0 Kudos
PriyankaMehta
New Contributor
Hi Thanks for the reply Matthias,
I was trying the sample code that you replied. It gives an error for "no function for street.front" and since I am quite new to CGA, its difficult for me to debug.
I am checking on setback examples in help contents and they seem useful. Thanks for the guidance. It will be a great help if you can resend me the example code with street.front/back function also included in the code.

Also, I saw your thread for tutorial helps for city engine. Are there any more tutorials especially CGA rule related that have been updated recently especially with more examples.

Thanks,
Priyank
0 Kudos
MatthiasBuehler1
Frequent Contributor II
Hi Priyanka !


Which version of CityEngine are you using ?

Those 'selectors' street.front and so have changed a bit, so I think you may have an older version.

To make this work, check your CGA reference (setback) and see which selectors you have available. Code is not missing, just the synatax may have changed.

Let me know, ok ?



Matt
0 Kudos
PriyankaMehta
New Contributor
Thanks again Matt,
I am using CityEngine 2011 and I modified the selectors.
I am almost getting what I was expecting although, the code gives warning on envelope saying "undefined rule". How should I handle envelope rule ?

Lot -->
 case !Show_Shell: NIL else:
  set(lotArea,geometry.area())
  setback(Front_Yard_Depth) {object.front: NIL | remainder: 
   setback(Rear_Yard_Depth) { object.back: NIL | remainder: 
     setback(Side_Yard_Width) { object.left: NIL | remainder:
      #setback (Right_Yard_Width) {object.right:NIL | remainder:
      BuildableArea 
    }
   }
  }



Thanks,
Priyanka
0 Kudos
MatthiasBuehler1
Frequent Contributor II
Hi ..


A yellow warning is just a notification. Then you can generate a model. If you have a red error, you can not generate the model.


2 such warnings exist :

1] undefined rule
2] unused rule


Example for 1]

Lot -->
    A

Suppress this warning with a dot (.) :
Lot -->
    A.


Dots also stop from further execution, so by using a dot, you can stop CGA at any point.


Example for 2]

Lot -->
    A.

B -->
    C.


Let's say you have the rule assigned to a shape with Start Rule 'Lot'. B is nowhere calles, so it's unused.

Ok ?

M.
0 Kudos
PriyankaMehta
New Contributor
Thanks for your reply Matt.  I  havent had the time to check it but I think I got it and will be able to get it going.

Regards,
Priyanka
0 Kudos
PriyankaMehta
New Contributor
Hi Matt,

Thanks for your help. The code is doing very well on making all the sides' widths very easy to adjust
and I can also control the border by changing object.front from NIL to Garten kind of (like in helpfile)
But looking at the code I suspect it is meant to do a lot more.
What is "envelope" meant to do ? It gives a warning there and I supressed it by "dot" but then what is the building volume and all functions doings ?

Thanks a lot for your help till now


Regards,
Priyanka
0 Kudos
PriyankaMehta
New Contributor
Hi Matt,

Thanks for your help. The code is doing very well on making all the sides' widths very easy to adjust
and I can also control the border by changing object.front from NIL to Garten kind of thing(like in helpfile)
But looking at the code I suspect it is meant to do a lot more.

What is "envelope" meant to do ? It gives a warning there and I supressed it by "dot".
But I suspect that its because of the envelope function that I am not being able to see what is building volume and building area
function doing

Thanks a lot for your help till now


Regards,
Priyanka
0 Kudos
MatthiasBuehler1
Frequent Contributor II
Check this video, it shows the envelope CGA operation.

The rule used in the vid is exactly what you're working on ..

http://video.arcgis.com/watch/1760/3d-land-use-zoning


Let me know if this helps !

Matt
0 Kudos