We are working on getting data from arrays on a Siemens 840D sl CNC in the context of a circular buffer for data from the CNC. The data is stored in an array using standard circular buffer head and tail variables that store the array index position. As data is stored using a subprogram on the CNC the head is incremented. Ignition reads the head, tail, and array length as tags. When the buffer length is greater than zero the data shall be read, stored, and the tail moved to the most recent value read. I searched the different ways to collect the data as an index range from the Sinumerik controls and didn't find much that was very clear so I'm sharing here to help others if they should ever need to do something similar. The following syntax will read a range of the variable _CD_DATA_ID in GUD6 from the Sinumerik controller via OPC-UA:
tagPath = 'nsu=SinumerikVarProvider;s=/NC/_N_CH_GD6_ACX/_CD_DATA_ID[5,104]'
where 5 and 104 are the limits (tail and head) of the array read. I found on our controller it would only read about 140 values of STRING[63] with valid values before it would return bad quality. I assume this is a Siemens OPC limitation. To read larger blocks append multiple tag paths reading from the same CNC array are added to the OPC read tagPath list allowing reads of thousands of values per read. Reading each value in from the array without using the range syntax took approximately 45 seconds for 6000 values. Reading the same count takes about 3 seconds after combining into blocks of 100 values each.