Hello
I am trying to find a way to go through a list of nodes -> select only oncurve nodes --> index through oncurve nodes (however many there may be) while maintaining the index number from the original list.
I can make a list of the nodes and am able to manually select oncurve nodes by their index number. I’ve tried to automate this by matching the node.type == CURVE, however, this creates a new list with a different index.
CODE
list = []
for thisNode in thisPath.nodes:
list.append(thisNode)
list = []
for thisNode in thisPath.nodes:
print thisNode
list.append(thisNode)
print 'LIST_OF_NODES:', list
print 'INDEX-2:', list[2]
print 'INDEX-5:', list[5]
print 'INDEX-8:', list[8]
print 'INDEX-11:', list[11]
matchesCurve = [thisNode for thisNode in lst if thisNode.type == CURVE]`
print 'LIST_MATCHES_CURVE_TYPE:', matchesCurve
print 'MATCHES_CURVE_TYPE INDEX-0:', matches[0]
print 'MATCHES_CURVE_TYPE INDEX-1:', matches[1]
print 'MATCHES_CURVE_TYPE INDEX-2:', matches[2]
print 'MATCHES_CURVE_TYPE INDEX-3:', matches[3]
PRINTS
LIST_OF_NODES: [<GSNode x=240.0 y=160.0 offcurve>, <GSNode x=280.0 y=201.0 offcurve>, <GSNode x=280.0 y=250.0 curve smooth>, <GSNode x=280.0 y=300.0 offcurve>, <GSNode x=255.0 y=360.0 offcurve>, <GSNode x=190.0 y=391.0 curve>, <GSNode x=134.0 y=355.0 offcurve>, <GSNode x=100.0 y=300.0 offcurve>, <GSNode x=100.0 y=250.0 curve smooth>, <GSNode x=100.0 y=201.0 offcurve>, <GSNode x=140.0 y=160.0 offcurve>, <GSNode x=190.0 y=160.0 curve smooth>]
INDEX-2: <GSNode x=280.0 y=250.0 curve smooth>
INDEX-5: <GSNode x=190.0 y=391.0 curve>
INDEX-8: <GSNode x=100.0 y=250.0 curve smooth>
INDEX-11: <GSNode x=190.0 y=160.0 curve smooth>
LIST_MATCHES_CURVE_TYPE: [<GSNode x=280.0 y=250.0 curve smooth>, <GSNode x=190.0 y=391.0 curve>, <GSNode x=100.0 y=250.0 curve smooth>, <GSNode x=190.0 y=160.0 curve smooth>]
MATCHES_CURVE_TYPE INDEX-0: <GSNode x=280.0 y=250.0 curve smooth>
MATCHES_CURVE_TYPE INDEX-1: <GSNode x=190.0 y=391.0 curve>
MATCHES_CURVE_TYPE INDEX-2: <GSNode x=100.0 y=250.0 curve smooth>
MATCHES_CURVE_TYPE INDEX-3: <GSNode x=190.0 y=160.0 curve smooth>