Hello,
I have a problem regarding importing some texture jpgs as texture for roof and then creating a rule that gives me the possibility to choose a texture for a random roof from those 4 jpgs.
I have 4 types of roofs and I created a rule that those 4 textures would apply for a specific roof type but I want also to be able to change the texture without changing the type.
Example : for Pyramid type I have a Zinc texture, but also I want to be able for the same type to change to a Slate texture
Can you help me please?
This is the rule :
attr Height = 4
@Range ( "pyramid", "shed", "gable", "hip")
attr RoofType = "random"
attr RoofHeight = rand (4,6)
const function_RoofType =
case RoofType == "random" :
30% : "pyramid"
20% : "shed"
20% : "hip"
else : "gable"
else : RoofType
##Casa1##
Casa1 -->
extrude(world.y, Height)
Cladire
Cladire -->
comp(f) {side: SideFacade | top: Roof }
Roof -->
case function_RoofType == "shed" :
roofShed(45)
s('1,RoofHeight,'1) # scale to the correct height
setupProjection (1, scope.xy, scope.sx, scope.sy)
texture("Paris/assets/parisianRoofs/slate.png")
projectUV(0)
case function_RoofType == "hip" :
roofHip(45)
s('1,RoofHeight,'1) # scale to the correct height
setupProjection (1, scope.xy, scope.sx, scope.sy)
texture("Paris/assets/parisianRoofs/tile.png")
projectUV(0)
case function_RoofType == "gable" :
roofGable(45)
s('1,RoofHeight,'1) # scale to the correct height
setupProjection (1, scope.xy, scope.sx, scope.sy)
texture("Paris/assets/parisianRoofs/zinc1.png")
projectUV(0)
else :
roofPyramid(45)
s('1,RoofHeight,'1) # scale to the correct height
setupProjection (1, scope.xy, scope.sx, scope.sy)
texture("Paris/assets/parisianRoofs/zinc2.png")
projectUV(0)
SideFacade -->
setupProjection(0, scope.xy, '1, '1)
projectUV(0)
texture("Textura/casa1-2.jpg")
Solved! Go to Solution.
You can make the line that selects the texture an attribute.
e.g
attr Texture = ("Paris/assets/parisianRoofs/slate.png")
so it will look like this.
.......................
Roof -->
case function_RoofType == "shed" :
roofShed(45)
s('1,RoofHeight,'1) # scale to the correct height
setupProjection (1, scope.xy, scope.sx, scope.sy)
texture(Texture)
.....................
You can make the line that selects the texture an attribute.
e.g
attr Texture = ("Paris/assets/parisianRoofs/slate.png")
so it will look like this.
.......................
Roof -->
case function_RoofType == "shed" :
roofShed(45)
s('1,RoofHeight,'1) # scale to the correct height
setupProjection (1, scope.xy, scope.sx, scope.sy)
texture(Texture)
.....................
I have 4 pngs that I want to use as textures and to be able to choose between them.
In the case you wrote for the shed type, automatically the texture will be slate.png.
How should I write to be able to choose between those 4 textures?
Thanks !
Yeah. it will give you the slate.png as the default in the rule but since Texture will appear on the inspector you can browse any other file to replace the slate.png besides your four textures
I've moved your post into the CityEngine space. You will get a much better answer here as posting to the entire community allows everyone to see it on the home page, but no one is notified of your recent activity like a group can do. You can see more on the community structure, and what topics are under each space from the following documents:
ArcGIS Discussion Forums Migration Strategy
Thanks!
Timothy
Thank you !