商业建筑单体数据版(英文)

商业建筑单体数据版(英文)

  • 开发者CreateUrban
  • 授权类型永久授权
  • 发布版本中文正式版1.1/英文正式版1.0
  • 依赖数据只依赖地块大小,不读取数据属性字段参数
  • 支持软件CityEngine2019-2022/UE4.26-4.27
  • 最近更新2022年08月06日

DataCommercialBuildings

商业建筑单体数据版(CE-UE)

 

程序用途:

商业建筑单体生成工具

程序功能:

DataCommercialBuildings-Max1.1-CityEngine2021(中文)

  • 不依赖数据可以调节建筑大小
  • 可控制楼体样式、楼层样式、窗户样式以及阳台样式的位置
  • 模型分为三个精度等级

DataCommercialBuildings-Max1.0-CityEngine2021(英文)

  • 不依赖数据可以调节建筑大小
  • 可控制楼体样式、楼层样式、窗户样式以及阳台样式的位置
  • 模型分为三个精度等级

程序源码

购买后即可同时查看核心源码

 

version "2021.1"

@Group("CreateUrban",0)
attr Website = "https://cga.createurban.cn"
attr Version = "DataCommercialBuildings-Max1.0-CityEngine2021"


#################
##### 属性参数
#################



## Model Options	

@Group("Model Lod",0) @Order(1) 
attr ShowModel = false

@Group("Model Lod",0) @Order(2) @Enum("High","Medium","Low")
attr ModelLevel = "Low" 

@Group("Model Lod",0) @Order(3) 
@Hidden
attr Transparent = false


## Facade Design	

@Group("FacadeStyle",5) @Order(2) 
@Enum("[WO]*W","o[WO]*Wo","O[Wo]*WO","wo[WO]*Wow","Wo[WO]*WoW","WO[Wo]*WOW","Rhythm1")
@Description("Name of floor pattern for uneven floors ('W' stands for Wall, 'O' for Opening, 'w' and 'o' for smaller versions thereof)") 
attr Odd_floor_type = "[WO]*W"	#奇数楼层类型

@Group("FacadeStyle",5) @Order(3) 
@Enum("[WO]*W","o[WO]*Wo","O[Wo]*WO","wo[WO]*Wow","Wo[WO]*WoW","WO[Wo]*WOW","Rhythm1")
@Description("Name of floor pattern for uneven floors ('W' stands for Wall, 'O' for Opening, 'w' and 'o' for smaller versions thereof)") 
attr Even_floor_type = "[WO]*W"	#偶数楼层类型

@Group("FacadeStyle",5) @Order(4) 
@Enum("Same as Main","WOW","WoW","wOWOw","woWow","woW","wOwoW","w[oW]*w")
@Description("Floor Pattern for sides ('W' stands for floating Wall, 'O' for Opening, 'w' and 'o' for smaller versions thereof)") 
attr SideType = "Same as Main"	#建筑侧面类型

@Group("FacadeStyle",5) @Order(5) 
@Enum("None","On Front","On Rear")
attr BalconiesWindows = "None"	#窗户与阳台控制

@Group("FacadeStyle",5) @Order(6) 
@Enum("[WB]*W","b[WB]*Wb","Alternating")
//@Hidden
attr BalconyType = "[WB]*W"	#阳台类型

## Main Parameters

@Group("Main Parameters",2) @Order(1) @Range(min=5, max=15, restricted=false) @Distance
@Hidden
attr Win_Width = 4

@Group("Main Parameters") @Order(2) @Range(min=1, max=4, restricted=false) @Distance
@Hidden
attr Win_Height = Standard_Floor_Height - Cill_Height - Slab_Thickness 		# per default, the windows go up to the ceiling height

@Group("Main Parameters") @Order(3) @Range(min=0, max=2, restricted=false) @Distance
@Hidden
attr Cill_Height = 0.3

@Group("Main Parameters") @Order(4) @Range(min=0, max=5, restricted=false) @Distance
@Hidden
attr Wall_Width = 2

@Group("Main Parameters") @Order(5) @Range(min=5, max=20, restricted=false) @Distance
@Hidden
attr Balcony_Width = 8

## Windows

@Group("Windows") @Order(0) @Enum("Wall Center","Inside Flush", "Outside Flush")
@Hidden
attr Win_Position = "Wall Center"

@Group("Windows",3) @Order(1) @Range(min=0.7, max=2, restricted=false) @Distance
@Hidden
attr Panel_Width = 1

@Group("Windows") @Order(2) @Range(min=0, max=0.3, restricted=false) @Distance
@Hidden
attr Frame_Width = 0.1

@Group("Windows") @Order(3) @Range(min=0, max=0.6, restricted=false) @Distance
@Hidden
attr Frame_Depth = Frame_Width*2

@Group("Windows") @Order(4) @Color
@Hidden
attr Frame_Color = "#999999"

@Group("Windows") @Order(5) @Enum("CE Blue","CE Dark Blue","CE Green","CE Brown","CE Black","iRay Glass")
@Hidden
attr Glass_Material = "CE Dark Blue"

## Walls

@Group("Walls",4) @Order(1) @File
@Hidden
attr Wall_Texture = fileRandom("wall_textures/concrete/wall_concrete_*.jpg")
@Group("Walls") @Order(2) @Color
@Hidden
attr Wall_Color ="#ffffff"

@Group("Walls") @Order(3) @Range(min=0.2, max=0.7, restricted=false) @Distance
@Hidden
attr Wall_Thickness = 0.4

@Group("Walls") @Order(4) @Range(min=0.2, max=1, restricted=false) @Distance
@Hidden
attr Slab_Thickness = 0.7

@Group("Walls") @Order(5) @Range(min=0, max=1, restricted=false) @Distance
@Hidden
attr Parapet_Height = 0.4

## Balconies

@Group("Balconies",5) @Order(2) @Range(min=0, max=5, restricted=false) @Distance
@Hidden
attr Balcony_Depth = 2

@Group("Balconies") @Order(4) @Range(min=0.7, max=1.1, restricted=false) @Distance
@Hidden
attr Railing_Height = 1

## Panels

@Group("Panels",6) @Order(1) @Enum("None","On Sides", "All") @Description("Turn on to split the whole model into rectangular panels (usable e.g. for analysis)")
@Hidden
attr Panels_Generate = "None"

@Group("Panels") @Order(2) @Range(min=1, max=20, restricted=false) @Distance @Description("Note that panel size is adjusted/rounded to the geometry's dimensions on the side")
@Hidden
attr Panel_Size = 5

@Group("Panels") @Order(3) @Range(min=0, max=3, restricted=false) @Distance @Description("Distance of the sampling point in front of the panel's center.")
@Hidden
attr Panel_Sampling_Point_Distance = 0.1



## Hidden Attributes used for Reporting ########################

@Hidden
attr floorIdx = -1
@Hidden
attr nFloors = -1
@Hidden
attr tileIdx = -1
@Hidden
attr nTiles = -1


## Hidden Attributes driven by Master Rule ########################

@Hidden
attr Ground_Floor_Height = 5
@Hidden
attr Standard_Floor_Height = 4


################################################################
## CONSTANTS
##

const frameDepth = case highLOD: Frame_Depth else: 0
const winSetback = 
    case lowLOD							: 0
    case Win_Position == "Outside Flush": 0
    case Win_Position == "Inside Flush"	: Wall_Thickness-frameDepth-0.02
    else 								: Wall_Thickness/2-frameDepth/2		# Wall Center

# just for short notations
const walW = Wall_Width
const winW = Win_Width
const panW = Panel_Width
const balW = Balcony_Width
const lowLOD 	= ModelLevel == "Low" 
const midLOD 	= ModelLevel == "Medium"
const highLOD 	= ModelLevel == "High"

################################################################
## FUNCTIONS
##

getWallBottom 		= case floorIdx > 0: Cill_Height else: 0
getWinHeight		= case floorIdx > 0: Win_Height  else: Win_Height + Cill_Height + Ground_Floor_Height - Standard_Floor_Height
adjustWallHeight 	= case floorIdx==nFloors-1: scope.sy+Parapet_Height else: scope.sy

# pattern switching
isConstant = Odd_floor_type=="o[WO]*Wo" || Even_floor_type=="o[WO]*Wo" || Odd_floor_type=="O[Wo]*WO" || Even_floor_type=="O[Wo]*WO" # patterns which need to go all around
mainPattern = 
    case front || rear || isConstant: case even(floorIdx): Odd_floor_type else: Even_floor_type  # in case of an even floor, we take pattern A, otherwise pattern B
    else                            : case even(floorIdx): Even_floor_type else: Odd_floor_type  # on the left and right we alternate the two patterns different
balconyPattern = 
    case BalconyType=="Alternating": case even(floorIdx): "[WB]*W" else: "b[WB]*Wb"
    else                               : BalconyType	
    
# utils
even(val) 	= val % 2 == 0
uneven(val) = val % 2 == 1
rear  = geometry.isOriented(object.back)
left  = geometry.isOriented(object.left)
right = geometry.isOriented(object.right)
front = geometry.isOriented(object.front)

# for adjacency checks & handling
adjacentToBalconiesOnRight = left&&BalconiesWindows=="On Front"  || right&&BalconiesWindows=="On Rear"
adjacentToBalconiesOnLeft  = right&&BalconiesWindows=="On Front" || left&&BalconiesWindows=="On Rear"
windowsOnCorners = case mainPattern == "o[WO]*Wo" || mainPattern == "O[Wo]*WO": 1 else: 0
balconyOnCorners = case balconyPattern == "b[WB]*Wb": 1 else: 0

# for balcony tile
glassBalconyLeft  = case tileIdx == 0       : 0 else: (1+floorIdx%2)*panW
glassBalconyRight = case tileIdx == nTiles-1: 0 else: (1+floorIdx%2)*panW

# for panels
getWorldDir = 
    case geometry.isOriented(world.north)	: "north"
    case geometry.isOriented(world.south)	: "south"
    case geometry.isOriented(world.west)	: "west"
    case geometry.isOriented(world.east)	: "east"
    case geometry.isOriented(world.up)		: "up"
    else									: "down"
getLocalDir = 
    case geometry.isOriented(object.front)	: "front"
    case geometry.isOriented(object.back)	: "rear"
    case geometry.isOriented(object.left)	: "left"
    case geometry.isOriented(object.right)	: "right"
    case geometry.isOriented(object.top)	: "top"
    else									: "bottom"	






##1 Building Height ################################

@Group("Building Height",1) 

@Order(1) @Range(min=2, max=80, stepsize=1, restricted=false)
//@Handle(shape=Envelope)
attr FloorNumbles = 7


##2 FloorStyle ################################

@Group("FloorStyle",2) 
@Order(3) @Enum("None","2 Stepbacks","2nd Floor","Top Floor","Increasing","Decreasing","Alternating","Random")
attr SelectType = "None"

@Order(4) @Range(min=0, max=10, restricted=false) @Distance
//@Hidden
attr OffsetDistance = 2


@Hidden
attr Lot_Area = geometry.area
@Hidden
attr Elevation = scope.elevation

    
getHeight(nFloors) = Ground_Floor_Height + (nFloors-1)*Standard_Floor_Height
getFloorHeight(idx) = case idx == 0: Ground_Floor_Height else: Standard_Floor_Height
    
const avgAptSize = 76.6
const spacePerEmployee_office = 23.2
const spacePerEmployee_retail = 46.5







################################################################
################################################################
## #################RULES 执行规则   ###############################
################################################################
################################################################





@StartRule
@InPolygon

Footprint -->
    Footprint(0,1) # default case

Footprint(idx,n) -->
    alignScopeToAxes(y) s('1,0,'1) t(0,Elevation-scope.elevation,0)
    report("Footprint Area (m2)",geometry.area)
    report("Lot Coverage (%)",geometry.area/Lot_Area*100)
    extrude(getHeight(FloorNumbles))
    Envelope 
    
Envelope -->
    split(y){   ~Ground_Floor_Height: FloorEnvelope(split.index,split.total) 
            | { ~Standard_Floor_Height: FloorEnvelope(split.index,split.total) }* }

FloorEnvelope(idx,n) -->
    s('1,0.02,'1) t(0,'-1,0) comp(f){top: FloorArea(idx,n) }

FloorArea(idx,n) -->
    case SelectType == "None":
        Floor(idx,n)
    case SelectType == "2nd Floor" && idx > 1:
        setback(OffsetDistance){ object.front: NIL | remainder: Floor(idx,n) }		
    case SelectType == "Top Floor" && idx == n-1:
        setback(OffsetDistance){ object.front: NIL | remainder: Floor(idx,n) }		
    case SelectType == "2 Stepbacks" && idx > n*0.8:
        setback(OffsetDistance){ object.front: NIL | remainder: Floor(idx,n) }		
    case SelectType == "2 Stepbacks" && idx > n*0.5:
        setback(OffsetDistance/2){ object.front: NIL | remainder: Floor(idx,n) }		
    case SelectType == "Increasing":
        setback(OffsetDistance*idx/(n-1)){ object.front: NIL | remainder: Floor(idx,n) }		
    case SelectType == "Decreasing":
        setback(OffsetDistance*(1-idx/(n-1))){ object.front: NIL | remainder: Floor(idx,n) }		
    case SelectType == "Alternating" && idx%2 == 1:
        setback(OffsetDistance){ object.front: NIL | remainder: Floor(idx,n) }		
    case SelectType == "Random":
        30% : setback(OffsetDistance){ object.front: NIL | remainder: Floor(idx,n) }
        30% : setback(OffsetDistance){ object.back: NIL | remainder: Floor(idx,n) }
        else: Floor(idx,n)
    else:
        Floor(idx,n)
        
Floor(idx,n) --> 
    case idx < 2:
        extrude(getFloorHeight(idx)) FloorMass(idx,n)
    else:
        extrude(getFloorHeight(idx)) FloorMass(idx,n)

        
FloorMass(idx,n) -->
    case !ShowModel:
        case Transparent:
            set(material.opacity,0.5)
            set(ShowModel, true)
            Mass.
            Reports_FloorMass
        else:
            set(ShowModel, true)
            Mass.
            Reports_FloorMass
    else:
        set(ShowModel, true)
        set(floorIdx,idx) set(nFloors,n)
        comp(f){ side: FloorSide }
        Slab
        Reports_FloorMass

## Floor ################################

Reports_FloorMass -->
    comp(f) { top: NIL | bottom: NIL
            | world.south: report("FacadeOrientation.South", geometry.area)
            | world.east: report("FacadeOrientation.East", geometry.area)
            | world.west: report("FacadeOrientation.West", geometry.area)
            | world.north: report("FacadeOrientation.North", geometry.area) }

FloorSide -->	
    setupProjection(0, scope.xy, ~4, ~4, 0, 0, 1)
    s('1,adjustWallHeight,'1)
    split(y){ getWallBottom: Wall | getWinHeight: FloorPattern | ~1: Wall }

FloorPattern --> 
    case front && BalconiesWindows=="On Front" || rear && BalconiesWindows=="On Rear":
        BalconyPattern 		 
    case SideType != "Same as Main":
        case left || right: SidePattern else: MainPattern
    else: 
        MainPattern

## Main Pattern --------------------

MainPattern --> 
    case adjacentToBalconiesOnRight:
        split(x){ ~1: MainPatternDispatcher | windowsOnCorners*walW: Wall | balconyOnCorners*(balW+walW)/2: Balcony }
    case adjacentToBalconiesOnLeft:
        split(x){ balconyOnCorners*(balW+walW)/2: Balcony | windowsOnCorners*walW: Wall | ~1: MainPatternDispatcher }
    else:
        MainPatternDispatcher
        
MainPatternDispatcher -->
    case mainPattern == "[WO]*W": 
        split(x){ { ~walW: Wall | winW: Tile }* | ~walW: Wall }
    case mainPattern == "o[WO]*Wo":
        split(x){ winW/2+walW/2: Tile | { ~walW: Wall | winW: Tile }* | ~walW: Wall | winW/2+walW/2: Tile }
    case mainPattern == "O[Wo]*WO": #hmm
        //split(x){ winW+walW/2: Tile | { ~walW: Wall | winW/2: Tile }* | ~walW: Wall | winW+walW/2: Tile }
        split(x){ winW+walW/2: Tile | { ~walW: Wall | panW: Tile }* | ~walW: Wall | winW+walW/2: Tile }
    case mainPattern == "wo[WO]*Wow":
        //split(x){ ~walW/2: Wall | winW/2: Tile | { ~walW: Wall | winW: Tile }* | ~walW: Wall | winW/2: Tile | ~walW/2: Wall }
        split(x){ ~walW/2: Wall | panW: Tile | { ~walW: Wall | winW: Tile }* | ~walW: Wall | panW: Tile | ~walW/2: Wall }
    case mainPattern == "Wo[WO]*WoW":
        //split(x){ ~walW: Wall | winW/2-walW/2: Tile | { ~walW: Wall | winW: Tile }* | ~walW: Wall | winW/2-walW/2: Tile | ~walW: Wall }
        split(x){ ~walW: Wall | panW: Tile | { ~walW: Wall | winW: Tile }* | ~walW: Wall | panW: Tile | ~walW: Wall }
    case mainPattern == "WO[Wo]*WOW":
        //split(x){ ~walW: Wall | winW-walW/2: Tile | { ~walW: Wall | winW/2: Tile }* | ~walW: Wall | winW-walW/2: Tile | ~walW: Wall }
        split(x){ ~walW: Wall | winW-walW/2: Tile | { ~walW: Wall | panW: Tile }* | ~walW: Wall | winW-walW/2: Tile | ~walW: Wall }
    case mainPattern == "Rhythm1":
        split(x){ ~walW/2: Wall | { winW+walW: Tile }* | ~walW/2: Wall }
    else:
        Wall

## Side Pattern --------------------

SidePattern -->
    case adjacentToBalconiesOnRight:
        case scope.sx < winW+walW:
            case balconyPattern == "b[WB]*Wb": Balcony else: Wall
        else:
            split(x){ windowsOnCorners*(winW+walW)/2: Tile | ~1: SidePatternDispatcher | balconyOnCorners*(balW+walW)/2: Balcony }
    case adjacentToBalconiesOnLeft:
        case scope.sx < winW+walW:
            case balconyPattern == "b[WB]*Wb": Balcony else: Wall
        else:
            split(x){ balconyOnCorners*(balW+walW)/2: Balcony | ~1: SidePatternDispatcher | windowsOnCorners*(winW+walW)/2: Tile }
    else:
        split(x){ windowsOnCorners*(winW+walW)/2: Tile | ~1: SidePatternDispatcher | windowsOnCorners*(winW+walW)/2: Tile }


SidePatternDispatcher -->
    case SideType == "WOW":
        split(x){ ~1: Wall | winW: Win | ~1: Wall }
    case SideType == "WoW":
        split(x){ ~1: Wall | panW: Win | ~1: Wall }
    case SideType == "wOWOw":
        split(x){ walW: Wall | winW: Win | ~1: Wall | winW: Win | walW: Wall }
    case SideType == "woWow":
        split(x){ walW: Wall | panW: Win | ~1: Wall | panW: Win | walW: Wall }
    case SideType == "woW":
        case right: split(x){ walW: Wall | panW: Win | ~1: Wall }
        else      : split(x){ ~1: Wall | panW: Win | walW: Wall }
    case SideType == "wOwoW":
        case right: split(x){ walW: Wall | winW: Win | walW: Wall | panW: Win | ~1: Wall }
        else      : split(x){ ~1: Wall | panW: Win | walW: Wall | winW: Win | walW: Wall }
    case SideType == "w[oW]*w":
        case right&&even(floorIdx) || left&&uneven(floorIdx): split(x){ walW: Wall | { panW: Win | ~walW*4: Wall }* }
        else                                                : split(x){ { ~walW*4: Wall | panW: Win }* | walW: Wall }
    else:
        Wall
        
## Balcony Pattern --------------------

BalconyPattern -->
    case balconyPattern == "[WB]*W":
        case scope.sx < winW+walW:
            Wall 
        else:
            split(x){ { walW: Wall | ~balW: Balcony }* | walW: Wall }
    case balconyPattern == "b[WB]*Wb":
        case scope.sx < winW+walW:
            Balcony 
        else:
            split(x){ ~(balW+walW)/2: Balcony | { walW: Wall | ~balW: Balcony }* | walW: Wall | ~(balW+walW)/2: Balcony }
    else:
        Balcony


## Tile ################################

Tile -->
    set(tileIdx,split.index) set(nTiles,split.total)
    TileDispatcher
        
TileDispatcher -->
    case mainPattern == "Rhythm1":
        case even(floorIdx+tileIdx)	: split(x){ walW/2: Wall | ~winW/2: Win }* 
        else						: split(x){ ~winW/2: Win | walW/2: Wall }*
    else:
        Win
    //Rail 


## Balcony ################################


Balcony -->
    case scope.sx < winW+walW: Balcony(0,0) else:
        set(tileIdx,split.index) set(nTiles,split.total)
        Balcony(glassBalconyLeft,glassBalconyRight)

Balcony(winWidthLeft,winWidthRight) -->
    case lowLOD:
        split(x){ winWidthLeft : Win(0) 
                | ~1 : Rail s(scope.sx-winSetback,'1,-Balcony_Depth+Wall_Thickness) t(winSetback/2,0,0) primitiveCube() comp(f){ front: NIL | side: Win(0) }
                | winWidthRight: Win(0) }
    else:		
        Rail t(0,0,-winSetback)
        split(x){ winWidthLeft : Win(0) 
                | ~1 : s(scope.sx-winSetback,'1,-Balcony_Depth+Wall_Thickness) t(winSetback/2,0,0) primitiveCube() comp(f){ front: NIL | side: Win(0) }
                | winWidthRight: Win(0) }



## Windows ################################
    
Win -->
    case lowLOD:
        Win(0)
    else:	
        Win(winSetback)	
    
Win(dz) -->
    case lowLOD || Frame_Width <= 0: 
        t(0,0,-dz) trim 
        Glass
    else:
        t(0,0,-dz) trim 
        split(y){ Frame_Width : Frame 
                | ~1: split(x){ Frame_Width: Frame | { ~panW: t(0,0,-frameDepth/2) Glass | Frame_Width: Frame }* }
                | Frame_Width : Frame }

Frame --> 
    case frameDepth > 0:
        report("Facade.Frame", geometry.area(front))
        extrude(-frameDepth) trim
        color(Frame_Color)
    else:
        report("Facade.Frame", geometry.area(front))
        color(Frame_Color)		
            
Glass -->
    GlassMaterial
    Reports_Glass
    
GlassMaterial -->
    case Glass_Material == "CE Blue":
        color(0.7,0.75,1)
        set(material.ambient.r,0) set(material.ambient.g,0) set(material.ambient.b,1)
        set(material.specular.r,0.8) set(material.specular.g,0.8) set(material.specular.b,0.8)
        set(material.reflectivity,0.8) set(material.shininess,50) set(material.opacity,0.6)	GlassPanels
    case Glass_Material == "CE Dark Blue":
        color(0.2,0.2,0.25)
        set(material.ambient.r,0) set(material.ambient.g,0) set(material.ambient.b,0.1)
        set(material.specular.r,0.8) set(material.specular.g,0.8) set(material.specular.b,0.8)
        set(material.reflectivity,0.6) set(material.shininess,50) set(material.opacity,0.8)	GlassPanels
    case Glass_Material == "CE Green":
        color(0.4,0.5,0.4)
        set(material.ambient.r,0) set(material.ambient.g,0.2) set(material.ambient.b,0.05)
        set(material.specular.r,0.8) set(material.specular.g,0.8) set(material.specular.b,0.8)
        set(material.reflectivity,0.8) set(material.shininess,50) set(material.opacity,0.6)	GlassPanels
    case Glass_Material == "CE Brown":
        color(0.3,0.25,0.2)
        set(material.ambient.r,0.2) set(material.ambient.g,0.1) set(material.ambient.b,0)
        set(material.specular.r,0.8) set(material.specular.g,0.8) set(material.specular.b,0.8)
        set(material.reflectivity,0.8) set(material.shininess,50) set(material.opacity,0.6)	GlassPanels
    case Glass_Material == "CE Black":
        color(0.1,0.1,0.1)
        set(material.specular.r,0.8) set(material.specular.g,0.8) set(material.specular.b,0.8)
        set(material.reflectivity,0.7) set(material.shininess,50) set(material.opacity,0.8)	GlassPanels
    case Glass_Material == "iRay Glass":
        color(0.35,0.37,0.5)
 		set(material.specular.r,0.8) set(material.specular.g,0.8) set(material.specular.b,0.8)
  		set(material.reflectivity,0.8) set(material.shininess,128) set(material.opacity,0.8) GlassPanels
    else:
        color(1,1,1)
        set(material.opacity,0.8) GlassPanels

GlassPanels -->
    case Panels_Generate == "None":
        Glass.
    else:
        Panels("Glass")

Reports_Glass -->
    report("Facade.Glass", geometry.area(front))
    NIL		

## Wall ################################

Wall -->
    case lowLOD: 
        WallSide
    else: 
        Wall(Wall_Thickness)

Wall(thickness) -->
    case midLOD: 
        s('1,'1,thickness) t(0,0,'-1) 
        primitiveCube() WallSide
    else:
        s('1,'1,thickness) t(0,0,'-1) 
        primitiveCube() comp(f){ side = WallSide | all = WallSideProj}

WallSideProj -->
    setupProjection(0, scope.xy, ~4, 4)
    WallSide

WallSide -->
    projectUV(0) texture(Wall_Texture)
    color(Wall_Color) set(material.ambient.r,0.2) set(material.ambient.g,0.2) set(material.ambient.b,0.2)
    report("Facade.Wall", geometry.area(front))
    WallPanels

WallPanels -->
    case Panels_Generate == "None":
        Wall.
    else:
        Panels("Wall")


## Railing ################################
        
Rail --> 
    case floorIdx == 0 || scope.sx < panW*1.5:
        NIL
    else:
        t(0,0,-winSetback*0.5) split(y){ Railing_Height: trim RailLoop(20) } NIL
        
RailLoop(n) -->
    case n > 0: RailLoop(n-1) else: Glass # just a gimmick for CE: draw the railing at last (so that the alpha looks good)


## Slab ################################

Slab -->
    case lowLOD:
        comp(f){ top: GravelRoof }
    else:
        split(y){ 0.05: NIL | ~1: comp(f){ bottom: Flooring | top: Ceiling } | Slab_Thickness: NIL }	
    
Ceiling -->
    offset(-Wall_Thickness,inside) extrude(Slab_Thickness-0.05)
    comp(f){ top: GravelRoof | all = color("#ffffff") Ceiling. }

Flooring -->
    offset(-Wall_Thickness,inside) extrude(0.05)
    comp(f){ top: WallSideProj | all = color("#333339") Flooring. }

GravelRoof -->
    color("#ffffff")
    setupProjection(0,scope.xy,10,10) projectUV(0)
    //texture("streets/textures/Gravel.jpg")
    texture("wall_textures/concrete/wall_concrete_4.jpg")
    RoofPanels

RoofPanels -->
    case Panels_Generate != "All":
        Roof.
    else:
        Panels("Roof")


## Panels ################################

Panels(type) -->	
    split(x,noAdjust){ ~Panel_Size: split(y){ ~Panel_Size: Panel(type) }* }*			# THE split

Panel(type) -->
    case geometry.area() < 0.02:
        NIL
    else:
        alignScopeToGeometry(zUp,0,world.lowest)
        texture("")
        report("ID",seedian) 																		# switching off texture
        report("Type",type) report("Area",geometry.area)
        report("Local Orientation",getLocalDir) report("World Orientation",getWorldDir) 
        Panel.
        [ s(0,0,0) center(xyz) t(0,0,Panel_Sampling_Point_Distance) 
          comp(v){ 0: report("Z",scope.elevation) SamplingPoint. } ]




################################################################
## ADDITIONAL/OVERWRITE RULES 
##

style Residential_3

## Floor Left ################################

//FloorPatternLeftOCCL -->
MainPatternDispatcher -->
    case even(floorIdx):	
        case touches(intra):
            Wall
        else:
            split(x){ panW: Wall | { ~winW*2/3: TilePatternSide. }* | 2*panW: Win | panW+Balcony_Depth+winSetback:  Wall } 
    else : 
        case inside(intra):
            split(x){ ~1: Wall(Wall_Thickness) | Wall_Thickness: NIL }
            split(x){ ~1: s('1,'1,Balcony_Depth*2) t(0,0,'-1) primitiveCube() comp(f){ right: Windows. } | Balcony_Depth+winSetback: NIL }
        case touches(intra):
            split(x){ '0.5: WallCheck | '0.5: set(trim.vertical,false) WallCheck }*
            split(x){ ~1: s('1,'1,Balcony_Depth*2) t(0,0,'-1) primitiveCube() comp(f){ right: Windows. } | Balcony_Depth+winSetback: NIL }
        else:
            split(x){ { ~winW: TilePatternSide. }* | 2*panW+Balcony_Depth+winSetback: Balcony }

WallCheck -->
    case inside(intra): NIL
    else: Wall(Wall_Thickness*2)

## Floor Right ################################

FloorPatternRightOCCL -->  
    case even(floorIdx):	
        case touches(intra):
            Wall
        else:
            split(x){ panW+Balcony_Depth+winSetback: Wall | 2*panW: Tile | { winW*2/3: TilePatternSide. }* | panW: Wall } 
    else : 
        case inside(intra):
            split(x){ Wall_Thickness: NIL | ~1: Wall(Wall_Thickness) }
            split(x){ Balcony_Depth+winSetback: NIL | ~1: s('1,'1,Balcony_Depth*2) t(0,0,'-1) primitiveCube() comp(f){ left: Windows. } }
        case touches(intra):
            split(x){ '0.5: set(trim.vertical,false) WallCheck | '0.5: WallCheck }*
            split(x){ Balcony_Depth+winSetback: NIL | ~1: s('1,'1,Balcony_Depth*2) t(0,0,'-1) primitiveCube() comp(f){ left: Windows. } }
        else:
            split(x){ 2*panW+Balcony_Depth+winSetback: Balcony | { winW: TilePatternSide. }*  }	

## Floor Balconies ################################


 

分享到 :
相关推荐

ArchitecturalPro-1.0

 ArchitecturalPro-1.0-CN &nbs[&h...

厂房模型数据版(英文)

  源码声明:本站所有文章,如无特殊说明或标注,均为本站原[&h...

商业建筑单体设计版

DesignCommercialBuildings商业建筑单体设计版(CE-UE)[...

BuildingStylePro

BuildingStyle_V0.2.zip声明:本站所有文章,如无特殊说明或标注[...

发表回复

登录... 后才能评论