-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCreateMatrix.py
More file actions
30 lines (23 loc) · 763 Bytes
/
CreateMatrix.py
File metadata and controls
30 lines (23 loc) · 763 Bytes
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
import valispace
deployment = input("Deployment Name:")
username = input("Username: ")
password = input("Password: ")
valispace = valispace.API(url="https://"+deployment+".valispace.com/", username=username, password=password)
Matrix = {
"name": "MatrixName5",
"number_of_columns": 2,
"number_of_rows": 2,
"parent": , # ID of Parent Component
"unit": "kg"
}
posted_matrix = valispace.post("matrices/", Matrix)
matrix_id = posted_matrix["id"]
MatrixValues = [[1, 2], [3, 4]]
for row in posted_matrix["cells"]:
for cell in row:
Vali = {
"shortname": "vali_"+str(cell),
"formula": MatrixValues[posted_matrix["cells"].index(row)][row.index(cell)],
"parent": matrix_id
}
patched_vali = valispace.request("patch", "valis/"+str(cell)+"/", Vali)