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[0] 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?
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.
Thank you!
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.
Is there some way I can do the same with the Extrude filter? I found out how to instantiate the effect, but I don’t know the method signature, I tried guessing, but that doesn’t seem to be the correct one.
for myGlyph in Font.selection:
layer = copy.deepcopy(myGlyph.layers[0])
ExtrudeFilter = NSClassFromString("Extrude")
ExtrudeFilter.extrudeLayer_offset_angle_dontSubtract_(layer, 0, 45, False)