<?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 Incomprehensible grammar problem in Libraries &amp; objects</title>
    <link>https://community.graphisoft.com/t5/Libraries-objects/Incomprehensible-grammar-problem/m-p/241357#M2424</link>
    <description>&lt;DIV class="actalk-migrated-content"&gt;&lt;R&gt;HI!&lt;BR /&gt;
I have been programming for a long time, and I can't understand some basic errors in GDL. E.g:
&lt;PRE&gt;&lt;I&gt;
&lt;/I&gt;x  =  0.38
x2 = 1.08
if x=x2 then print 1 else print 2
&lt;/PRE&gt;
check script : use of real types can result...&lt;BR /&gt;
???&lt;BR /&gt;
I can't use the equal sign, so every time I use very cumbersome code to judge&lt;BR /&gt;
I really can't stand this problem.&lt;BR /&gt;
&lt;BR /&gt;
I can only write this way.
&lt;PRE&gt;&lt;I&gt;
&lt;/I&gt;x  =  0.38
x2 = 1.08
if x-x2 then 
  print 2
else
  print 1
endif
&lt;/PRE&gt;&lt;/R&gt;&lt;/DIV&gt;</description>
    <pubDate>Wed, 17 Jul 2019 06:57:08 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2019-07-17T06:57:08Z</dc:date>
    <item>
      <title>Incomprehensible grammar problem</title>
      <link>https://community.graphisoft.com/t5/Libraries-objects/Incomprehensible-grammar-problem/m-p/241357#M2424</link>
      <description>&lt;DIV class="actalk-migrated-content"&gt;&lt;R&gt;HI!&lt;BR /&gt;
I have been programming for a long time, and I can't understand some basic errors in GDL. E.g:
&lt;PRE&gt;&lt;I&gt;
&lt;/I&gt;x  =  0.38
x2 = 1.08
if x=x2 then print 1 else print 2
&lt;/PRE&gt;
check script : use of real types can result...&lt;BR /&gt;
???&lt;BR /&gt;
I can't use the equal sign, so every time I use very cumbersome code to judge&lt;BR /&gt;
I really can't stand this problem.&lt;BR /&gt;
&lt;BR /&gt;
I can only write this way.
&lt;PRE&gt;&lt;I&gt;
&lt;/I&gt;x  =  0.38
x2 = 1.08
if x-x2 then 
  print 2
else
  print 1
endif
&lt;/PRE&gt;&lt;/R&gt;&lt;/DIV&gt;</description>
      <pubDate>Wed, 17 Jul 2019 06:57:08 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Libraries-objects/Incomprehensible-grammar-problem/m-p/241357#M2424</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-07-17T06:57:08Z</dc:date>
    </item>
    <item>
      <title>Re: Incomprehensible grammar problem</title>
      <link>https://community.graphisoft.com/t5/Libraries-objects/Incomprehensible-grammar-problem/m-p/241358#M2425</link>
      <description>I have no issue using the equal sign. I do believe I have an issue doing a &lt;B&gt;If - Then - Else&lt;/B&gt; on a single line. I can do an &lt;B&gt;If - Then&lt;/B&gt; on a single line, but if I add an &lt;B&gt;Else&lt;/B&gt; I need to split the actions into separate lines. I will check tomorrow if I remember...&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Ling.</description>
      <pubDate>Wed, 17 Jul 2019 08:50:40 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Libraries-objects/Incomprehensible-grammar-problem/m-p/241358#M2425</guid>
      <dc:creator>Lingwisyer</dc:creator>
      <dc:date>2019-07-17T08:50:40Z</dc:date>
    </item>
    <item>
      <title>Re: Incomprehensible grammar problem</title>
      <link>https://community.graphisoft.com/t5/Libraries-objects/Incomprehensible-grammar-problem/m-p/241359#M2426</link>
      <description>There is no problem with the if/then/else all on one line.&lt;BR /&gt;
It is simply a warning to say it is not a good idea to equate numbers with each other.&lt;BR /&gt;
Your original script may work, but it is not a good idea to use it unless you can be sure of the accuracy of the numbers.&lt;BR /&gt;
&lt;BR /&gt;
I don't understand it all myself, but I believe there is a level of accuracy that GDL uses.&lt;BR /&gt;
Have a look at this....&lt;BR /&gt;
&lt;BR /&gt;



&lt;BR /&gt;
You can write an equation that does not use = and you can specify the level of accuracy that you want to compare.&lt;BR /&gt;
&lt;BR /&gt;



&lt;BR /&gt;
Barry,</description>
      <pubDate>Wed, 17 Jul 2019 09:10:40 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Libraries-objects/Incomprehensible-grammar-problem/m-p/241359#M2426</guid>
      <dc:creator>Barry Kelly</dc:creator>
      <dc:date>2019-07-17T09:10:40Z</dc:date>
    </item>
    <item>
      <title>Re: Incomprehensible grammar problem</title>
      <link>https://community.graphisoft.com/t5/Libraries-objects/Incomprehensible-grammar-problem/m-p/241360#M2427</link>
      <description>"="  The equal sign can only support integers &lt;BR /&gt;
So I can only use the greater than or less than the number to judge, can not use the equal sign, so very inaccurate&lt;BR /&gt;
&lt;BR /&gt;
I don't report errors when I write like this.
&lt;PRE&gt;&lt;I&gt;
&lt;/I&gt;     if  x&amp;lt;= 0.1 and x&amp;gt;0.09 then print 1
&lt;/PRE&gt;</description>
      <pubDate>Thu, 18 Jul 2019 02:01:16 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Libraries-objects/Incomprehensible-grammar-problem/m-p/241360#M2427</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-07-18T02:01:16Z</dc:date>
    </item>
    <item>
      <title>Re: Incomprehensible grammar problem</title>
      <link>https://community.graphisoft.com/t5/Libraries-objects/Incomprehensible-grammar-problem/m-p/241361#M2428</link>
      <description>Oh. That error. For user inputs, I have instead been writing&lt;BR /&gt;

&lt;PRE&gt;If a &amp;lt;&amp;gt; b then d else c &lt;/PRE&gt;

&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Ling.</description>
      <pubDate>Thu, 18 Jul 2019 02:15:41 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Libraries-objects/Incomprehensible-grammar-problem/m-p/241361#M2428</guid>
      <dc:creator>Lingwisyer</dc:creator>
      <dc:date>2019-07-18T02:15:41Z</dc:date>
    </item>
    <item>
      <title>Re: Incomprehensible grammar problem</title>
      <link>https://community.graphisoft.com/t5/Libraries-objects/Incomprehensible-grammar-problem/m-p/241362#M2429</link>
      <description>The key issue here is &lt;I&gt;&lt;/I&gt;&lt;S&gt;&lt;I&gt;&lt;I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/S&gt;precision&lt;E&gt;&lt;/E&gt;. It's generally not helpful to issue architectural documentation with precision smaller than 1mm, and construction tolerances are generally not that tight. You want to be aware of that when scripting for objects because it's very easy to be far more precise than is helpful to the user. &lt;BR /&gt;
&lt;BR /&gt;
For example, if an object is supposed to display a specific label or illustration if the length is 5m, what should happen if the length is 5.00001m, i.e.a difference of 0.01mm? The user won't be able to detect that difference visually or using dimensions because ARCHICAD won't display dimensions to that precision. So the user might have something which looks exactly like 5m, but the object acts as though it isn't.&lt;BR /&gt;
&lt;BR /&gt;
This is why ARCHICAD is warning you when you say things like:&lt;PRE&gt;if length = 5 then&lt;/PRE&gt;. Specify a level of precision in your script and then use it for all floating point comparisons, e.g.:
&lt;PRE&gt;eps = 1e-4
if abs(length - 5) &amp;lt; eps then&lt;/PRE&gt;
GS is right in calling this to your attention – handling precision incorrectly can be really irritating (or costly) for the end user otherwise.</description>
      <pubDate>Thu, 18 Jul 2019 08:45:33 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Libraries-objects/Incomprehensible-grammar-problem/m-p/241362#M2429</guid>
      <dc:creator>Ralph Wessel</dc:creator>
      <dc:date>2019-07-18T08:45:33Z</dc:date>
    </item>
  </channel>
</rss>

