A Method (RUBY Scripting) to Import an InfoWorks ICM Model into InfoNet.

Over the years there has been one question from my InfoNet clients that has consistently popped up; “How do I import an InfoWorks ICM Model into InfoNet?”. I must have been asked this a squillion times, and the answer has always been the same.

“Since models don’t necessarily reflect what is in the ground, through model thinning, simplification or optioneering, InfoNet does not provide an importer, InfoNet is about data certainty and confidence.”

Because of the many import/export options available in both InfoWorks ICM and InfoNet there has always been the tedious and very long winded method of exporting data from InfoWorks ICM and then importing this into InfoNet. This meant exporting data to separate tables (CSV, TAB SHP etc.) from InfoWorks ICM and then importing these individually into InfoNet via the Open Data Import Centre (ODIC). That is creating a configuration for each table and then going through the myriad clicks in InfoNet ODIC to import one table at a time, which on top of the tedium, this manual method is also open to error.

So from all this demand (aiming to keep you all happy and avoid you tedium) as well as there now being a method to automate processes in InfoNet and InfoWorks (Ruby Scripting within the Innovyze Workgroup Client) I have devised/scripted a method that will first export from an InfoWorks ICM Model into an InfoNet Collection Network.

Method.

Disclaimer: The RUBY Scripts used may not be the most efficient or comprehensive, they do however do what they say on the tin. They import most of the InfoWorks ICM objects into InfoNet (NB rivers, open channels and custom shapes are not considered) and the configuration file maps most of the relevant fields. If for any reason there are any that I have omitted or overlooked then please feel free to get in touch and enlighten me. Ongoing, I will make any relevant changes to the files.

1. Download and extract contents of the following ZIP File: InfoNet_ICM_Model_Importer.ZIP

2. The contents are:
– ICM_Model_Importer.cfg.” – Import into InfoNet configuration file.
– ICM_Out.rb.” – InfoWorks ICM model export ruby script.
– InfoNet_In.rb – InfoNet InfoWorks ICM model import ruby script.

3. Create a folder on a local or network drive (what it is named is unimportant), this is an import/export folder where temporary files are written to.

4. Copy the ICM_Model_Importer.cfg file into the folder.

5. Copy the script files into the same or a different folder.

6. This next part (applying scripts to user buttons) is optional since scripts can be run from the application interface (InfoWorks ICM & InfoNet) interface, main menu > Network > Run Ruby script… I am suggesting applying the scripts to ‘user custom actions’ or ‘shared custom actions’. Read more about these user/shared custom actions in the HELP File.

Custom Actions

Custom Actions

For this blog example I am running InfoNet and InfoWorks ICM in the one interface together. So both custom user action are in this one InfoWorks ICM interface. Otherwise the ICM_Out.rb script needs to be within InfoWorks ICM and InfoNet_In.rb within InfoNet.

The image below shows how I’ve configured my custom user actions.

Ruby Scripts on User or Shared Custom Actions

Ruby Scripts on User or Shared Custom Actions

7. In my example I open both Networks and initially focus on the InfoWorks ICM Model Network.

InfoWorks ICM & InfoNet GeoPlans

InfoWorks ICM & InfoNet GeoPlans

8. Click on the ‘ICM Out’ custom action button. The script exports files to the default InfoWorks ICM csv format (manually main menu Network > Export > to CSV Files…). It allows for exporting of a selection. If ‘yes’ is selected and there is a selection of model objects the those objects only are exported. If there is no selection the export csv files are created with just the field headers (i.e. no objects exported). If ‘no’ is selected then the entire network is exported. The user is given the option to browser for an export folder. This should be the folder created in step 3, containing the configuration file.

Exported CSV Files

Exported CSV Files

9. With the focus now on the InfoNet collection network, click on the ‘InfoNet In’ custom action button. Note the message about the configuration file. Click ‘yes’ to continue the import (clicking ‘no’ or ‘cancel’ terminates the import process). Browse for the import folder containing the CSV files. Hitting OK will start the import process.

Import into InfoNet

Import into InfoNet

10. Network imported.

Network Imported

Network Imported

Network Imported Detail

Network Imported Detail

Share this post!

    About Idris Nujjoo

    Idris is the Product Sector Leader for InfoNet and InfoMaster and has been working for Innovyze (and its earlier incarnations) since 2001 and specifically working on InfoNet and Asset Management for the past decade.

    This entry was posted in InfoNet, InfoWorks ICM. Bookmark the permalink.