<?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: Wrong display of float numbers in InfraWorks Forum</title>
    <link>https://forums.autodesk.com/t5/infraworks-forum/wrong-display-of-float-numbers/m-p/8340329#M11150</link>
    <description>&lt;P&gt;Looks like I deal with it by myself.&lt;/P&gt;&lt;P&gt;Anyway, if somebody face with this issue, probably my solution would be helpful. However it doesn't seem to be 100% right.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So, as far as I know rigth now, some programming languages has problems with displaying float numbers. &lt;A href="https://floating-point-gui.de/" target="_blank"&gt;Here&lt;/A&gt;&amp;nbsp;is an article about it. There is probably no way to limit digits after comma in HTML editor in Infraworks, it grabs values onlyt from datasource table. Whatever you have in a field with real (double, float) number data, Infraworks will display the integer number plus point and 15 digits after it. Exceptions are numbers that have only a zero after&amp;nbsp;point. But, as I wrote in question, numbers like 20.3 will be shown like 20.300000000000001.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Recently I observred javascript guide for Infraworks and found method similar to &lt;FONT face="courier new,courier"&gt;arcpy.da.UpdateCursor&lt;/FONT&gt; from ArcGIS (I'm still user of this software) there. And for objects which numbers I want to be show correctly, wrote a script that creates a substitute of a tooltip. It works for&amp;nbsp;certain selected objects in a model but can be edited to update all needed data.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here it goes:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;var db  = app.ActiveModelDb;
var classID = db.TableIndex("USER_BUILDINGS"); //reference to a datasource
var table   = db.Table(classID);    

var sset = app.ActiveSelectionSet; //taking only selected object
var filter = sset.GetFilter(db.TableIndex("USER_BUILDINGS")); 

table.StartQuery(filter); 
table.BeginWriteBatch();
var read;
var write = table.GetWriteRow();
while (read = table.Next()) { //loop through selected objects
    var sq = read.USER_SUM_ALL; //getting float number
    write.TAG = "&amp;lt;div&amp;gt;&amp;lt;b&amp;gt;&amp;lt;font size='5'&amp;gt;SQUARE is " + sq.toFixed(1).toString(); //limit digits and comvert into a string
    table.UpdateFeature(write, read.ID); //updating feature
}
table.EndQuery();&lt;/PRE&gt;&lt;P&gt;After that the tooltip for layer should be just&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;%TAG%&lt;/PRE&gt;&lt;P&gt;As a result the original data will be displayed in tooltip.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 17 Oct 2018 12:51:08 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2018-10-17T12:51:08Z</dc:date>
    <item>
      <title>Wrong display of float numbers</title>
      <link>https://forums.autodesk.com/t5/infraworks-forum/wrong-display-of-float-numbers/m-p/8333835#M11149</link>
      <description>&lt;P&gt;Hello everyone!&lt;/P&gt;&lt;P&gt;I have a set of models in Infraworks and for some objects I have to make tooltips. There is a layer with is a field containing float numbers called USER_SUM_ALL. It stores different numbers like 10.0, 20.0, 20.3, 20.8 etc.&lt;/P&gt;&lt;P&gt;The problem is that that program shows number not like in original but with 15 digits after comma. Here is a code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;lt;div&amp;gt;&amp;lt;b&amp;gt;&amp;lt;font size="5"&amp;gt; TEST: %USER_SUM_ALL% &amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt;&amp;lt;/div&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And it shows not 20.8 but 20.800000000000001&lt;/P&gt;&lt;P&gt;What can be done here to display numbers properly?&lt;/P&gt;</description>
      <pubDate>Mon, 15 Oct 2018 07:08:15 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/infraworks-forum/wrong-display-of-float-numbers/m-p/8333835#M11149</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-10-15T07:08:15Z</dc:date>
    </item>
    <item>
      <title>Re: Wrong display of float numbers</title>
      <link>https://forums.autodesk.com/t5/infraworks-forum/wrong-display-of-float-numbers/m-p/8340329#M11150</link>
      <description>&lt;P&gt;Looks like I deal with it by myself.&lt;/P&gt;&lt;P&gt;Anyway, if somebody face with this issue, probably my solution would be helpful. However it doesn't seem to be 100% right.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So, as far as I know rigth now, some programming languages has problems with displaying float numbers. &lt;A href="https://floating-point-gui.de/" target="_blank"&gt;Here&lt;/A&gt;&amp;nbsp;is an article about it. There is probably no way to limit digits after comma in HTML editor in Infraworks, it grabs values onlyt from datasource table. Whatever you have in a field with real (double, float) number data, Infraworks will display the integer number plus point and 15 digits after it. Exceptions are numbers that have only a zero after&amp;nbsp;point. But, as I wrote in question, numbers like 20.3 will be shown like 20.300000000000001.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Recently I observred javascript guide for Infraworks and found method similar to &lt;FONT face="courier new,courier"&gt;arcpy.da.UpdateCursor&lt;/FONT&gt; from ArcGIS (I'm still user of this software) there. And for objects which numbers I want to be show correctly, wrote a script that creates a substitute of a tooltip. It works for&amp;nbsp;certain selected objects in a model but can be edited to update all needed data.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here it goes:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;var db  = app.ActiveModelDb;
var classID = db.TableIndex("USER_BUILDINGS"); //reference to a datasource
var table   = db.Table(classID);    

var sset = app.ActiveSelectionSet; //taking only selected object
var filter = sset.GetFilter(db.TableIndex("USER_BUILDINGS")); 

table.StartQuery(filter); 
table.BeginWriteBatch();
var read;
var write = table.GetWriteRow();
while (read = table.Next()) { //loop through selected objects
    var sq = read.USER_SUM_ALL; //getting float number
    write.TAG = "&amp;lt;div&amp;gt;&amp;lt;b&amp;gt;&amp;lt;font size='5'&amp;gt;SQUARE is " + sq.toFixed(1).toString(); //limit digits and comvert into a string
    table.UpdateFeature(write, read.ID); //updating feature
}
table.EndQuery();&lt;/PRE&gt;&lt;P&gt;After that the tooltip for layer should be just&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;%TAG%&lt;/PRE&gt;&lt;P&gt;As a result the original data will be displayed in tooltip.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 17 Oct 2018 12:51:08 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/infraworks-forum/wrong-display-of-float-numbers/m-p/8340329#M11150</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-10-17T12:51:08Z</dc:date>
    </item>
  </channel>
</rss>

