Intersect shapes via scripting

Hi,

I’d like to make something like this:

This image is created with Affinity Designer by intersecting layers. One layer with a shape of S and other filled up with small squares.

Is there a way to do this in Glyphs via scripting? How to intersect one shape with a pattern of shapes? Is it possible in Glyphs?

Thanks,
Michał

Ok, I got this with: selectedLayer.pathIntersect_(None)