<?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: Using FRA in Libraries &amp; objects</title>
    <link>https://community.graphisoft.com/t5/Libraries-objects/Using-FRA-to-create-striped-cladding/m-p/167388#M19418</link>
    <description>Hi,&lt;BR /&gt;
&lt;BR /&gt;
try it:&lt;BR /&gt;
&lt;BR /&gt;
      eps=0.001&lt;BR /&gt;
      IF ABS((FRA(count/3)) - 0 )&amp;lt;eps    THEN MATERIAL mat_board &lt;BR /&gt;
      IF ABS((FRA(count/3)) - 1/3 )&amp;lt;eps THEN MATERIAL mat_board2 &lt;BR /&gt;
      IF ABS((FRA(count/3)) - 2/3 )&amp;lt;eps THEN MATERIAL mat_board3&lt;BR /&gt;
&lt;BR /&gt;
cheers,</description>
    <pubDate>Mon, 05 Jul 2010 13:35:54 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2010-07-05T13:35:54Z</dc:date>
    <item>
      <title>Using FRA to create striped cladding</title>
      <link>https://community.graphisoft.com/t5/Libraries-objects/Using-FRA-to-create-striped-cladding/m-p/167387#M19417</link>
      <description>&lt;DIV class="actalk-migrated-content"&gt;&lt;R&gt;Hi,&lt;BR /&gt;
   I'm trying to create an object which allows for striped panels of cladding.&lt;BR /&gt;
&lt;BR /&gt;
The user picks 3 materials and these need to be used on every third iteration to draw a striped object.&lt;BR /&gt;
&lt;BR /&gt;
The code I have increments a counter 'count' in a loop, shortly before these lines:
&lt;PRE&gt;	IF (FRA(count/3)) = 0 THEN MATERIAL mat_board
		IF (FRA(count/3)) = 1/3 THEN MATERIAL mat_board2
		IF (FRA(count/3)) = 2/3 THEN MATERIAL mat_board3
&lt;/PRE&gt;

Unfortunately, it only seems to alternate the first 3, then it seems to get stuck on mat_board for all iterations afterwards. &lt;BR /&gt;
&lt;BR /&gt;
Any ideas?&lt;/R&gt;&lt;/DIV&gt;</description>
      <pubDate>Mon, 05 Jul 2010 13:10:47 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Libraries-objects/Using-FRA-to-create-striped-cladding/m-p/167387#M19417</guid>
      <dc:creator>derekjackson</dc:creator>
      <dc:date>2010-07-05T13:10:47Z</dc:date>
    </item>
    <item>
      <title>Re: Using FRA</title>
      <link>https://community.graphisoft.com/t5/Libraries-objects/Using-FRA-to-create-striped-cladding/m-p/167388#M19418</link>
      <description>Hi,&lt;BR /&gt;
&lt;BR /&gt;
try it:&lt;BR /&gt;
&lt;BR /&gt;
      eps=0.001&lt;BR /&gt;
      IF ABS((FRA(count/3)) - 0 )&amp;lt;eps    THEN MATERIAL mat_board &lt;BR /&gt;
      IF ABS((FRA(count/3)) - 1/3 )&amp;lt;eps THEN MATERIAL mat_board2 &lt;BR /&gt;
      IF ABS((FRA(count/3)) - 2/3 )&amp;lt;eps THEN MATERIAL mat_board3&lt;BR /&gt;
&lt;BR /&gt;
cheers,</description>
      <pubDate>Mon, 05 Jul 2010 13:35:54 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Libraries-objects/Using-FRA-to-create-striped-cladding/m-p/167388#M19418</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2010-07-05T13:35:54Z</dc:date>
    </item>
    <item>
      <title>Re: Using FRA</title>
      <link>https://community.graphisoft.com/t5/Libraries-objects/Using-FRA-to-create-striped-cladding/m-p/167389#M19419</link>
      <description>Perfect, thanks!</description>
      <pubDate>Mon, 05 Jul 2010 13:56:48 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Libraries-objects/Using-FRA-to-create-striped-cladding/m-p/167389#M19419</guid>
      <dc:creator>derekjackson</dc:creator>
      <dc:date>2010-07-05T13:56:48Z</dc:date>
    </item>
    <item>
      <title>Re: Using FRA</title>
      <link>https://community.graphisoft.com/t5/Libraries-objects/Using-FRA-to-create-striped-cladding/m-p/167390#M19420</link>
      <description>Since count is an integer and never has fractional values, you shouldn't really be using floating point arithmetic anyway.  &lt;BR /&gt;
&lt;BR /&gt;
The simplest method is to use the MOD (modulo) operator.&lt;BR /&gt;
&lt;BR /&gt;
(count MOD 3) will always equal exactly 0, 1 or 2&lt;BR /&gt;
&lt;BR /&gt;
and gives you much simpler code (within what GDL offers):&lt;BR /&gt;

&lt;PRE&gt;nStripe = count MOD 3
IF nStripe = 0 THEN MATERIAL mat_board
if nStripe = 1 THEN MATERIAL mat_board2
if nStripe = 2 THEN MATERIAL mat_board3&lt;/PRE&gt;

Of course, if you have an array set up, then you can just replace all of the above with:&lt;BR /&gt;

&lt;PRE&gt;MATERIAL mat_board[(count MOD 3)+1]&lt;/PRE&gt;

where the +1 is necessary since GDL array indices begin at 1.  An advantage of the array is that you can generalize your script to handle any number of stripes, defined parametrically.  The other solutions are 'hard coded' to a specific number of stripes.&lt;BR /&gt;
&lt;BR /&gt;
Cheers,&lt;BR /&gt;
Karl</description>
      <pubDate>Mon, 05 Jul 2010 17:31:44 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Libraries-objects/Using-FRA-to-create-striped-cladding/m-p/167390#M19420</guid>
      <dc:creator>Karl Ottenstein</dc:creator>
      <dc:date>2010-07-05T17:31:44Z</dc:date>
    </item>
    <item>
      <title>Re: Using FRA to create striped cladding</title>
      <link>https://community.graphisoft.com/t5/Libraries-objects/Using-FRA-to-create-striped-cladding/m-p/167391#M19421</link>
      <description>Superb, far easier. Thanks!</description>
      <pubDate>Tue, 06 Jul 2010 07:58:18 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Libraries-objects/Using-FRA-to-create-striped-cladding/m-p/167391#M19421</guid>
      <dc:creator>derekjackson</dc:creator>
      <dc:date>2010-07-06T07:58:18Z</dc:date>
    </item>
  </channel>
</rss>

