I’ve been trying to script the boolean operations as if to automate the clicking the transformations buttons. I’m interested mostly in returning the paths of intersections and subtractions.
but I get the error: NameError: global name 'GSPathOperator' is not defined
I also noticed this example is used in many scripts on github and I get the same error when running such scripts (pasting into macro panel and running)
Is this method of scripting deprecated?
Is there an alternative?
It’s also troubling that the only ‘documentation’ for this method is in the forum, why can’t I find any mention of scripting the boolean operations in docu.glyphsapp.com?
That line is included in the wrapper of the cutting edge version. And, if you do from Foundation import * the python bridge will load all classes. But that takes a while so should be avoided.
Just FYI I ran into some trouble with the intersection method, perhaps it’s a known problem.
I found that if the edges of the two paths you want to intersect line up, it returns no paths.
Eg:
Take two squares one smaller than the other, align them to their bottom left corners.
The intersection should be equal to the small square, but it returns nothing.
I know all these literal edge cases are hard to account for, just a heads up if you don’t know it’s behaving in this unexpected way.
Hi,
Has something changed in the API since this ?
I’m trying to replicate Rainer’s example using his exact code (btw I’m on 2.6.2 1264 and still had to add GSPathOperator = objc.lookUpClass(“GSPathOperator”) to avoid a NameError) but every time I run the script it raises a ValueError:
Traceback (most recent call last):
File “”, line 10, in
File “GlyphsApp/GlyphsApp/init.py”, line 2429, in append
ValueError
It does the same if I try to use removeOverlapPaths_error_ or subtractPaths_from_error_