Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

68 Commits

Repository files navigation

Infoworks Ruby Scripts

A collection of useful Ruby scripts to help automate the building, calibrating and running of models in InfoWorks.

For a complete, end-to-end example of building a model directly from GIS data, see the Automated GIS-Model Pipeline.

Have a script to share? Submit a pull request, open an issue or send me an email - luke@matrado.ca

Downloading and using scripts

placeholder

The simplest way to get all the scripts is to download the whole collection as a zip from GitHub.

Click Clone or download and then Download Zip.

To run a Ruby script in InfoWorks, click Network > Run Ruby Script in the toolbar and then select a .rb file.

Suggest a new script

If you have an idea for a script that you want developed, please open an issue or send me an email - luke@matrado.ca

List of scripts

Simple

If you are a beginner and just learning Ruby these scripts can be used as a reference to learn how to automate simple tasks.

Each of these scripts will only complete a single task and the code within will be commented to provide context for those not familiar with coding in Ruby.

NamePurpose
Modify Network DataUpdate pipe diameters based on information in the user text fields
Create Network ObjectsCreate new network objects
Modify Structured DataUpdate structured data, these fields are displayed as tables within InfoWorks, such as depth/volume for reservoirs
Set Material Using LookupUpdate material field on pipes using a Ruby hash as a lookup table
Expand Short LinksExpands links to be a minimum size
Trace NetworkFrom a single pipe, use Ruby to trace a distribution network finding pipes of the same size or smaller
Validate NetworkRun a network validation from Ruby

Intermediate

Intermediate scripts attempt to automate realistic modelling tasks using Ruby. These scripts will contain multiple tasks that flow from each other. High-level comments are provided, though some experience with coding would be expected to modify or extend the scripts.

Config variables are generally added to the top of the script to allow some level of customisation and running the scripts directly by the end-user with minimal modification.

NamePurpose
Open Data Import CentreAutomate the import multiple of shape files, including filtering assets
Demand Allocation - ExchangeAllocate customer points using Exchange

Complex

NamePurpose
Convert Network to GeoJSONConverts an InfoWorks network or simulation into a GeoJSON file
Split pipes with nodesSimilar to proximity trace, finds overlapping nodes or interesections and splits the pipe
Create Selection Lists from AreasReads the area codes from within a model and create selection lists for each area.
Set elevations using Ordnance Survey NTFCalculate the elevation of point objects within Great Britain using Ordance Survey NTF files
Demand Allocation - CustomAllocate customer points to the nearest pipe
Exchange Full Model Build and Run ExampleCreate and run a model from raw data in the command line using Infoworks Exchange.

Automated GIS-Model Pipeline for InfoWorks WS Pro

This is a complete, end-to-end example of a model build pipeline. It takes raw GIS data from a corporate utilities GIS system, cleans it, processes it, and builds a InfoWorks WS Pro model without any manual preprocessing. It serves as a reference for complex, multi-stage automation tasks.

View the Full Project README

About

A collection of useful Ruby scripts for InfoWorks

Resources

Stars

39 stars

Watchers

7 watching

Forks

Releases

Packages

Contributors

Languages