<?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: ? on For Next Loops in Libraries &amp; objects</title>
    <link>https://community.graphisoft.com/t5/Libraries-objects/on-For-Next-Loops/m-p/81401#M32873</link>
    <description>Thanks Tom.&lt;BR /&gt;
I know someone who has a strong computer science background&lt;BR /&gt;
and I will ask him some of these questions and maybe he will&lt;BR /&gt;
have some answers.&lt;BR /&gt;
Thanks,&lt;BR /&gt;
Peter Devlin</description>
    <pubDate>Fri, 08 Sep 2006 19:33:14 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2006-09-08T19:33:14Z</dc:date>
    <item>
      <title>? on For Next Loops</title>
      <link>https://community.graphisoft.com/t5/Libraries-objects/on-For-Next-Loops/m-p/81391#M32863</link>
      <description>&lt;DIV class="actalk-migrated-content"&gt;&lt;T&gt;222: !BRICK TIES&lt;BR /&gt;
&lt;BR /&gt;
FOR dist=0 TO 30' STEP brick_tie&lt;BR /&gt;
ADDx dist&lt;BR /&gt;
GOSUB 111&lt;BR /&gt;
&lt;BR /&gt;
NEXT dist&lt;BR /&gt;
&lt;BR /&gt;
RETURN&lt;BR /&gt;
&lt;BR /&gt;
Will this work in an object? It's just putting 1 in and that's it. The brick_tie is a parameter for a length. GOSUB 111 is the actual lines for the brick tie.&lt;BR /&gt;
&lt;BR /&gt;
Thanks for any help,&lt;BR /&gt;
Michele&lt;/T&gt;&lt;/DIV&gt;</description>
      <pubDate>Thu, 07 Sep 2006 19:01:06 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Libraries-objects/on-For-Next-Loops/m-p/81391#M32863</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2006-09-07T19:01:06Z</dc:date>
    </item>
    <item>
      <title>Re: ? on For Next Loops</title>
      <link>https://community.graphisoft.com/t5/Libraries-objects/on-For-Next-Loops/m-p/81392#M32864</link>
      <description>I forgot to mention this is in the 2D script window - It's not a 3D object only 2D.&lt;BR /&gt;
&lt;BR /&gt;
Thanks,&lt;BR /&gt;
Michele</description>
      <pubDate>Thu, 07 Sep 2006 19:07:49 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Libraries-objects/on-For-Next-Loops/m-p/81392#M32864</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2006-09-07T19:07:49Z</dc:date>
    </item>
    <item>
      <title>Re: ? on For Next Loops</title>
      <link>https://community.graphisoft.com/t5/Libraries-objects/on-For-Next-Loops/m-p/81393#M32865</link>
      <description>Michele,&lt;BR /&gt;
It should work.&lt;BR /&gt;
Why don't you try it and see.&lt;BR /&gt;
Del the addx transformations&lt;BR /&gt;
before return.&lt;BR /&gt;
Peter Devlin</description>
      <pubDate>Thu, 07 Sep 2006 19:51:14 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Libraries-objects/on-For-Next-Loops/m-p/81393#M32865</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2006-09-07T19:51:14Z</dc:date>
    </item>
    <item>
      <title>Re: ? on For Next Loops</title>
      <link>https://community.graphisoft.com/t5/Libraries-objects/on-For-Next-Loops/m-p/81394#M32866</link>
      <description>I think there was an error in the GOSUB routine (along w/ other errors) but it's working now. A little trial &amp;amp; error goes a long way.&lt;BR /&gt;
&lt;BR /&gt;
Thanks,&lt;BR /&gt;
Michele</description>
      <pubDate>Thu, 07 Sep 2006 19:57:31 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Libraries-objects/on-For-Next-Loops/m-p/81394#M32866</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2006-09-07T19:57:31Z</dc:date>
    </item>
    <item>
      <title>Re: ? on For Next Loops</title>
      <link>https://community.graphisoft.com/t5/Libraries-objects/on-For-Next-Loops/m-p/81395#M32867</link>
      <description>It seems that all I do is a lot of trial and error &lt;IMG src="https://community.graphisoft.com/legacyfs/online/emojis/icon_biggrin.gif" style="display : inline;" /&gt; &lt;BR /&gt;
Peter Devlin</description>
      <pubDate>Thu, 07 Sep 2006 20:20:07 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Libraries-objects/on-For-Next-Loops/m-p/81395#M32867</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2006-09-07T20:20:07Z</dc:date>
    </item>
    <item>
      <title>Re: ? on For Next Loops</title>
      <link>https://community.graphisoft.com/t5/Libraries-objects/on-For-Next-Loops/m-p/81396#M32868</link>
      <description>Probably not. For/Next works best with integer counters. I am betting you could end up with fractions/decimals pretty easily with this.&lt;BR /&gt;
&lt;BR /&gt;
I would go with more of a WHILE/DO. like 
&lt;PRE&gt;&lt;I&gt;
&lt;/I&gt;WHILE dist &amp;lt; 30'-0" DO....

dist = dist + bricktie
ENDWHILE&lt;/PRE&gt;</description>
      <pubDate>Thu, 07 Sep 2006 20:44:33 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Libraries-objects/on-For-Next-Loops/m-p/81396#M32868</guid>
      <dc:creator>TomWaltz</dc:creator>
      <dc:date>2006-09-07T20:44:33Z</dc:date>
    </item>
    <item>
      <title>Re: ? on For Next Loops</title>
      <link>https://community.graphisoft.com/t5/Libraries-objects/on-For-Next-Loops/m-p/81397#M32869</link>
      <description>Hello Tom,&lt;BR /&gt;
Could you tell us what happens if&lt;BR /&gt;
you end up with fractions/decimals.&lt;BR /&gt;
Until two days ago I thought&lt;BR /&gt;
for loops could only work with integers&lt;BR /&gt;
but now I'm not so sure.&lt;BR /&gt;
Thanks,&lt;BR /&gt;
Peter Devlin</description>
      <pubDate>Thu, 07 Sep 2006 21:26:07 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Libraries-objects/on-For-Next-Loops/m-p/81397#M32869</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2006-09-07T21:26:07Z</dc:date>
    </item>
    <item>
      <title>Re: ? on For Next Loops</title>
      <link>https://community.graphisoft.com/t5/Libraries-objects/on-For-Next-Loops/m-p/81398#M32870</link>
      <description>I couldn't say for sure with Archicad, but most programming books I've ever seen tell you to avoid it since you cannot predict how the program will respond.</description>
      <pubDate>Fri, 08 Sep 2006 12:12:36 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Libraries-objects/on-For-Next-Loops/m-p/81398#M32870</guid>
      <dc:creator>TomWaltz</dc:creator>
      <dc:date>2006-09-08T12:12:36Z</dc:date>
    </item>
    <item>
      <title>Re: ? on For Next Loops</title>
      <link>https://community.graphisoft.com/t5/Libraries-objects/on-For-Next-Loops/m-p/81399#M32871</link>
      <description>Hello Tom,&lt;BR /&gt;
That was my impression also until, as I said, two days ago.&lt;BR /&gt;
You mentioned once that you were studying C++.&lt;BR /&gt;
Does the C++ for loop have the "step" part like GDL ?&lt;BR /&gt;
It occurs to me that maybe some computer languages&lt;BR /&gt;
may not have "step" and in that case only integers can be used.&lt;BR /&gt;
I did a little test using the piece of code using a for loop on&lt;BR /&gt;
page 1.26 of the GDL Cookbook 3. I tried to force the for loop&lt;BR /&gt;
to use fractional values and calculate fractional values and&lt;BR /&gt;
it seemed like there was no problem. The result were always&lt;BR /&gt;
what you would expect.&lt;BR /&gt;
Just a few thoughts,&lt;BR /&gt;
Peter Devlin</description>
      <pubDate>Fri, 08 Sep 2006 19:00:31 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Libraries-objects/on-For-Next-Loops/m-p/81399#M32871</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2006-09-08T19:00:31Z</dc:date>
    </item>
    <item>
      <title>Re: ? on For Next Loops</title>
      <link>https://community.graphisoft.com/t5/Libraries-objects/on-For-Next-Loops/m-p/81400#M32872</link>
      <description>&lt;BLOCKQUOTE&gt;Peter wrote:&lt;BR /&gt;Hello Tom,&lt;BR /&gt;
That was my impression also until, as I said, two days ago.&lt;BR /&gt;
You mentioned once that you were studying C++.&lt;BR /&gt;
Does the C++ for loop have the "step" part like GDL ?&lt;BR /&gt;
It occurs to me that maybe some computer languages&lt;BR /&gt;
may not have "step" and in that case only integers can be used.&lt;BR /&gt;
I did a little test using the piece of code using a for loop on&lt;BR /&gt;
page 1.26 of the GDL Cookbook 3. I tried to force the for loop&lt;BR /&gt;
to use fractional values and calculate fractional values and&lt;BR /&gt;
it seemed like there was no problem. The result were always&lt;BR /&gt;
what you would expect.&lt;BR /&gt;
Just a few thoughts,&lt;BR /&gt;
Peter Devlin&lt;/BLOCKQUOTE&gt;

Honestly, I've not used any C++ for almost a year... I think there was, but I cannot say for sure from memory and I'm too lazy to look it up right now &lt;E&gt;&lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/E&gt;</description>
      <pubDate>Fri, 08 Sep 2006 19:13:04 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Libraries-objects/on-For-Next-Loops/m-p/81400#M32872</guid>
      <dc:creator>TomWaltz</dc:creator>
      <dc:date>2006-09-08T19:13:04Z</dc:date>
    </item>
    <item>
      <title>Re: ? on For Next Loops</title>
      <link>https://community.graphisoft.com/t5/Libraries-objects/on-For-Next-Loops/m-p/81401#M32873</link>
      <description>Thanks Tom.&lt;BR /&gt;
I know someone who has a strong computer science background&lt;BR /&gt;
and I will ask him some of these questions and maybe he will&lt;BR /&gt;
have some answers.&lt;BR /&gt;
Thanks,&lt;BR /&gt;
Peter Devlin</description>
      <pubDate>Fri, 08 Sep 2006 19:33:14 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Libraries-objects/on-For-Next-Loops/m-p/81401#M32873</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2006-09-08T19:33:14Z</dc:date>
    </item>
    <item>
      <title>Re: ? on For Next Loops</title>
      <link>https://community.graphisoft.com/t5/Libraries-objects/on-For-Next-Loops/m-p/81402#M32874</link>
      <description>&lt;BLOCKQUOTE&gt;Peter wrote:&lt;BR /&gt;Hello Tom,&lt;BR /&gt;
Does the C++ for loop have the "step" part like GDL ?&lt;BR /&gt;
Peter Devlin&lt;/BLOCKQUOTE&gt;

C++ can use steps of course and more.&lt;BR /&gt;
A problem may arise for both FOR and WHILE, as result of roundings and comparing floating numbers. ( GDL, C++,...). &lt;BR /&gt;
Both variants above are IMHO almost equivalent and not quite correct.&lt;BR /&gt;
&lt;BR /&gt;
IMHO better &lt;BR /&gt;
FOR dist=0 TO 30 ' + brick_tie / 2 STEP brick_tie</description>
      <pubDate>Fri, 08 Sep 2006 20:02:06 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Libraries-objects/on-For-Next-Loops/m-p/81402#M32874</guid>
      <dc:creator>Oleg</dc:creator>
      <dc:date>2006-09-08T20:02:06Z</dc:date>
    </item>
    <item>
      <title>Re: ? on For Next Loops</title>
      <link>https://community.graphisoft.com/t5/Libraries-objects/on-For-Next-Loops/m-p/81403#M32875</link>
      <description>Hello Oleg,&lt;BR /&gt;
Great to hear from you.&lt;BR /&gt;
You say," Both variants above are IMHO almost equivalent &lt;BR /&gt;
and not quite correct."&lt;BR /&gt;
Could you elaborate a little please.&lt;BR /&gt;
How are they both not quite correct ?&lt;BR /&gt;
Thank you,&lt;BR /&gt;
Peter Devlin</description>
      <pubDate>Fri, 08 Sep 2006 20:29:48 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Libraries-objects/on-For-Next-Loops/m-p/81403#M32875</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2006-09-08T20:29:48Z</dc:date>
    </item>
    <item>
      <title>Re: ? on For Next Loops</title>
      <link>https://community.graphisoft.com/t5/Libraries-objects/on-For-Next-Loops/m-p/81404#M32876</link>
      <description>&lt;BLOCKQUOTE&gt;Peter wrote:&lt;BR /&gt;Hello Oleg,&lt;BR /&gt;
Could you elaborate a little please.&lt;BR /&gt;
How are they both not quite correct ?&lt;BR /&gt;
Thank you,&lt;BR /&gt;
Peter Devlin&lt;/BLOCKQUOTE&gt;

Well. Some tests ( AC9 )&lt;BR /&gt;
What do you think will printed &lt;BR /&gt;

&lt;PRE&gt;&lt;I&gt;
&lt;/I&gt;counter = 0
bstep = 3
FOR dist=0 TO 3 STEP bstep
  counter = counter + 1
NEXT dist
PRINT counter
&lt;/PRE&gt;

Imagine there was some calculations.&lt;BR /&gt;
bstep is same, but what will be printed now&lt;BR /&gt;

&lt;PRE&gt;&lt;I&gt;
&lt;/I&gt;counter = 0
bstep = 0.3/0.1
FOR dist=0 TO 3 STEP bstep
  counter = counter + 1
NEXT dist
PRINT counter
&lt;/PRE&gt;

Same for WHILE&lt;BR /&gt;

&lt;PRE&gt;&lt;I&gt;
&lt;/I&gt;counter = 0
bstep = 0.3
dist = 0
WHILE dist &amp;lt; 0.3 DO 
  dist = dist + bstep
  counter = counter + 1
ENDWHILE
PRINT counter

counter = 0
bstep = 1 - 0.7
dist = 0
WHILE dist &amp;lt; 0.3 DO 
  dist = dist + bstep
  counter = counter + 1
ENDWHILE
PRINT counter
&lt;/PRE&gt;

The result will depend on actual values and calculations that's mean unstable.&lt;BR /&gt;
&lt;BR /&gt;
Oleg</description>
      <pubDate>Fri, 08 Sep 2006 20:50:32 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Libraries-objects/on-For-Next-Loops/m-p/81404#M32876</guid>
      <dc:creator>Oleg</dc:creator>
      <dc:date>2006-09-08T20:50:32Z</dc:date>
    </item>
    <item>
      <title>Re: ? on For Next Loops</title>
      <link>https://community.graphisoft.com/t5/Libraries-objects/on-For-Next-Loops/m-p/81405#M32877</link>
      <description>Hello Oleg,&lt;BR /&gt;
Thank you for your considerable elaboration.&lt;BR /&gt;
I will have to copy your code into a lib part and&lt;BR /&gt;
get my head around what is happening.&lt;BR /&gt;
Thank you,&lt;BR /&gt;
Peter Devlin</description>
      <pubDate>Fri, 08 Sep 2006 21:10:01 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Libraries-objects/on-For-Next-Loops/m-p/81405#M32877</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2006-09-08T21:10:01Z</dc:date>
    </item>
    <item>
      <title>Re: ? on For Next Loops</title>
      <link>https://community.graphisoft.com/t5/Libraries-objects/on-For-Next-Loops/m-p/81406#M32878</link>
      <description>Hello Oleg,&lt;BR /&gt;
I did an experiment with your second piece of code.&lt;BR /&gt;
&lt;BR /&gt;
counter = 0&lt;BR /&gt;
bstep = 0.3/0.1 	!!!=3&lt;BR /&gt;
FOR dist=0 TO 3 STEP bstep&lt;BR /&gt;
  counter = counter + 1&lt;BR /&gt;
NEXT dist&lt;BR /&gt;
PRINT counter	!!!! prints 1&lt;BR /&gt;
&lt;BR /&gt;
PRINT 0.3/0.1   !!!! prints 3&lt;BR /&gt;
&lt;BR /&gt;
When I change the code to this.&lt;BR /&gt;
&lt;BR /&gt;
counter = 0&lt;BR /&gt;
bstep = int(0.3/0.1) 	!!!=3&lt;BR /&gt;
FOR dist=0 TO 3 STEP bstep&lt;BR /&gt;
  counter = counter + 1&lt;BR /&gt;
NEXT dist&lt;BR /&gt;
PRINT counter	!!!! prints 2&lt;BR /&gt;
&lt;BR /&gt;
It is as though there is a secret fractional part&lt;BR /&gt;
of the calculation of 0.3/0.1 that is not displayed&lt;BR /&gt;
in what is printed in PRINT 0.3/0.1 and that there&lt;BR /&gt;
is a rounding-up in the internal calculations.&lt;BR /&gt;
&lt;BR /&gt;
How can this be ???&lt;BR /&gt;
Is PRINT able to lie ?&lt;BR /&gt;
I wonder how many places PRINT can display.&lt;BR /&gt;
&lt;BR /&gt;
Peter Devlin</description>
      <pubDate>Fri, 08 Sep 2006 23:42:13 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Libraries-objects/on-For-Next-Loops/m-p/81406#M32878</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2006-09-08T23:42:13Z</dc:date>
    </item>
    <item>
      <title>Re: ? on For Next Loops</title>
      <link>https://community.graphisoft.com/t5/Libraries-objects/on-For-Next-Loops/m-p/81407#M32879</link>
      <description>PRINT does not lie. It rounds number to some signs before display ( it seems to 6 signs ).&lt;BR /&gt;
&lt;BR /&gt;
In any case it needs to be ready, that issues may arise at any comparisons of floating numbers. ( like 0.3 is not equal 1-0.7 )&lt;BR /&gt;
And if it important in script, use some tricks, like ABS, EPS etc&lt;BR /&gt;
( It seems there is some guide from GS about that  )&lt;BR /&gt;
&lt;BR /&gt;
FOR loop uses internally comparison too and it may results to unexpected results. Therefore, when a loop uses floating numbers, and not integer, better to use it like&lt;BR /&gt;
FOR dist=0 TO 3 + bstep / 2 STEP bstep &lt;BR /&gt;
&lt;BR /&gt;
Oleg</description>
      <pubDate>Sat, 09 Sep 2006 07:42:36 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Libraries-objects/on-For-Next-Loops/m-p/81407#M32879</guid>
      <dc:creator>Oleg</dc:creator>
      <dc:date>2006-09-09T07:42:36Z</dc:date>
    </item>
    <item>
      <title>Re: ? on For Next Loops</title>
      <link>https://community.graphisoft.com/t5/Libraries-objects/on-For-Next-Loops/m-p/81408#M32880</link>
      <description>Hello Oleg, &lt;BR /&gt;
Yes, this is something that I have only recently come to understand.&lt;BR /&gt;
Now, all I need to do is remember to put in that little extra to&lt;BR /&gt;
help AC make it to the finish line.&lt;BR /&gt;
Thanks  Oleg,&lt;BR /&gt;
Peter Devlin</description>
      <pubDate>Sat, 09 Sep 2006 19:13:53 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Libraries-objects/on-For-Next-Loops/m-p/81408#M32880</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2006-09-09T19:13:53Z</dc:date>
    </item>
  </channel>
</rss>

