<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Conditional Rules for Assets in ArcGIS CityEngine Questions</title>
    <link>https://community.esri.com/t5/arcgis-cityengine-questions/conditional-rules-for-assets/m-p/700347#M9175</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So what I'm trying to do is create a model that can choose random brick textures, and then when it selects those brick textures I want it to be able to determine the setupProjection sizes from set sizes depending on which textures it's chosen eg:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;attr wall_tex = fileRandom("assets/monier/monier_bricks/*Mortar.jpg")
attr wall_normal = substring(wall_tex,0,find(wall_tex,"-",1))+"-normal.jpg" 
attr wall_spec = substring(wall_tex,0,find(wall_tex,"-",1))+"-specular.jpg"

const frontTexWidth =&amp;nbsp; case wall_tex == ("assets/monier/monier_bricks/*Metro*Mortar.jpg") : 1.44
 case wall_tex == ("assets/monier/monier_bricks/*Mezzo*Mortar.jpg") : 1.44
 case wall_tex == ("assets/monier/monier_bricks/*Presto*Mortar.jpg") : 2.16
 case wall_tex == ("assets/monier/monier_bricks/*Block*Mortar.jpg") : 1.8
 else : 5.76 
const frontTexHeight =&amp;nbsp; case wall_tex == ("assets/monier/monier_bricks/*Metro*Mortar.jpg") : 0.84
 case wall_tex == ("assets/monier/monier_bricks/*Mezzo*Mortar.jpg") : 1.29
 case wall_tex == ("assets/monier/monier_bricks/*Presto*Mortar.jpg") : 1.72
 case wall_tex == ("assets/monier/monier_bricks/*Block*Mortar.jpg") : 1.032
 else : 1.72

Wall --&amp;gt;
 setupProjection(0, scope.xy, frontTexWidth,frontTexHeight) 
 texture(wall_tex)
 projectUV(0)
 projectUV(1)
 set(material.specularmap, wall_spec)
 projectUV(3)
 set(material.normalmap, wall_normal)&amp;nbsp; 
&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here my specular and normal maps don't seem to be working either.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I then want to be able to select random window textures, but using a conidtional rule where the window type can be small or large, and depending on what it chooses:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;@Range ("small","large")
attr winType = "" # This isn't defined in my object attributes but I want it to randomally choose one type for each house.

attr window_tex&amp;nbsp; = case winType == "small" : fileRandom("assets/window/houseWindow/windowSize1_*.JPG")
 case winType == "large" : fileRandom("assets/window/houseWindow/windowSize2_*.JPG")
 else : fileRandom("assets/window/houseWindow/windowSize1_*.JPG")

&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;SPAN&gt;Unfortunately though it only seems to choose one window ie one small window for the whole model rather than a selection of small windows.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thirdly I'd like to insert my roof texture depending on random files and again adjust the setupProjection depending on the file sizes:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;@Range("Gable","Hip","Flat")
attr RoofType = ""

attr roofAngle = 22.5
attr gableOverhang = 0.4
attr hipOverhang = 0.5

const rooftile_tex&amp;nbsp;&amp;nbsp; = 50% : fileRandom("assets/monier/monier tiles/portuguese*-normal.png")
 else : fileRandom("assets/monier/monier tiles/hacienda*-normal.png")

const roofTexWidth =&amp;nbsp; case rooftile_tex == ("assets/monier/monier tiles/portuguese*-normal.png") : 2.0
 else : 2.1
const roofTexHeight =&amp;nbsp; case rooftile_tex == ("assets/monier/monier tiles/portuguese*-normal.png") : 2.0
 else : 2.54

Roof --&amp;gt;
 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)
...&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;SPAN&gt;I haven't placed all the code but hopefully enough to give you an idea of what I want...except again it's not working quite right! It doesn't seem to be registering my delection of textures, so I was wondering if that naming convention was correct or not for the selection?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;lastly I have doors...which do come in beautifully but alas only seem to be producing the narrow doors and not the wide ones, so I'm wondering what I'm missing?&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;@Range ("singleDoor","doubleDoor")
attr doorType = "" # This isn't specified in object attr but want a random selection of either

attr frontdoor_tex&amp;nbsp; =&amp;nbsp; case doorType == "singleDoor" : fileRandom("assets/Doors/frontDoors/singleDoor_*.JPG")
 case doorType == "doubleDoor" : fileRandom("assets/Doors/frontDoors/doubleDoor_*.JPG")
 else : fileRandom("assets/Doors/frontDoors/singleDoor_*.JPG")

const doorWidth = case doorType == "singleDoor" : 0.97
 case doorType == "doubleDoor" : 15
 else : 0.97
const doorHeight = 2.04&amp;nbsp; 

Entrance --&amp;gt;
&amp;nbsp; split(x) { ~1: SolidWall
&amp;nbsp; | doorWidth: split(y){doorHeight : Door | ~2: SolidWall}
&amp;nbsp; | ~1: SolidWall}

Door --&amp;gt;
 s('1,'1,0.1)
 t(0,0,-0.2)
 texture(frontdoor_tex)
 i("builtin:cube")&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I hope I've put enough info in for you to understand...and sorry for the length! Just wanting to get a bit more complex in my models now!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 10 Jul 2013 22:33:24 GMT</pubDate>
    <dc:creator>JoanneO_Brien</dc:creator>
    <dc:date>2013-07-10T22:33:24Z</dc:date>
    <item>
      <title>Conditional Rules for Assets</title>
      <link>https://community.esri.com/t5/arcgis-cityengine-questions/conditional-rules-for-assets/m-p/700347#M9175</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So what I'm trying to do is create a model that can choose random brick textures, and then when it selects those brick textures I want it to be able to determine the setupProjection sizes from set sizes depending on which textures it's chosen eg:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;attr wall_tex = fileRandom("assets/monier/monier_bricks/*Mortar.jpg")
attr wall_normal = substring(wall_tex,0,find(wall_tex,"-",1))+"-normal.jpg" 
attr wall_spec = substring(wall_tex,0,find(wall_tex,"-",1))+"-specular.jpg"

const frontTexWidth =&amp;nbsp; case wall_tex == ("assets/monier/monier_bricks/*Metro*Mortar.jpg") : 1.44
 case wall_tex == ("assets/monier/monier_bricks/*Mezzo*Mortar.jpg") : 1.44
 case wall_tex == ("assets/monier/monier_bricks/*Presto*Mortar.jpg") : 2.16
 case wall_tex == ("assets/monier/monier_bricks/*Block*Mortar.jpg") : 1.8
 else : 5.76 
const frontTexHeight =&amp;nbsp; case wall_tex == ("assets/monier/monier_bricks/*Metro*Mortar.jpg") : 0.84
 case wall_tex == ("assets/monier/monier_bricks/*Mezzo*Mortar.jpg") : 1.29
 case wall_tex == ("assets/monier/monier_bricks/*Presto*Mortar.jpg") : 1.72
 case wall_tex == ("assets/monier/monier_bricks/*Block*Mortar.jpg") : 1.032
 else : 1.72

Wall --&amp;gt;
 setupProjection(0, scope.xy, frontTexWidth,frontTexHeight) 
 texture(wall_tex)
 projectUV(0)
 projectUV(1)
 set(material.specularmap, wall_spec)
 projectUV(3)
 set(material.normalmap, wall_normal)&amp;nbsp; 
&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here my specular and normal maps don't seem to be working either.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I then want to be able to select random window textures, but using a conidtional rule where the window type can be small or large, and depending on what it chooses:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;@Range ("small","large")
attr winType = "" # This isn't defined in my object attributes but I want it to randomally choose one type for each house.

attr window_tex&amp;nbsp; = case winType == "small" : fileRandom("assets/window/houseWindow/windowSize1_*.JPG")
 case winType == "large" : fileRandom("assets/window/houseWindow/windowSize2_*.JPG")
 else : fileRandom("assets/window/houseWindow/windowSize1_*.JPG")

&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;SPAN&gt;Unfortunately though it only seems to choose one window ie one small window for the whole model rather than a selection of small windows.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thirdly I'd like to insert my roof texture depending on random files and again adjust the setupProjection depending on the file sizes:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;@Range("Gable","Hip","Flat")
attr RoofType = ""

attr roofAngle = 22.5
attr gableOverhang = 0.4
attr hipOverhang = 0.5

const rooftile_tex&amp;nbsp;&amp;nbsp; = 50% : fileRandom("assets/monier/monier tiles/portuguese*-normal.png")
 else : fileRandom("assets/monier/monier tiles/hacienda*-normal.png")

const roofTexWidth =&amp;nbsp; case rooftile_tex == ("assets/monier/monier tiles/portuguese*-normal.png") : 2.0
 else : 2.1
const roofTexHeight =&amp;nbsp; case rooftile_tex == ("assets/monier/monier tiles/portuguese*-normal.png") : 2.0
 else : 2.54

Roof --&amp;gt;
 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)
...&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;SPAN&gt;I haven't placed all the code but hopefully enough to give you an idea of what I want...except again it's not working quite right! It doesn't seem to be registering my delection of textures, so I was wondering if that naming convention was correct or not for the selection?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;lastly I have doors...which do come in beautifully but alas only seem to be producing the narrow doors and not the wide ones, so I'm wondering what I'm missing?&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;@Range ("singleDoor","doubleDoor")
attr doorType = "" # This isn't specified in object attr but want a random selection of either

attr frontdoor_tex&amp;nbsp; =&amp;nbsp; case doorType == "singleDoor" : fileRandom("assets/Doors/frontDoors/singleDoor_*.JPG")
 case doorType == "doubleDoor" : fileRandom("assets/Doors/frontDoors/doubleDoor_*.JPG")
 else : fileRandom("assets/Doors/frontDoors/singleDoor_*.JPG")

const doorWidth = case doorType == "singleDoor" : 0.97
 case doorType == "doubleDoor" : 15
 else : 0.97
const doorHeight = 2.04&amp;nbsp; 

Entrance --&amp;gt;
&amp;nbsp; split(x) { ~1: SolidWall
&amp;nbsp; | doorWidth: split(y){doorHeight : Door | ~2: SolidWall}
&amp;nbsp; | ~1: SolidWall}

Door --&amp;gt;
 s('1,'1,0.1)
 t(0,0,-0.2)
 texture(frontdoor_tex)
 i("builtin:cube")&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I hope I've put enough info in for you to understand...and sorry for the length! Just wanting to get a bit more complex in my models now!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Jul 2013 22:33:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-cityengine-questions/conditional-rules-for-assets/m-p/700347#M9175</guid>
      <dc:creator>JoanneO_Brien</dc:creator>
      <dc:date>2013-07-10T22:33:24Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional Rules for Assets</title>
      <link>https://community.esri.com/t5/arcgis-cityengine-questions/conditional-rules-for-assets/m-p/700348#M9176</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;case wall_tex == ("assets/monier/monier_bricks/*Metro*Mortar.jpg")&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;is valid syntax, but it's not doing the wildcard search I assume you hope it does.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;[ means this checks if the file actually really contains a asterisk (*) character in the name ]&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;wildcards are only allowed specifically in the ce.lib functions, e.g. fileRandom(), fileSearch() and such.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;thus you need to find an other way to check the wall_tex for your purposes.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;can you track this down ?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Matt&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Jul 2013 08:48:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-cityengine-questions/conditional-rules-for-assets/m-p/700348#M9176</guid>
      <dc:creator>MatthiasBuehler1</dc:creator>
      <dc:date>2013-07-11T08:48:26Z</dc:date>
    </item>
  </channel>
</rss>

