Closed gnail13 closed 4 years ago
You use the same syntax as in RSLogix/Logix Designer:
MyTag[0,0]
Can I use indirect addressing like MyTag[i,j] to access the array other than tag.Read(MyTag[0,0], 100)?
In other words can I traves the array with for loop? So I can read the data on first dimension MyTag[i,0].
You could do something like:
for i in range(10):
tag_name = 'MyTag[{},0]'.format(i)
ret = comm.Read(tag_name, 100)
Is that what you were thinking?
I am not sure that's the result I wants but I would try it. Thank you.
First iteration would get you 100 values starting at Mytag[0,0] (MyTag[0,0-99]) Next iteration would get you 100 values starting at Mytag[1,0] (MyTag[1,0-99]) and so on
Edit: If you can't get the result you want, describe in some more details exactly what you want to read and I'll give a more specific suggestion
Thank you dmroeder. That's what I need.
I am having similar issues:
Need to read the entire TD_Array DINT[10,7]
'''What is wrong with the code?'''
from pylogix import PLC
with PLC() as comm: comm.IPAddress = '192.168.1.15' ret = comm.Read('TD_Array[10,7]' ) #what do I nee to specify? print(ret.Value)
'''Thank you for the help'''
Install the latest version (0.8.8). I broke something with multi dimension arrays.
https://github.com/dmroeder/pylogix/commit/0070aba09f705e541ec57cb33017289ec26c5bd1
pip install --upgrade pylogix
Nevermind!!!! Iit works, Thank YOU!!!!!!!
Hi all,
I have a project that I need to retrive a two-dimensional array size of [1000][7]. How can I read it? Thanks in advance.
Lan