There is the path method
copy() but I wonder if there is something quick and easy to copy only the selection (e.g. selected segments).
I tried to build something with saving the data from a source path, then initializing a new
GSPath and adding points to it via
insertNode_atIndex_() but this doesn’t give reliable results all the time.
What I simply want to achieve is the same behaviour as when you manually select a segment, hit cmd+c and cmd+v. … this pasted segment is what I want.
Does the method
After a quick sketch: this looks really good. I think that’s exactly what I need. Thanks so much
I found a bug with this method. To replicate, please do the following steps:
- Draw a rect with the rect tool. The starting point should be the Top-Left Corner, direction CCW.
- Select exactly these corners as seen in the image.
- Run this bit of code:
for path in Glyphs.font.selectedLayers.selectedObjects()["paths"]:
Any other selections will print some path(s) properly, while this particular selection returns an Error:
Traceback (most recent call last):
File "<string>", line 36, in <module>
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC/objc/_convenience.py", line 162, in __getitem__objectForKey_
return container_unwrap(res, KeyError, key)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC/objc/_convenience.py", line 659, in container_unwrap
PS: The make-code-button of this forum’s editor seems to be broken