<?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: Adding data sources to project with javascript in InfraWorks Forum</title>
    <link>https://forums.autodesk.com/t5/infraworks-forum/adding-data-sources-to-project-with-javascript/m-p/8388908#M10948</link>
    <description>&lt;P&gt;Hi @Anonymous&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;the explanation is probably that the API is from 2014 and was not developed/updated since then.&lt;/P&gt;
&lt;P&gt;The Civil 3D DWG import - and other functions - were added later to InfarWorks, so the API doesn't "know" about those.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Karsten.&lt;/P&gt;</description>
    <pubDate>Thu, 08 Nov 2018 14:30:53 GMT</pubDate>
    <dc:creator>Karsten.Saenger</dc:creator>
    <dc:date>2018-11-08T14:30:53Z</dc:date>
    <item>
      <title>Adding data sources to project with javascript</title>
      <link>https://forums.autodesk.com/t5/infraworks-forum/adding-data-sources-to-project-with-javascript/m-p/8386098#M10945</link>
      <description>&lt;P&gt;I have a *.sqlite base that was created in Infraworks sometime before and a I need to load some sources from it to the new project using javascript&lt;/P&gt;&lt;P&gt;While looking through some tips and js samples, I found one of the way to load data. As far as I undesrstood it uses&amp;nbsp;&lt;EM&gt;providers&lt;/EM&gt; method.&lt;/P&gt;&lt;P&gt;Here is a code where I want ro add &lt;EM&gt;BUILDINGS_NEW &lt;/EM&gt;to the data source list:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;var wkt = app.ActiveModel.CoordSysWkt;
file = "D:/Projects/MyModel.sqlite"
var sd = fdo.OpenDb(file)

print (sd.TableCount);
var providers = app.GetDataProviders(".sqlite");

for (i=0; i&amp;lt;sd.TableCount; i++) {
    if (sd.Table(i).Name == 'USER_BUILDINGS_NEW'){
        print ('        your table has been found');
        var tb_f = sd.Table(i)
        path_t = file + '/' + sd.Table(i).Name;
        for (p in providers) {
            var configs = providers[p].FileConnect(md, path_t);
            for (c in configs) {
                print (c);
                for (mm in c){
                    print (mm);
                }
                var cfg = configs[c];
                cfg.TargetClassName = 'BUILDINGS';
                cfg.SourceCoordSys = "XY-M";
                cfg.PosCoordSys = wkt;
                cfg.Name = 'USER_BUILDINGS_NEW';
                cfg.Description = 'DEAF';
                cfg.AnchorType = adsk.Enums.LocalOrigin;
                // cfg.Position = point.BBox3d.Center;
                cfg.Is3D = false;   
                var result = cfg.Import();

                if (result) {
                    print("INFO: 3d model imported for " + 'USER_BUILDINGS_NEW' + "; bbox = " + result.AffectedExtent.ToString());}
                else {
                    print("ERROR: 3d model import for " + 'USER_BUILDINGS_NEW' + " failed: " + path_t);
                    success = false;
                }
            }
        }               
    }
}&lt;BR /&gt;&lt;BR /&gt;&lt;/PRE&gt;&lt;P&gt;Here I've got nothing.&lt;/P&gt;&lt;P&gt;What can be wrong or is there a completely another way to add new data?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 07 Nov 2018 14:58:04 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/infraworks-forum/adding-data-sources-to-project-with-javascript/m-p/8386098#M10945</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-11-07T14:58:04Z</dc:date>
    </item>
    <item>
      <title>Re: Adding data sources to project with javascript</title>
      <link>https://forums.autodesk.com/t5/infraworks-forum/adding-data-sources-to-project-with-javascript/m-p/8388826#M10946</link>
      <description>&lt;P&gt;Hi @Anonymous&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;do you know the Java Script API documentation of InfraWorks?&lt;/P&gt;
&lt;P&gt;It's attached in the following knowledge base article:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://knowledge.autodesk.com/article/Autodesk-InfraWorks-JavaScript-API-Documentation" target="_blank"&gt;http://knowledge.autodesk.com/article/Autodesk-InfraWorks-JavaScript-API-Documentation&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Start searching for "SaveActiveCityAsJson" and "CreateCityFromJson" or "ImportDataSourcesIntoActiveModel" or "ImportDataSourcesIntoActiveModel"...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Karsten&lt;/P&gt;</description>
      <pubDate>Thu, 08 Nov 2018 14:04:49 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/infraworks-forum/adding-data-sources-to-project-with-javascript/m-p/8388826#M10946</guid>
      <dc:creator>Karsten.Saenger</dc:creator>
      <dc:date>2018-11-08T14:04:49Z</dc:date>
    </item>
    <item>
      <title>Re: Adding data sources to project with javascript</title>
      <link>https://forums.autodesk.com/t5/infraworks-forum/adding-data-sources-to-project-with-javascript/m-p/8388838#M10947</link>
      <description>&lt;P&gt;Yes, already found and tested it. However *.dwg models do not load properly, Infraworks says that datasource is missing but json file contains all needed data for import.&lt;/P&gt;</description>
      <pubDate>Thu, 08 Nov 2018 14:08:46 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/infraworks-forum/adding-data-sources-to-project-with-javascript/m-p/8388838#M10947</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-11-08T14:08:46Z</dc:date>
    </item>
    <item>
      <title>Re: Adding data sources to project with javascript</title>
      <link>https://forums.autodesk.com/t5/infraworks-forum/adding-data-sources-to-project-with-javascript/m-p/8388908#M10948</link>
      <description>&lt;P&gt;Hi @Anonymous&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;the explanation is probably that the API is from 2014 and was not developed/updated since then.&lt;/P&gt;
&lt;P&gt;The Civil 3D DWG import - and other functions - were added later to InfarWorks, so the API doesn't "know" about those.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Karsten.&lt;/P&gt;</description>
      <pubDate>Thu, 08 Nov 2018 14:30:53 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/infraworks-forum/adding-data-sources-to-project-with-javascript/m-p/8388908#M10948</guid>
      <dc:creator>Karsten.Saenger</dc:creator>
      <dc:date>2018-11-08T14:30:53Z</dc:date>
    </item>
  </channel>
</rss>

