Hi. I’m pretty new to Glyphs and I like it very much.
I’m trying to write a script to delete certain nodes to open a closed path, like we can do manually by Opt+Del or Cmd+X some nodes.
Could this be done by scripts?
Or do we have access to keyboard shortcuts via scripts?
nodes = Layer.selection
for node in nodes:
path = node.parent
Layer.dividePathAtNode_(node)
path.removeNodeCheck_(path.nodes[0])
path.removeNodeCheck_(path.nodes[len(path.nodes)-1])
It works well when I have only one node to delete for each path, but doesn’t work when there are two or more nodes to delete.
Do you have any suggestions?
I attach 3 images. The first one shows the 4 nodes I want to delete. The second one is the desired result and the third one is the result generated by the code above.
Layer.dividePathAtNode_(node) returns the second not on the split. This is the one you like to delete. And when you do the second split, there are two paths and you keep removing the nodes from the first path.