<?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 How to create file name by variable in ArcGIS CityEngine Questions</title>
    <link>https://community.esri.com/t5/arcgis-cityengine-questions/how-to-create-file-name-by-variable/m-p/1294350#M11023</link>
    <description>&lt;P&gt;Hi everyone, I'm creating my first ruler file with City engine, and I'm wondering how to create a path to Texture files with the filename controlled by 1 or more variables? Please see attached image file. Thanks everyone!&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot 2023-05-31 084720.png" style="width: 785px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/72003i29D84AC328353D81/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screenshot 2023-05-31 084720.png" alt="Screenshot 2023-05-31 084720.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;</description>
    <pubDate>Wed, 31 May 2023 02:25:22 GMT</pubDate>
    <dc:creator>trungta</dc:creator>
    <dc:date>2023-05-31T02:25:22Z</dc:date>
    <item>
      <title>How to create file name by variable</title>
      <link>https://community.esri.com/t5/arcgis-cityengine-questions/how-to-create-file-name-by-variable/m-p/1294350#M11023</link>
      <description>&lt;P&gt;Hi everyone, I'm creating my first ruler file with City engine, and I'm wondering how to create a path to Texture files with the filename controlled by 1 or more variables? Please see attached image file. Thanks everyone!&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot 2023-05-31 084720.png" style="width: 785px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/72003i29D84AC328353D81/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screenshot 2023-05-31 084720.png" alt="Screenshot 2023-05-31 084720.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Wed, 31 May 2023 02:25:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-cityengine-questions/how-to-create-file-name-by-variable/m-p/1294350#M11023</guid>
      <dc:creator>trungta</dc:creator>
      <dc:date>2023-05-31T02:25:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to create file name by variable</title>
      <link>https://community.esri.com/t5/arcgis-cityengine-questions/how-to-create-file-name-by-variable/m-p/1294392#M11024</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/688304"&gt;@trungta&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;Cool that you're digging into CGA &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;You got two errors in your code snippet:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Attributes are global and need to be declared outside of rules,&amp;nbsp; usually they are put at the top of the file.&lt;/LI&gt;&lt;LI&gt;If you want to mix strings with variables you need a plus sign between the string and the variable. There is an example in the following cga reference page: &lt;A href="https://doc.arcgis.com/en/cityengine/latest/cga/cga-asset-texture-search.htm" target="_blank"&gt;https://doc.arcgis.com/en/cityengine/latest/cga/cga-asset-texture-search.htm&lt;/A&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;After you change this there won't be any errors:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;attr HH = rint(scope.sy/5)
attr WW = rint(scope.sx/5)

Floor_facade --&amp;gt;
	setupProjection(0, scope.xy, scope.sx, scope.sy)
	texture("/ESRI.lib/assets/Facades/International/Upperfloors/u_f0" + HH + "_t0" + WW + "*.jpg")
	projectUV(0)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However there are some more things to consider:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Attributes are only evaluated once at the start of the generation. So scope.sy and scope.sx will always return the same value for the initial shape you assigned the rule. If you want to calculate using the scope of the current shape in the shape tree you need to&lt;UL&gt;&lt;LI&gt;directly&amp;nbsp; calculate between the strings instead of HH/WW or&lt;/LI&gt;&lt;LI&gt;define the calculation as a &lt;A href="https://doc.arcgis.com/en/cityengine/latest/help/help-rules-functions.htm" target="_self"&gt;function&lt;/A&gt; or&lt;/LI&gt;&lt;LI&gt;do the calculation as a &lt;A href="https://doc.arcgis.com/en/cityengine/latest/help/help-local-variables.htm" target="_self"&gt;local variable&lt;/A&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;LI&gt;your texture() operation as currently written will often not find a texture. You would need to either:&lt;UL&gt;&lt;LI&gt;copy them into a seperate project and rename them or&lt;/LI&gt;&lt;LI&gt;adjust your asset search string/ your calculation&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Hope this helps and happy coding!&lt;/P&gt;&lt;P&gt;Cheers&lt;BR /&gt;Jonas&lt;/P&gt;</description>
      <pubDate>Wed, 31 May 2023 08:22:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-cityengine-questions/how-to-create-file-name-by-variable/m-p/1294392#M11024</guid>
      <dc:creator>JonasObertuefer</dc:creator>
      <dc:date>2023-05-31T08:22:06Z</dc:date>
    </item>
  </channel>
</rss>

