@Group ("BUILDING VOLUME", 0) attr Building_Height = rand (10,15) @Group ("BUILDING VOLUME") attr Ground_Floor_Height = rand (3.5, 4.5) @Group ("BUILDING VOLUME") attr Upper_Floor_Height = rand (3, 3.5) @Group ("ROOF VOLUME", 1) @Range ("random", "flat", "hip", "gable", "pyramid") attr Roof_Form = "random" const function_Roof_Form = # const is constant. consts are only evaluated once per shape ! case Roof_Form == "random" : 30% : "flat" 20% : "hip" 20% : "gable" else : "pyramid" else : Roof_Form @Group ("ROOF VOLUME") attr Roof_Height = case function_Roof_Form == "flat" : 0 else : rand(2,3) @Group ("ROOF VOLUME") attr Overhang = rand (.1,.3) ################################################################################# ### START # Lot --> case function_Roof_Form == "flat" : extrude(world.y, Building_Height - flatRoofBorderHeight) Mass else : extrude(world.y, Building_Height - Roof_Height) Mass ################################################################################# ### MASS # Mass --> # split the 3d volume ! split(y) {Ground_Floor_Height : FloorVolume("groundFloor") | ~1 : split(y) {~ Upper_Floor_Height : FloorVolume("upperFloor") }* } # make a shape copy for the roof comp(f) {top : Roof | all : NIL } ################################################################################# ### FLOOR VOLUMES # FloorVolume(type) --> ContinueHere. ################################################################################# ### ROOFS # flatRoofBorderHeight = 0.2 Roof --> case function_Roof_Form == "flat" : offset(-.2) comp(f){border : extrude(world.y, flatRoofBorderHeight) RoofColoring | inside : t(0,0,.02) RoofColoring} case function_Roof_Form == "hip" : roofHip(45) s('1,Roof_Height,'1) # scale to the correct height RoofColoring case function_Roof_Form == "gable" : roofGable(45) s('1,Roof_Height,'1) # scale to the correct height RoofColoring else : roofPyramid(45) s('1,Roof_Height,'1) # scale to the correct height RoofColoring ################################################################################# ### COLORING # RoofColoring --> color(.5,.3,.3)
Dear Daniel,
i have newly started learning city engine and your CGA could will help me to create my first model but my main problem is to create Dome roof CGA,
Regards#
There is an example of a domed roof on top of the tower in the Sternwarte example. Help -> Download Tutorials and Examples.
case RoofType == "Gable" : roofGable(roofAngle, gableOverhang, gableOverhang) # roof angle and overhang s('1,Roof_Height,'1) # scale to the correct height setupProjection(0, scope.xz, roofTexWidth, roofTexHeight) texture(rooftile_tex) projectUV(0) setupProjection(2, scope.xz, scope.sx, scope.sy)#spread across dirtmap projectUV(2) set(material.dirtmap,roofdirt_tex)
case function_Roof_Form == "gable" : roofGable(45)
case function_Roof_Form == "gable" : roofGable(30,1,1)