Hi, this is a code that I made to graph the population and houses by block attributes in a model, it's a simple code that I wanted to share
Also, I have a blog were I post some of the my work in CE, cheers
GDA – Arquitectura desde SIG, BIM y Programación
CODE
@Order(0)@Range("Habitantes", "Viviendas")
attr Visualizacion = "Habitantes"
attr NumeroHabitantes = 0
attr NumeroViviendas = 0
@Range("Si","No")
attr Gradiente = "No"
@Hidden
attr Alt = 100
@Hidden
attr DiferenciaCotas = 0
##################################CODIGO####################################
Lot -->
alignScopeToAxes(y)
DiferenciaCota(scope.sy)
DiferenciaCota(Dif) -->
extrude(world.y, Alt)
split(y){Dif: Base | ~1:NIL}
Base -->
set(DiferenciaCotas, scope.sy)
comp(f){top: AreaExtr | all: NIL}
AreaExtr -->
alignScopeToAxes(y)
t(0,-DiferenciaCotas,0)
NIL
Cyl
Cyl -->
case Visualizacion == "Habitantes" :
i("Cyl2.DAE")
s(40,(NumeroHabitantes)+DiferenciaCotas,40)
center(xyz)
t(0,((NumeroHabitantes)+DiferenciaCotas)/2,0)
set(material.opacity,0.8)
Colorizacion
else:
i("Cyl2.DAE")
s(40,((NumeroViviendas)+DiferenciaCotas)*2,40)
center(xyz)
t(0,((NumeroViviendas)+DiferenciaCotas)/2,0)
set(material.opacity,0.8)
Colorizacion
Colorizacion -->
case Gradiente == "Si":
case Visualizacion == "Habitantes":
color(NumeroHabitantes/100+0.01, 0,0.3)
else:
color(0.2,0,NumeroViviendas/50+0.01)
else:
case Visualizacion == "Habitantes":
color(1,.2,0)
else:
color(.2,.2,1)
You could use primitiveCylinder() instead of importing a model, it's a bit more flexible.