Can't figure out cutBetweenPoints()

Hello! I am trying to figure out how to use this function, but each time I get ‘NoneType’ object has no attribute ‘selectedLayers’ error. I basically need a tool to quickly cut a glyph vertically without using the knife tool. Don’t mind the actual coordinates of the points, I plan to change them manually when needed.

That’s the code I am using:

layer = font.selectedLayers[0]
layer.cutBetweenPoints(NSPoint(0, 100), NSPoint(layer.width, 100))

I am pretty sure I am doing something wrong, but I can’t seem to wrap my head around it! Any pointers and suggestions would be welcome! Thanks!

That means that font is None. You will need to set the variable first, e.g., like this: font = Glyphs.font

1 Like

Thank you! Worked like a charm, I really appreciate your help!

1 Like