I'm trying to parse this string into a numpy ndarray
'POLYHEDRALSURFACE(((0 1 0,0 0 0,1 0 0,1 1 0,0 1 0)),((1 -0 1,0 0 1,0 1 1,1 1 1,1 -0 1)),((1 0 0,1 -0 1,1 1 1,1 1 0,1 0 0)),((0 0 0,0 0 1,1 -0 1,1 0 0,0 0 0)),((0 1 0,0 1 1,0 0 1,0 0 0,0 1 0)),((0 1 1,0 1 0,1 1 0,1 1 1,0 1 1)))'
I clean it up a little to make it easier to work with
s = geom.replace('POLYHEDRALSURFACE', '')
s = s.replace("(((","|")
s = s.replace(")))","|")
s = s.replace("((","|")
s = s.replace("))","|")
s = s.replace("|,|","|")
Result
'|0 1 0,0 0 0,1 0 0,1 1 0,0 1 0|1 -0 1,0 0 1,0 1 1,1 1 1,1 -0 1|1 0 0,1 -0 1,1 1 1,1 1 0,1 0 0|0 0 0,0 0 1,1 -0 1,1 0 0,0 0 0|0 1 0,0 1 1,0 0 1,0 0 0,0 1 0|0 1 1,0 1 0,1 1 0,1 1 1,0 1 1|'
I would like it to be nested as shown below, also the 4th entry should be removed since it is a duplicate.
[
[
[0 1 0],
[0 0 0],
[1 0 0],
[1 1 0],
[0 1 0],
]
]
...