This ruby script will find a node we specify in the network and provide us with the co-ordinates for that node and highlight the node in our mapper.
Here we’re using the WSApplication class and applying the method current_network. We’re telling Ruby to open the current network. We then are then assigning that to a variable we’ve called net (we can call this anything – network, current_network etc..)
adams_mh = net.row_object('hw_node', 'MH_adam')
Here we apply the method row_object to net. row_object is a method which looks for an item in a table. Our table for ICM nodes is called ‘hw_node‘. The item in that table is the manhole name. In this example, the manhole is called MH_adam. In your network it could have a name like MH4673928 or whatever. We then assign this value to a variable we’re calling adams_mh.
puts adams_mh puts adams_mh.x puts adams_mh.y
Here we are outputting the value for adam_mh. This outputs what ICM actually calls the node. It also selects that node in your network. If that node isn’t in your network, an error will be displayed.
We are also using the x and y methods to display the x and y co-ordinates of the associated node. In this example, the output would be something like this.
Selected in your model
Output on screen