Hacking Infraworks Schema Editor
A few people recently reached out to me on LinkedIn about how to create and edit custom attributes in InfraWorks® and that interest sparked the idea to write this article. In previous releases of InfraWorks, if you wanted to create custom properties for your data you had to hack InfraWorks and manually create and edit an im.schema.json file, hope that all of the syntax was correct, and pray that it would not corrupt your model. But with the recent addition of the Schema Editor to the InfraWorks tool set, all the guesswork is taken out of the syntax formatting and it allows you to quickly and easily extend your data for any object class: buildings, pipes, roads, etc. Here’s how…
Create Your Data
From the Model Explorer, right-click on any of the categories and select Add Extend Schema... to display the Extend Schema Tool dialog box (Figure 1).
Figure 1
To begin, you must create a new feature class and display name. This new feature class will be the container for every new attribute you add. There are fives data types you can add:
- Boolean – a Yes/No value, represented by a toggle.
- Date/Time – displays a calendar from which you can choose a date.
- Double – a number value that can represent either a whole or fractional (decimal) value.
- Integer – a whole number.
- String – can contain letters, numbers, and special characters.
Using these attribute types, you can add any kind of data to your model. It could be building owner, pipe installation dates, roadway types (materials), building square footage, etc. The possibilities are limitless. In my example I’ve created a new feature class called “AUGI_World_May_2019” and three attributes for building data; Construction_Date, Owner, and Usage_Type.
It’s important to note that these new attributes will only be available to new building data that you import into your model through SHP files or the like. When you configure the data, you’ll see the newly created feature class available. Select AUGI Building Data and Close & Refresh to import the buildings (Figure 2).
Figure 2
Update Your Data
If you’re like most people, you probably have an Excel spreadsheet of data with all the relevant information for buildings, pipe networks, roadway data, etc. for a project. You can populate the attributes of your model objects the tedious and time-consuming way of manually entering the data or… you can use a small piece of JavaScript code to quickly pull in the data.
I wrote an Autodesk Knowledge Network article titled “Update InfraWorks 360 data using JavaScript and a CSV file” back in June 2016 about how to pull in the data using a unique identifier of a particular class. That identifier could be the building owner’s name, the building ID number, street name, pipe type, pipe material, etc. And based on that unique identifier, the JavaScript code will look at all the selected buildings and when it finds a matching value in the CSV file, it will apply the cooresponding information to the attributes specified in the JavaScript code.
The following code is from my AKN article, but it can be modified to suit your needs, attributes, and CSV formatting. The code, in this case, is using the building name (read.NAME) as the unique identifier. When it finds a matching name from the CSV file, it then automatically fills in the attributes for USER_DATA (a custom attribute. All custom attributes begin with USER_), DESCRIPTION, and ROOF_HEIGHT.
Figure 3
Visualize Your Data
Using Feature Themes and your new custom feature class attributes, you can visualize and present your model data in easy-to-understand, color-coded view. In Figure 4, I’ve created a Feature Theme to visualize the data for the Usage attribute. There are four different values applied to the UsageType attribute: Educational, Government, Residential, and Retail. Displaying your data to clients, owners, and planning agencies using a Feature Theme makes it much easier to read and understand than a spreadsheet.
Figure 4
Report Your Data
If your client is someone who enjoys scrolling through row after row of data, then you can provide them with that as well. From the Model Explorer panel, select a feature class and choose View In Data Table. This will display the Data Table from which you can export all feature class data to a CSV file (Figure 5).
Figure 5
Matt Wunch is the Digital Content Creator for ARCAT.com in Fairfield, CT. He is an Autodesk Expert Elite member, Revit Certified Professional in Structure, Architecture, MEP – Mechanical and MEP – Electrical, a member of the planning committee of the Construction Institute's BIM Council, board member at AUGI, and owner & FAA licensed sUAS pilot at SkyViz.io. He can be reached for comments or questions at matt.wunch@gmail.com, on Twitter @MattWunch, or LinkedIn.