I'm trying to get the nodes using:
p = cubicsuperpath.parsePath(node.get('d'))
For a 4 node closed path I am getting 6 sets of coordinates (first handle, node, second handle) returned.
Here is an example of a rectangle:
[[ [[0.0, 0.0], [0.0, 0.0], [0.0, 0.0]], [[100.0, 0.0], [100.0, 0.0], [100.0, 0.0]], [[100.0, 200.0], [100.0, 200.0], [100.0, 200.0]], [[0.0, 200.0], [0.0, 200.0], [0.0, 200.0]], [[0.0, 0.0], [0.0, 0.0], [0.0, 0.0]], [[0.0, 0.0], [0.0, 0.0], [0.0, 0.0]] ]]
Though experimentation, I have discovered these correspond to : [[ Node 1, as the start node ( first handle coords = node coords) Node 2 Node 3 Node 4 Node 1, as the end node (second handle coords = node coords) Node 1, as if it is inline, with the handles correct. ]]
Now, if I take exactly the returned list p, and just try setting the path back:
node.set('d',cubicsuperpath.formatPath(p))
I end up with a 6 node, open path.
If I just try to feed it 4 coordinates, I end up with a 4 node, open path.
How do I get the formatPath to create a closed path?
-Rob A>