<If you don’t like reading, there’s a video at the bottom of the post.>
I’ve been playing around with InfraWorks for a bit now and I’ve always meant to but never got around to figuring out the Style Rules until now. All I’ve seen with regards to the rules is how to randomize your display. Well, I don’t want to randomize it, I want it to be very specific! I want my offroad roads to look like offroad roads, I want my highways to look like highways, and I want my local roads to look like local roads. Well, read on and see how it’s done! It’s actually a lot easier then I expected.
This is what I’m getting, all the roads look the same:
And this is what I want, the roads stylized based on their classification:
First of all, you need a data source with information in it that you’ll use to stylize the InfraWorks objects. In the example I’m using, I downloaded the data from the GIS department for Loveland, Colorado. To get a quick idea of the data that’s in the shape file for the roads, I attached it to a Civil 3D drawing (just drag the .shp file into the Civil 3D drawing) and opened the data table. This particular data source has a field called ROAD_CLASS. Some of the values for ROAD_CLASS are: RAMP, LOCAL, HWY, CLCTR-MINOR, etc.
This is the data that I want to use to determine the style of the road. I’ve broken the process up into three steps, adding the data to the model, creating the style rule, and applying the style rule.
Adding the Data to the Model
I’m not going to get into how to add the shapefile to the model here, what I’m going to discuss is how to get that particular piece of data from the shapefile and add it to each road in the model. When configuring the data source (this can be done when it’s added or after the fact if needed), you’ll need to tell InfraWorks to include the piece of data you need. In this example, I’m going to add it to the description of the road. On the Common tab of the Data Source Configuration, simply hit the pull down to add the ROAD_CLASS field to the description of the roads.
Note: If you want to add the data to a different property, you can do this on the Table tab of the Data source Configuration dialog box.
Close and refresh and now we are ready to create the Style Rules.
Creating the Style Rule
Now, we want the style of these roads to be determined from the description so, let’s create a Style Rule. To open the Style Rules, select the big orange I in the top left of your model (I’m using 2014 R4 for this), select the button just to the right of it, “Create and manage your model”, and then select Style Rules.
In the Styles Rules, select the tab on the left for the feature you want to add the rules to (in this case I’m going to choose Roads) and then add the new rule by selecting the green plus. Give the rule a name (I’m using the roadway classification here) and then click OK.
Once the rule is added, double click on it to edit the rule. In the Rule Editor, you can change the name of the rule and add a description to the rule if you would like. The important part here are the “Expression:” and “Styles:” sections.
In the “Expressions:” section, select the Edit button to edit the expression (sounds obvious, doesn’t it?). In the Create Filter Expression dialog box, double click the property you want to filter on (in this case expand out Common and choose Description). This will add that property to the expression. Now, I only want this rule to be applied to the roads with a specific description so, type an equals sign “=” in the expression after DESCRIPTION. Finally, add the property to the expression. If you know it, you can just type it. If you want to select one of the properties that is in the data source, on the right hand side, find the property and then double click on the value to add it to the description.
After hitting OK, you’ll be back in the Rule Editor. In the “Styles:” section, simply add the styles you want this rule to apply. If you want them all to be the same, simply add the one style you want. If you want them to vary, you can add multiple styles and then adjust the probability to force one style to be added more often then another.
Now continue the process until you’ve added a rule for each roadway type you have.
Applying the Style Rule
This is the easiest part, once the Style Rule has been created, all you need to do is click on the Run Rules button at the bottom of the panel.
There are also options to export and import the Rule Styles so you don’t have to recreate them every time you need to do this.
Now get out there and have fun playing around with InfraWorks!