winIDEA SDK
test_area.py
1# This script is licensed under BSD License, see file LICENSE.txt.
2#
3# (c) TASKING Germany GmbH, 2023
4
5import isystem.connect as ic
6
7
8winidea_id = ''
9
10
11def test_area():
12 connMgr = ic.ConnectionMgr()
13 connMgr.connect(ic.CConnectionConfig().instanceId(winidea_id))
14
15 covCtrl = ic.CCoverageController2(connMgr, r'example.trd', "u")
16 covCtrl.waitUntilLoaded(5000, isThrow=True)
17 triggerIndex = covCtrl.getActiveTriggerIndex()
18
19 AREA = ic.CCoverageController2.EAreaFunction
20 covCtrl.setScope(triggerIndex, AREA)
21 covCtrl.addArea(triggerIndex, AREA, "myArea")
22 covCtrl.addArea(triggerIndex, AREA, "myArea2")
23 areaName = covCtrl.areaType2Str(AREA)
24 print(f"Areas with names 'myArea' and 'myArea2' ware added, type: '{areaName}'.")
25
26 areas = ic.StrVector()
27 covCtrl.getAreas(triggerIndex, AREA, areas)
28 print(f"These areas are currently available: {', '.join(areas)}")
29
30 isRemoved = covCtrl.removeArea(triggerIndex, AREA, "myArea")
31 print(f"Area 'myArea' was removed: {isRemoved == 1}")
32
33 covCtrl.removeAllAreas(triggerIndex)
34 print(f"All areas were removed.")
35 covCtrl.close()
36
37
38if __name__ == "__main__":
39 test_area()