It seems like if FlexSim <-> Python conversions are "string" centric.
Passing back a dictionary with a Two-Dimensional Array as value is possible by setting the value as a string representation of the array:
def getTable(arrayFromFlexSim):
arr = np.array(arrayFromFlexSim)
seq = dict()
for i in range(0, 3):
seq = np.array2string(arr)
return seq
The Dictionary get converted correctly to FlexSim:
Map: {
0: Array[3]: {Array[5]: {1,1,0,1,1},Array[5]: {1,0,0,1,1},Array[5]: {1,1,1,1,2}},
1: Array[3]: {Array[5]: {1,1,0,1,1},Array[5]: {1,0,0,1,1},Array[5]: {1,1,1,1,2}},
2: Array[3]: {Array[5]: {1,1,0,1,1},Array[5]: {1,0,0,1,1},Array[5]: {1,1,1,1,2}}
}
If the 2-Dim Array is not converted to its string representation, the conversion result on FlexSim side will fail:
Map: {0: NULL, 1: NULL, 2: NULL}
Just in case someone might get trapped here too. 🙂