Skip to content

Commit a0bdc22

Browse files
Update to new version : 4.8.0.0
1 parent f30dd60 commit a0bdc22

17 files changed

+548
-17
lines changed

underautomation/fanuc/ftp/diagnosis/program_states.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def task_states(self) -> typing.List[TaskState]:
2424

2525
@task_states.setter
2626
def task_states(self, value: typing.List[TaskState]):
27-
self._instance.TaskStates = value
27+
self._instance.TaskStates = [x._instance if x else None for x in value]
2828

2929
@property
3030
def name(self) -> str:

underautomation/fanuc/ftp/diagnosis/task_state.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def history(self) -> typing.List[TaskHistoryData]:
5252

5353
@history.setter
5454
def history(self, value: typing.List[TaskHistoryData]):
55-
self._instance.History = value
55+
self._instance.History = [x._instance if x else None for x in value]
5656

5757
def __str__(self):
5858
return self._instance.ToString() if self._instance is not None else ""
7.5 KB
Binary file not shown.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
4.7.0.0
1+
4.8.0.0
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import typing
2+
from underautomation.fanuc.snpx.internal.batch_assignment_2 import BatchAssignment2
3+
from underautomation.fanuc.snpx.internal.comment_data import CommentData
4+
from UnderAutomation.Fanuc.Snpx.Assignment import CommentBatchAssignment as comment_batch_assignment
5+
6+
class CommentBatchAssignment(BatchAssignment2[str, CommentData]):
7+
'''Batch assignment for reading multiple comments at once.'''
8+
def __init__(self, _internal = 0):
9+
'''Initializes a new instance of the CommentBatchAssignment class.'''
10+
if(_internal == 0):
11+
self._instance = comment_batch_assignment()
12+
else:
13+
self._instance = _internal
14+
15+
def read(self) -> typing.List[str]:
16+
'''Reads all comments assigned in this batch.
17+
18+
:returns: An array of comment strings.
19+
'''
20+
return self._instance.Read()
21+
22+
def __str__(self):
23+
return self._instance.ToString() if self._instance is not None else ""
24+
25+
def __repr__(self):
26+
return self.__str__()
27+
28+
def __eq__(self, other) -> bool:
29+
if not isinstance(other, CommentBatchAssignment):
30+
NotImplemented
31+
return self._instance.Equals(other._instance)
32+
33+
def __hash__(self) -> int:
34+
return self._instance.GetHashCode() if self._instance is not None else 0
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import typing
2+
from underautomation.fanuc.snpx.internal.batch_assignment_2 import BatchAssignment2
3+
from underautomation.fanuc.snpx.internal.simulation_data import SimulationData
4+
from UnderAutomation.Fanuc.Snpx.Assignment import SimulationStatusBatchAssignment as simulation_status_batch_assignment
5+
6+
class SimulationStatusBatchAssignment(BatchAssignment2[bool, SimulationData]):
7+
'''Batch assignment for reading multiple I/O simulation statuses at once.'''
8+
def __init__(self, _internal = 0):
9+
'''Initializes a new instance of the SimulationStatusBatchAssignment class.'''
10+
if(_internal == 0):
11+
self._instance = simulation_status_batch_assignment()
12+
else:
13+
self._instance = _internal
14+
15+
def read(self) -> typing.List[bool]:
16+
'''Reads all simulation statuses assigned in this batch.
17+
18+
:returns: An array of boolean values indicating simulation state.
19+
'''
20+
return self._instance.Read()
21+
22+
def __str__(self):
23+
return self._instance.ToString() if self._instance is not None else ""
24+
25+
def __repr__(self):
26+
return self.__str__()
27+
28+
def __eq__(self, other) -> bool:
29+
if not isinstance(other, SimulationStatusBatchAssignment):
30+
NotImplemented
31+
return self._instance.Equals(other._instance)
32+
33+
def __hash__(self) -> int:
34+
return self._instance.GetHashCode() if self._instance is not None else 0
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import typing
2+
from underautomation.fanuc.snpx.internal.batch_assignment_2 import BatchAssignment2
3+
from underautomation.fanuc.snpx.internal.string_register_span import StringRegisterSpan
4+
from UnderAutomation.Fanuc.Snpx.Assignment import StringRegistersSpanBatchAssignment as string_registers_span_batch_assignment
5+
6+
class StringRegistersSpanBatchAssignment(BatchAssignment2[str, StringRegisterSpan]):
7+
'''Batch assignment for reading multiple string registers at once.'''
8+
def __init__(self, _internal = 0):
9+
'''Initializes a new instance of the StringRegistersBatchAssignment class.'''
10+
if(_internal == 0):
11+
self._instance = string_registers_span_batch_assignment()
12+
else:
13+
self._instance = _internal
14+
15+
def read(self) -> typing.List[str]:
16+
'''Reads all string registers assigned in this batch.
17+
18+
:returns: An array of string values.
19+
'''
20+
return self._instance.Read()
21+
22+
def __str__(self):
23+
return self._instance.ToString() if self._instance is not None else ""
24+
25+
def __repr__(self):
26+
return self.__str__()
27+
28+
def __eq__(self, other) -> bool:
29+
if not isinstance(other, StringRegistersSpanBatchAssignment):
30+
NotImplemented
31+
return self._instance.Equals(other._instance)
32+
33+
def __hash__(self) -> int:
34+
return self._instance.GetHashCode() if self._instance is not None else 0
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
import typing
2+
from underautomation.fanuc.snpx.internal.comment_type import CommentType
3+
from UnderAutomation.Fanuc.Snpx.Internal import CommentData as comment_data
4+
from UnderAutomation.Fanuc.Snpx.Internal import CommentType as comment_type
5+
6+
class CommentData:
7+
'''Specifies the data type, index, and string length for reading or writing a comment via SNPX.'''
8+
def __init__(self, type: CommentType, index: int, stringLength: int, _internal = 0):
9+
'''Creates a new instance with the specified type, index, and optional string length.
10+
11+
:param type: The type of data to read the comment for.
12+
:param index: The 1-based index of the element.
13+
:param stringLength: The number of characters (must be even, >= 2). Default is 16.
14+
'''
15+
if(_internal == 0):
16+
self._instance = comment_data(type, index, stringLength)
17+
else:
18+
self._instance = _internal
19+
20+
def get_hash_code(self) -> int:
21+
return self._instance.GetHashCode()
22+
23+
def equals(self, obj: typing.Any) -> bool:
24+
return self._instance.Equals(obj)
25+
26+
@property
27+
def type(self) -> CommentType:
28+
'''The type of data to read the comment for.'''
29+
return CommentType(int(self._instance.Type))
30+
31+
@type.setter
32+
def type(self, value: CommentType):
33+
self._instance.Type = comment_type(int(value))
34+
35+
@property
36+
def index(self) -> int:
37+
'''The 1-based index of the element. Must be >= 1.'''
38+
return self._instance.Index
39+
40+
@index.setter
41+
def index(self, value: int):
42+
self._instance.Index = value
43+
44+
@property
45+
def string_length(self) -> int:
46+
'''Number of characters to read/write. Must be even, >= 2. Default is 16.'''
47+
return self._instance.StringLength
48+
49+
@string_length.setter
50+
def string_length(self, value: int):
51+
self._instance.StringLength = value
52+
53+
def __str__(self):
54+
return self._instance.ToString() if self._instance is not None else ""
55+
56+
def __repr__(self):
57+
return self.__str__()
58+
59+
def __eq__(self, other) -> bool:
60+
if not isinstance(other, CommentData):
61+
NotImplemented
62+
return self._instance.Equals(other._instance)
63+
64+
def __hash__(self) -> int:
65+
return self._instance.GetHashCode() if self._instance is not None else 0
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
from enum import IntEnum
2+
3+
class CommentType(IntEnum):
4+
'''Identifies the type of data for which a comment can be read or written.'''
5+
Register = 0 # Numeric register R[].
6+
PositionRegister = 1 # Position register PR[].
7+
StringRegister = 2 # String register SR[].
8+
DI = 3 # Digital Input.
9+
DO = 4 # Digital Output.
10+
RI = 5 # Remote Input.
11+
RO = 6 # Remote Output.
12+
UI = 7 # User Input.
13+
UO = 8 # User Output.
14+
SI = 9 # System Input.
15+
SO = 10 # System Output.
16+
WI = 11 # Weld Input.
17+
WO = 12 # Weld Output.
18+
WSI = 13 # Wire Stick Input.
19+
WSO = 14 # Wire Stick Output.
20+
GI = 15 # Group Input.
21+
GO = 16 # Group Output.
22+
AI = 17 # Analog Input.
23+
AO = 18 # Analog Output.
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
import typing
2+
from underautomation.fanuc.snpx.internal.comment_type import CommentType
3+
from underautomation.fanuc.snpx.internal.snpx_writable_assignable_elements_3 import SnpxWritableAssignableElements3
4+
from underautomation.fanuc.snpx.internal.comment_data import CommentData
5+
from underautomation.fanuc.snpx.assignment.comment_batch_assignment import CommentBatchAssignment
6+
from UnderAutomation.Fanuc.Snpx.Internal import Comments as comments
7+
from UnderAutomation.Fanuc.Snpx.Internal import CommentType as comment_type
8+
9+
class Comments(SnpxWritableAssignableElements3[str, CommentData, CommentBatchAssignment]):
10+
'''Provides read/write access to comments of registers, I/O signals and other data via SNPX.'''
11+
def __init__(self, _internal = 0):
12+
if(_internal == 0):
13+
self._instance = comments()
14+
else:
15+
self._instance = _internal
16+
17+
def read(self, type: CommentType, index: int, stringLength: int=16) -> str:
18+
'''Reads the comment for the specified data type and index.
19+
20+
:param type: The type of data.
21+
:param index: The 1-based element index.
22+
:param stringLength: The number of characters to read (must be even, >= 2). Default is 16.
23+
:returns: The comment string.
24+
'''
25+
return self._instance.Read(comment_type(int(type)), index, stringLength)
26+
27+
def write(self, type: CommentType, index: int, value: str, stringLength: int=16) -> None:
28+
'''Writes a comment for the specified data type and index.
29+
30+
:param type: The type of data.
31+
:param index: The 1-based element index.
32+
:param value: The comment string to write.
33+
:param stringLength: The number of characters to write (must be even, >= 2). Default is 16.
34+
'''
35+
self._instance.Write(comment_type(int(type)), index, value, stringLength)
36+
37+
def __str__(self):
38+
return self._instance.ToString() if self._instance is not None else ""
39+
40+
def __repr__(self):
41+
return self.__str__()
42+
43+
def __eq__(self, other) -> bool:
44+
if not isinstance(other, Comments):
45+
NotImplemented
46+
return self._instance.Equals(other._instance)
47+
48+
def __hash__(self) -> int:
49+
return self._instance.GetHashCode() if self._instance is not None else 0

0 commit comments

Comments
 (0)