codesysultra 1.0.6 → 1.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
import sys
|
|
1
|
+
import sys
|
|
2
|
+
import scriptengine as script_engine
|
|
3
|
+
import traceback
|
|
4
|
+
import inspect
|
|
2
5
|
|
|
3
6
|
def get_codesys_system_api():
|
|
4
7
|
try:
|
|
5
|
-
print("
|
|
8
|
+
print("\n=== CODESYS Script Engine System API ===\n")
|
|
6
9
|
|
|
7
10
|
print("=== Script Engine Modules ===")
|
|
8
11
|
print("scriptengine module:")
|
|
@@ -11,34 +14,35 @@ def get_codesys_system_api():
|
|
|
11
14
|
try:
|
|
12
15
|
obj = getattr(script_engine, name)
|
|
13
16
|
obj_type = type(obj).__name__
|
|
14
|
-
print("
|
|
17
|
+
print(" {} ({})".format(name, obj_type))
|
|
15
18
|
|
|
16
19
|
if inspect.isclass(obj):
|
|
17
20
|
try:
|
|
18
|
-
methods = [
|
|
21
|
+
methods = []
|
|
22
|
+
for m in dir(obj):
|
|
23
|
+
if not m.startswith('_') and callable(getattr(obj, m)):
|
|
24
|
+
methods.append(m)
|
|
19
25
|
if methods:
|
|
20
26
|
print(" Available methods:")
|
|
21
27
|
for method in sorted(methods)[:20]:
|
|
22
|
-
print(" -
|
|
28
|
+
print(" - {}".format(method))
|
|
23
29
|
if len(methods) > 20:
|
|
24
|
-
print(" ... and
|
|
30
|
+
print(" ... and {} more".format(len(methods) - 20))
|
|
25
31
|
except Exception as e:
|
|
26
|
-
print(" Error listing methods:
|
|
32
|
+
print(" Error listing methods: {}".format(e))
|
|
27
33
|
except Exception as e:
|
|
28
|
-
print(" Error:
|
|
29
|
-
except Exception as e:
|
|
30
|
-
print(" Error: %s" % e)
|
|
34
|
+
print(" Error: {}".format(e))
|
|
31
35
|
|
|
32
|
-
print("
|
|
36
|
+
print("\n=== Script Engine Functions ===")
|
|
33
37
|
script_functions = []
|
|
34
38
|
for name in dir(script_engine):
|
|
35
39
|
if not name.startswith('_') and callable(getattr(script_engine, name)):
|
|
36
40
|
script_functions.append(name)
|
|
37
41
|
|
|
38
42
|
for func in sorted(script_functions):
|
|
39
|
-
print(" -
|
|
43
|
+
print(" - {}()".format(func))
|
|
40
44
|
|
|
41
|
-
print("
|
|
45
|
+
print("\n=== Available Enums ===")
|
|
42
46
|
try:
|
|
43
47
|
enums = []
|
|
44
48
|
for name in dir(script_engine):
|
|
@@ -47,17 +51,24 @@ def get_codesys_system_api():
|
|
|
47
51
|
enums.append((name, obj))
|
|
48
52
|
|
|
49
53
|
for enum_name, enum_obj in sorted(enums):
|
|
50
|
-
print("
|
|
54
|
+
print("\n{}:".format(enum_name))
|
|
51
55
|
try:
|
|
52
|
-
members = [
|
|
53
|
-
for
|
|
54
|
-
|
|
56
|
+
members = []
|
|
57
|
+
for name in dir(enum_obj):
|
|
58
|
+
if not name.startswith('_'):
|
|
59
|
+
members.append(name)
|
|
60
|
+
for member_name in sorted(members):
|
|
61
|
+
try:
|
|
62
|
+
member_value = getattr(enum_obj, member_name)
|
|
63
|
+
print(" {} = {}".format(member_name, member_value))
|
|
64
|
+
except Exception as e:
|
|
65
|
+
print(" Error: {}".format(e))
|
|
55
66
|
except Exception as e:
|
|
56
|
-
print(" Error:
|
|
67
|
+
print(" Error: {}".format(e))
|
|
57
68
|
except Exception as e:
|
|
58
|
-
print(" Error
|
|
69
|
+
print(" Error: {}".format(e))
|
|
59
70
|
|
|
60
|
-
print("
|
|
71
|
+
print("\n=== Project Management ===")
|
|
61
72
|
print("script_engine.projects module functions:")
|
|
62
73
|
project_functions = []
|
|
63
74
|
for name in dir(script_engine.projects):
|
|
@@ -65,54 +76,68 @@ def get_codesys_system_api():
|
|
|
65
76
|
project_functions.append(name)
|
|
66
77
|
|
|
67
78
|
for func in sorted(project_functions):
|
|
68
|
-
print(" -
|
|
79
|
+
print(" - {}()".format(func))
|
|
69
80
|
|
|
70
|
-
print("
|
|
81
|
+
print("\n=== POU Types ===")
|
|
71
82
|
try:
|
|
72
83
|
pou_types = []
|
|
73
84
|
for name in dir(script_engine):
|
|
74
85
|
obj = getattr(script_engine, name)
|
|
75
|
-
if
|
|
86
|
+
if 'PouType' in name:
|
|
76
87
|
pou_types.append((name, obj))
|
|
77
88
|
|
|
78
89
|
for type_name, type_obj in pou_types:
|
|
79
|
-
print("
|
|
90
|
+
print(" {}:".format(type_name))
|
|
80
91
|
try:
|
|
81
|
-
values = [
|
|
82
|
-
for
|
|
83
|
-
|
|
92
|
+
values = []
|
|
93
|
+
for name in dir(type_obj):
|
|
94
|
+
if not name.startswith('_') and name.isupper():
|
|
95
|
+
values.append(name)
|
|
96
|
+
for value_name in sorted(values):
|
|
97
|
+
try:
|
|
98
|
+
value_value = getattr(type_obj, value_name)
|
|
99
|
+
print(" {} = {}".format(value_name, value_value))
|
|
100
|
+
except Exception as e:
|
|
101
|
+
print(" Error: {}".format(e))
|
|
84
102
|
except Exception as e:
|
|
85
|
-
print(" Error:
|
|
103
|
+
print(" Error: {}".format(e))
|
|
86
104
|
except Exception as e:
|
|
87
|
-
print(" Error:
|
|
105
|
+
print(" Error: {}".format(e))
|
|
88
106
|
|
|
89
|
-
print("
|
|
107
|
+
print("\n=== Implementation Languages ===")
|
|
90
108
|
try:
|
|
91
109
|
impl_langs = []
|
|
92
110
|
for name in dir(script_engine):
|
|
93
111
|
obj = getattr(script_engine, name)
|
|
94
|
-
if
|
|
112
|
+
if 'ImplementationLanguage' in name:
|
|
95
113
|
impl_langs.append((name, obj))
|
|
96
114
|
|
|
97
115
|
for lang_name, lang_obj in impl_langs:
|
|
98
|
-
print("
|
|
116
|
+
print(" {}:".format(lang_name))
|
|
99
117
|
try:
|
|
100
|
-
values = [
|
|
101
|
-
for
|
|
102
|
-
|
|
118
|
+
values = []
|
|
119
|
+
for name in dir(lang_obj):
|
|
120
|
+
if not name.startswith('_') and name.isupper():
|
|
121
|
+
values.append(name)
|
|
122
|
+
for value_name in sorted(values):
|
|
123
|
+
try:
|
|
124
|
+
value_value = getattr(lang_obj, value_name)
|
|
125
|
+
print(" {} = {}".format(value_name, value_value))
|
|
126
|
+
except Exception as e:
|
|
127
|
+
print(" Error: {}".format(e))
|
|
103
128
|
except Exception as e:
|
|
104
|
-
print(" Error:
|
|
129
|
+
print(" Error: {}".format(e))
|
|
105
130
|
except Exception as e:
|
|
106
|
-
print(" Error:
|
|
131
|
+
print(" Error: {}".format(e))
|
|
107
132
|
|
|
108
|
-
print("
|
|
133
|
+
print("\n=== Version Info ===")
|
|
109
134
|
try:
|
|
110
135
|
version = getattr(script_engine, '__version__', 'Unknown')
|
|
111
|
-
print(" Script Engine Version:
|
|
136
|
+
print(" Script Engine Version: {}".format(version))
|
|
112
137
|
except Exception as e:
|
|
113
|
-
print(" Error getting version:
|
|
138
|
+
print(" Error getting version: {}".format(e))
|
|
114
139
|
|
|
115
|
-
print("
|
|
140
|
+
print("\n=== API Usage Examples ===")
|
|
116
141
|
print("Example 1: Open a project")
|
|
117
142
|
print(" project = script_engine.projects.open('C:/Projects/MyProject.project')")
|
|
118
143
|
print("")
|
|
@@ -128,15 +153,15 @@ def get_codesys_system_api():
|
|
|
128
153
|
print(" analyze(child, indent+1)")
|
|
129
154
|
print(" analyze(project)")
|
|
130
155
|
|
|
131
|
-
print("
|
|
156
|
+
print("\n=== Analysis Complete ===")
|
|
132
157
|
print("SCRIPT_SUCCESS: CODESYS system API retrieved successfully.")
|
|
133
158
|
sys.exit(0)
|
|
134
159
|
|
|
135
160
|
except Exception as e:
|
|
136
161
|
detailed_error = traceback.format_exc()
|
|
137
|
-
error_message = "Error retrieving CODESYS system API:
|
|
162
|
+
error_message = "Error retrieving CODESYS system API: {}\n{}".format(e, detailed_error)
|
|
138
163
|
print(error_message)
|
|
139
|
-
print("SCRIPT_ERROR:
|
|
164
|
+
print("SCRIPT_ERROR: {}".format(error_message))
|
|
140
165
|
sys.exit(1)
|
|
141
166
|
|
|
142
167
|
if __name__ == "__main__":
|
package/package.json
CHANGED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="utf-16"?>
|
|
2
|
+
<Single xml:space="preserve" Type="{54dd0eac-a6d8-46f2-8c27-2f43c7e49861}" Method="IArchivable">
|
|
3
|
+
<Single Name="Name" Type="string"><MachineProjectRoot></Single>
|
|
4
|
+
<Dictionary Type="System.Collections.Hashtable" Name="SubKeys" />
|
|
5
|
+
<Dictionary Type="System.Collections.Hashtable" Name="Values" />
|
|
6
|
+
</Single>
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="utf-16"?>
|
|
2
|
+
<Single xml:space="preserve" Type="{54dd0eac-a6d8-46f2-8c27-2f43c7e49861}" Method="IArchivable">
|
|
3
|
+
<Single Name="Name" Type="string"><UserProjectRoot></Single>
|
|
4
|
+
<Dictionary Type="System.Collections.Hashtable" Name="SubKeys">
|
|
5
|
+
<Entry>
|
|
6
|
+
<Key>
|
|
7
|
+
<Single Type="string">{4F76D0CF-5F2B-4f90-B443-B3FED105365A}</Single>
|
|
8
|
+
</Key>
|
|
9
|
+
<Value>
|
|
10
|
+
<Single Type="{54dd0eac-a6d8-46f2-8c27-2f43c7e49861}" Method="IArchivable">
|
|
11
|
+
<Single Name="Name" Type="string">{4F76D0CF-5F2B-4f90-B443-B3FED105365A}</Single>
|
|
12
|
+
<Dictionary Type="System.Collections.Hashtable" Name="SubKeys" />
|
|
13
|
+
<Dictionary Type="System.Collections.Hashtable" Name="Values" />
|
|
14
|
+
</Single>
|
|
15
|
+
</Value>
|
|
16
|
+
</Entry>
|
|
17
|
+
<Entry>
|
|
18
|
+
<Key>
|
|
19
|
+
<Single Type="string">{79968A73-AAAA-46E3-B71D-DD238D1A198A}</Single>
|
|
20
|
+
</Key>
|
|
21
|
+
<Value>
|
|
22
|
+
<Single Type="{54dd0eac-a6d8-46f2-8c27-2f43c7e49861}" Method="IArchivable">
|
|
23
|
+
<Single Name="Name" Type="string">{79968A73-AAAA-46E3-B71D-DD238D1A198A}</Single>
|
|
24
|
+
<Dictionary Type="System.Collections.Hashtable" Name="SubKeys" />
|
|
25
|
+
<Dictionary Type="System.Collections.Hashtable" Name="Values">
|
|
26
|
+
<Entry>
|
|
27
|
+
<Key>
|
|
28
|
+
<Single Type="string">DefaultLocalizationCulture</Single>
|
|
29
|
+
</Key>
|
|
30
|
+
<Value>
|
|
31
|
+
<Single Type="string"></Single>
|
|
32
|
+
</Value>
|
|
33
|
+
</Entry>
|
|
34
|
+
</Dictionary>
|
|
35
|
+
</Single>
|
|
36
|
+
</Value>
|
|
37
|
+
</Entry>
|
|
38
|
+
<Entry>
|
|
39
|
+
<Key>
|
|
40
|
+
<Single Type="string">{B431F4F6-68E9-4767-9143-6471A69719A9}</Single>
|
|
41
|
+
</Key>
|
|
42
|
+
<Value>
|
|
43
|
+
<Single Type="{54dd0eac-a6d8-46f2-8c27-2f43c7e49861}" Method="IArchivable">
|
|
44
|
+
<Single Name="Name" Type="string">{B431F4F6-68E9-4767-9143-6471A69719A9}</Single>
|
|
45
|
+
<Dictionary Type="System.Collections.Hashtable" Name="SubKeys" />
|
|
46
|
+
<Dictionary Type="System.Collections.Hashtable" Name="Values">
|
|
47
|
+
<Entry>
|
|
48
|
+
<Key>
|
|
49
|
+
<Single Type="string">ActiveApplicationGuid</Single>
|
|
50
|
+
</Key>
|
|
51
|
+
<Value>
|
|
52
|
+
<Single Type="string">{26f81cb7-7a7b-4e0d-b781-333c7c0256f9}</Single>
|
|
53
|
+
</Value>
|
|
54
|
+
</Entry>
|
|
55
|
+
</Dictionary>
|
|
56
|
+
</Single>
|
|
57
|
+
</Value>
|
|
58
|
+
</Entry>
|
|
59
|
+
<Entry>
|
|
60
|
+
<Key>
|
|
61
|
+
<Single Type="string">{E958CDB5-7DE4-41af-8650-09D402301787}</Single>
|
|
62
|
+
</Key>
|
|
63
|
+
<Value>
|
|
64
|
+
<Single Type="{54dd0eac-a6d8-46f2-8c27-2f43c7e49861}" Method="IArchivable">
|
|
65
|
+
<Single Name="Name" Type="string">{E958CDB5-7DE4-41af-8650-09D402301787}</Single>
|
|
66
|
+
<Dictionary Type="System.Collections.Hashtable" Name="SubKeys" />
|
|
67
|
+
<Dictionary Type="System.Collections.Hashtable" Name="Values" />
|
|
68
|
+
</Single>
|
|
69
|
+
</Value>
|
|
70
|
+
</Entry>
|
|
71
|
+
</Dictionary>
|
|
72
|
+
<Dictionary Type="System.Collections.Hashtable" Name="Values" />
|
|
73
|
+
</Single>
|
|
Binary file
|
|
Binary file
|