forked from chaitanyalakeshri/ruby_scripts
-
Notifications
You must be signed in to change notification settings - Fork 1
/
ICM_Ruby_Tutorials.rb
32 lines (24 loc) · 1.16 KB
/
ICM_Ruby_Tutorials.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#Accessing current network
net=WSApplication.current_network
#Accesing Row objects or collection of row objects
#There are four types of row objects: '_nodes', '_links', '_subcatchments', '_others'.
#Get all the nodes or links or subcatchments as row object collection
nodes_roc=net.row_object_collection('_nodes')
links_roc=net.row_object_collection('_links')
subcatchments_roc=net.row_object_collection('_subcatchments')
#one can also access exclusive tables like pump table ,conduit table or orifice table
pump_roc=net.row_object_collection('hw_pump')
#Get all the nodes or links or subcatchments as array
nodes_ro=net.row_objects('_nodes')
links_ro=net.row_objects('_links')
subcatchments_ro=net.row_objects('_subcatchments')
#one can also access exclusive tables like pump table ,conduit table or orifice table
pump_ro=net.row_objects('hw_pump')
#accessing an individual row object
ro=net.row_object('hw_conduit','1234567.1')
#Getting value of particular field from a specific row object
ro=net.row_object('hw_conduit','1234567.1').field_name
#selecting a particular object
ro=net.row_object('hw_conduit','1234567.1').selected=true
#clear selection
net.clear_selection