<?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 Re: How to correctly import a file, which is defined via the attributes? in ArcGIS CityEngine Questions</title>
    <link>https://community.esri.com/t5/arcgis-cityengine-questions/how-to-correctly-import-a-file-which-is-defined/m-p/6026#M81</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Unfortunately that doesn't work. Import paths are static. You could however use Python to write a specific CGA file for each shape (using its attributes, for example), save and assign it. Of course that leaves you with tons of CGA files.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 08 Apr 2016 13:49:40 GMT</pubDate>
    <dc:creator>LR</dc:creator>
    <dc:date>2016-04-08T13:49:40Z</dc:date>
    <item>
      <title>How to correctly import a file, which is defined via the attributes?</title>
      <link>https://community.esri.com/t5/arcgis-cityengine-questions/how-to-correctly-import-a-file-which-is-defined/m-p/6025#M80</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello everybody&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;First of all: I'm a new user of CityEngine, so maybe this is a very basic question.. but I wasn't albe to find a good solution so far, that's the reason for my post here &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I would like to create buildings with ground- and upperfloors (so that I can combine the groundfloors randomly with the upperfloors). For this, I created the CGA-Files with the help of the Facade Wizard. These rule files provide the upperfloor rules only, the groundfloors are definied in different rule files.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;At the moment, I wrote the following CGA-Code to divide the buildings into a ground- and upperfloor. It would be now possible to import a specific rule file for the groundfloors (by using the command&lt;EM&gt; import i : "name.cga"&lt;/EM&gt;). What I would like to do is, that I can change the rule files for the groundfloors via the attributes (so I don't need to go into every rule file and change the name manually). Is that even possible?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=============Code=============&lt;/P&gt;&lt;P&gt;attr Building_Height = 25&lt;/P&gt;&lt;P&gt;attr GroundFloorHeight = 5&lt;/P&gt;&lt;P&gt;attr UpperFloorHeight = 3&lt;/P&gt;&lt;P&gt;attr UpperFloorRule = "name.cga"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;import i : UpperFloorRule&lt;EM&gt; #this one does not work, it should just give you an idea what I want to do: importing the cga-file, which was entered in the attribute part (in this case: "name.cga"). It would work with "import i : name.cga" though.&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Lot--&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; extrude (world.y, Building_Height) Building&lt;/P&gt;&lt;P&gt;Building --&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; split(y){GroundFloorHeight: GF | {~UpperFloorHeight: UF}* }&lt;/P&gt;&lt;P&gt;GF--&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; extrude (world.y, GroundFloorHeight)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; comp(f) {side: i.Facade}&lt;/P&gt;&lt;P&gt;UF--&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; extrude (world.y, UpperFloorHeight)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; comp(f) {side: Facade}&lt;/P&gt;&lt;P&gt;=============End of Code=============&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks very much for your inputs. Have a nice weekend.&lt;/P&gt;&lt;P&gt;Tobias&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;EDIT: this is not the complete code (just because of "End of Code"), the Facade rule is defined in the same file (but not displayed here)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 08 Apr 2016 12:33:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-cityengine-questions/how-to-correctly-import-a-file-which-is-defined/m-p/6025#M80</guid>
      <dc:creator>TobiasCervenka</dc:creator>
      <dc:date>2016-04-08T12:33:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to correctly import a file, which is defined via the attributes?</title>
      <link>https://community.esri.com/t5/arcgis-cityengine-questions/how-to-correctly-import-a-file-which-is-defined/m-p/6026#M81</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Unfortunately that doesn't work. Import paths are static. You could however use Python to write a specific CGA file for each shape (using its attributes, for example), save and assign it. Of course that leaves you with tons of CGA files.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 08 Apr 2016 13:49:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-cityengine-questions/how-to-correctly-import-a-file-which-is-defined/m-p/6026#M81</guid>
      <dc:creator>LR</dc:creator>
      <dc:date>2016-04-08T13:49:40Z</dc:date>
    </item>
    <item>
      <title>Re: How to correctly import a file, which is defined via the attributes?</title>
      <link>https://community.esri.com/t5/arcgis-cityengine-questions/how-to-correctly-import-a-file-which-is-defined/m-p/6027#M82</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you very much.&lt;/P&gt;&lt;P&gt;So there is no way without Python to combine two cga-files randomly together? Because I have definied the upper floors and the ground floors in different cga-files. My idea was now to combine these two cga files either by defining them manually.. or it would also be possible to combine them randomly.&lt;/P&gt;&lt;P&gt;Maybe I should create (extrude) the groundfloors first, add the cga file and create then the upperfloors on the top and add a different cga file then, would that be a work around?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 09 Apr 2016 09:14:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-cityengine-questions/how-to-correctly-import-a-file-which-is-defined/m-p/6027#M82</guid>
      <dc:creator>TobiasCervenka</dc:creator>
      <dc:date>2016-04-09T09:14:23Z</dc:date>
    </item>
    <item>
      <title>Re: How to correctly import a file, which is defined via the attributes?</title>
      <link>https://community.esri.com/t5/arcgis-cityengine-questions/how-to-correctly-import-a-file-which-is-defined/m-p/6028#M83</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Oh sorry.. this just popped into my mind:&lt;/P&gt;&lt;P&gt;Maybe there would be a way to import a random file? Because there is a function&lt;EM&gt; fileRandom("name_nr*.cga")&lt;/EM&gt;.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 09 Apr 2016 09:19:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-cityengine-questions/how-to-correctly-import-a-file-which-is-defined/m-p/6028#M83</guid>
      <dc:creator>TobiasCervenka</dc:creator>
      <dc:date>2016-04-09T09:19:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to correctly import a file, which is defined via the attributes?</title>
      <link>https://community.esri.com/t5/arcgis-cityengine-questions/how-to-correctly-import-a-file-which-is-defined/m-p/6029#M84</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I never got anything dynamic to work with importing rules within CGA. If you want some randomness you could try something like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;attr RN = rand(0,1)

Lot --&amp;gt;
&amp;nbsp; case RN &amp;gt; 0 &amp;amp;&amp;amp; RN &amp;lt;= 0.1: Rule1
&amp;nbsp; case RN &amp;gt;0.1 &amp;amp;&amp;amp; RN &amp;lt;= 0.2: Rule2
&amp;nbsp; case RN &amp;gt;0.2 &amp;amp;&amp;amp; RN &amp;lt;= 0.3: Rule3
&amp;nbsp; else: Rule999&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You either import all rules into the main one and randomly access one of them, or you combine all secondary rules into one, and put that case instruction in the secondary rule... or you mix both. I had some hangups when importing a "large" (~20) amount of complex rules, so maybe the second approach would be safer. Also since the rand() function is determined by the shape seed (which doesn't change until told to) you have to update it (⌂+, or ctrl+shift+g) to see changes.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 20:14:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-cityengine-questions/how-to-correctly-import-a-file-which-is-defined/m-p/6029#M84</guid>
      <dc:creator>LR</dc:creator>
      <dc:date>2021-12-10T20:14:37Z</dc:date>
    </item>
  </channel>
</rss>

