- Python 3.7.13 (32-разрядная версия)
- clr -loader 0.2.6
- pythonnet 3.0.3
- Windows 11 (64-разрядная версия)
Код: Выделить всё
iRet = object.GetDevice(szDevice, out iData)
// Int iRet
// String szDevice
// Int iData
Код: Выделить всё
import clr
import numpy as np
DLL_FILE_PATH = 'blablabla\\ActUtlTypeLib.dll'
STATION_NUMBER = 1
szDevice = 'A0000'
clr.AddReference(DLL_FILE_PATH)
from ActUtlTypeLib import ActUtlType
act_util_type = ActUtlType()
act_util_type.ActLogicalStationNumber = STATION_NUMBER
ret, val = act_util_type.GetDevice(szDevice)
assert ret == 0, f'GetDevice error: {ret}'
print(val)
Код: Выделить всё
iRet = object.ReadDeviceBlock(ref szLabel, iSize, ref iData)
// Int iRet
// String szLabel
// Int iSize
// Int[n] iData
Код: Выделить всё
# All the combinations of 'Type' and 'Trial' didn't work
length = 1000
# arr = [] # Type 1
# arr = [0 for _ in range(length)] # Type 2
arr = np.zeros(length, np.int32) # Type 3
# ret, val = act_util_type.ReadDeviceBlock(ADDRESS, length) # Trial 1
# ret = act_util_type.ReadDeviceBlock(ADDRESS, length, arr) # Trial 2
ret = act_util_type.ReadDeviceBlock(ADDRESS, length, arr[0]) # Trial 3
Руководство по компоненту 4 MX
Подробнее здесь: https://stackoverflow.com/questions/787 ... ing-python