So I found a way to run the HatchOutlineFilter using python, but when I run runFilterWithLayer_error_ it shows the dialog and I’m not sure which function to run to just get the Paths/Shapes. Ideally I would like to run it on a copy of a layer and then extract the shapes for that layer, but here it seems to use the background layer for storing the original shape and layer to show the outline.
I tried looking around using the Python methods dir, signature, the method reporter by mekkablue and the Frameworks-directory in glyphs, but the HatchOutlineFilter is surprisingly opaque. It looks like it’s a builtin Glyphs filter without much info on how it works internally.
Maybe someone else knows a little more on how to use the HatchOutlineFilter using Python?
Have you tried the method reporter script from mekkablue?
The mekkablue script doesn’t seem to go that far beyond the Glyphs API description.
There’s some loose coupling by using NSClassFromString that makes the code pretty opaque, which is why I’m having a bit of trouble triggering the HatchOutlineFilter programatically.
HatchOutlineFilter = NSClassFromString("HatchOutlineFilter")
HatchOutlineFilter.hatchLayer_origin_stepWidth_angle_offset_checkSelection_shadowLayer_(Layer, (10, 10), 20, 20, 5, False, None)
Do you know the method signature as well?
I.e. what the parameters are?
Was this available looking through the header-files in the Frameworks-directory or mekkablue or did you have to look through the source code somehow?
I was about to look into how to solve this by doing the hatchOutline manually. It looks like there’s a method for finding intersections between two shapes, and if I create a large set of hatches spanning the entire glyph I could do that for each line segment, but my programmer brain goes into analysis paralysis when I’m convinced there’s some smarter and more elegant way of doing those things.
The arguments in the sample code match with parts of the method name. Each argument goes where an underscore is. That should give you an idea.
Yes, I had to go through the source code.
What version of Glyphs do you have?
Try the latest beta please. Go to Glyphs > Preferences > Updates, activate both checkboxes and press the Update button.
same issue, checked “show cutting edge versions” and updated.
There, finally worked, thanks.