Select to view content in your preferred language

How to write code for this upper blue floor ?

925
2
03-06-2019 09:46 PM
ShubhamBhatia
Emerging Contributor

For my work, I need to create similar upper floor  (Blue) over extruded footprints. It will be very helpful if you could share the code to achieve this. 

Thanks in advance.

0 Kudos
2 Replies
DevinLavigne
Frequent Contributor

Your solution is the same one I just posted on another thread....

Footprint--> extrude(120) comp(f) {top: Roof1 Roof2 | side: Wall}

Roof1--> something ...

Roof2--> something else....like making it smaller, extruding for a parapet, texturing...

ImranKhan_P
Regular Contributor

Hi Shubham,

You can use the following sample CGA Rule

/**
 * File:    split.cga
 * Created: 8 Mar 2019 05:09:16 GMT
 * Author:  Imran Khan
 */

version "2018.0"

attr height = 1200
attr floor_ht = height/3

Footprint -->
	extrude(height)
    split(y){floor_ht:groundFloor|floor_ht:middleFloor|floor_ht:topFloor}
    
groundFloor -->
color (0.3,0.3,0.2,0.5)
x.

middleFloor -->
color (0.3,0.5,0.8,0.5)
s(400,400,800)
center(xz)
x.

topFloor -->
color (0.3,0.5,0,0.5)
s(200,200,400)
center(xz)
x.

The Output will be

Splitting Building into Floors

0 Kudos