Support junctions api

This commit is contained in:
wqy
2022-09-03 00:35:02 +08:00
parent cce5f55a24
commit 1a23664028
2 changed files with 210 additions and 0 deletions

52
api/t_s2_junctions.py Normal file
View File

@@ -0,0 +1,52 @@
from project import *
from s2_junctions import *
p = "test_s2_junctions"
if is_project_open(p):
close_project(p)
if have_project(p):
delete_project(p)
create_project(p)
open_project(p)
j = 'j-1'
print(get_junction_coord(p, j)) # None
print(get_junction_elevation(p, j)) # None
print(get_junction_demand(p, j)) # None
print(get_junction_pattern(p, j)) # None
add_junction(p, j, 10.0, 20.0, 30.0)
print(get_junction_coord(p, j)) # {'x': 10.0, 'y': 20.0}
print(get_junction_elevation(p, j)) # 30.0
print(get_junction_demand(p, j)) # NULL
print(get_junction_pattern(p, j)) # NULL
set_junction_demand(p, j, 100.0)
print(get_junction_demand(p, j)) # 100.0
execute_undo(p)
print(get_junction_demand(p, j)) # NULL
execute_undo(p)
print(get_junction_coord(p, j)) # None
print(get_junction_elevation(p, j)) # None
print(get_junction_demand(p, j)) # None
print(get_junction_pattern(p, j)) # None
add_junction(p, j, 10.0, 20.0, 30.0)
print(get_junction_coord(p, j)) # {'x': 10.0, 'y': 20.0}
print(get_junction_elevation(p, j)) # 30.0
print(get_junction_demand(p, j)) # NULL
print(get_junction_pattern(p, j)) # NULL
set_junction_coord(p, j, 100.0, 200.0)
print(get_junction_coord(p, j)) # {'x': 100.0, 'y': 200.0}
execute_undo(p)
print(get_junction_coord(p, j)) # {'x': 10.0, 'y': 20.0}
close_project(p)
# delete_project(p)