How to get the currently selected “Extra Node” (intersection) and apply a corner component to it on every master?

Hi everyone,

I’m scripting in Glyphs 3 (GlyphsApp Python) and I’m stuck on working with Extra Nodes (the virtual intersection nodes shown via View → Show Nodes → Extra Nodes).

Goal

  • User clicks/selects an Extra Node (intersection) in Edit view.
  • My script should apply a corner component (e.g. _corner.inktrap) to that exact intersection.
  • Ideally it should apply to every master (similar to what the UI “corner component” action does on the curent layer only).

What I’m unsure about

  1. How to retrieve the selected Extra Node reliably
  • layer.selection gives me objects, but I’m not sure what the selected extra node is supposed to be in the API (sometimes it seems like GSNode, sometimes GSHandle).
  • I can get a position, but I don’t know the “official” way to identify the selected intersection.
  1. How to attach a corner hint to an intersection (not prev/next real node)
  • I understand corner components are stored as GSHint with type = CORNER and name = “_corner.*”.
  • For extra nodes, it seems the hint must be attached to a handle returned by layer.intersections() (a GSHandle), not a regular path node.
  • If I attach the hint to a nearby real node, the corner “jumps” to the previous/next node instead of the intersection.
  1. How to apply the same “selected intersection” on every master
  • If I match the selected intersection by position and then search in each master layer’s layer.intersections(), is that the correct approach?
  • Are intersection indices stable across masters, or should this always be position-based with a tolerance?

Minimal sketch of what I’m trying

from GlyphsApp import Glyphs, GSHint, CORNER

layer = Glyphs.font.selectedLayers[0]
sel = list(layer.selection)
inters = list(layer.intersections())  # list of intersection handles

# find the intersection handle that corresponds to the selected extra node...
# (currently I only have position-based matching)

hint = GSHint()
hint.type = CORNER
hint.name = "_corner.inktrap"
hint.originNode = inters[idx]  # GSHandle from intersections()
layer.hints.append(hint)

# then repeat for glyph.layers[master.id] for all masters...

Questions

  • What’s the recommended way to detect which intersection the user selected (extra node)?
  • Is matching selection position → layer.intersections() the intended solution? Any recommended tolerance / pitfalls?
  • Does anyone have an example snippet (or can point to an existing script) that applies a _corner.* to selected extra nodes, ideally across all masters?

Thanks a lot for any pointers!

from GlyphsApp import GSHandle
node = Layer.selection[0]

if isinstance(node, GSHandle):
	hint = GSHint()
	hint.type = CORNER
	hint.name = "_corner.inktrap"
	hint.originIndex = node.object() # an Index Path
	hint.stem = node.flag()

	Layer.hints.append(hint)
1 Like

Thanks, Georg — I’ll give that a try and let you know how it goes.

Thank you again.
The tricky part is that the master must be perfectly compatible — but it works.

The feature is now added to the MCP server as a command:

add_croner_corner_to_all_masters | Add _corner.croner corner hints at selected nodes (and intersection handles) across all masters.

:+1:

That seems to be an awfully specific command to add. Maybe how to get a corner object from a node/handle. “Adding to all master” should be a more general command.

1 Like

Quick update on the Glyphs MCP server command.

I renamed the command from:

add_croner_corner_to_all_masters → add_corner_to_all_masters

Now an LLM can trigger it with a prompt like:

Add the corner _corner.inktrap on the currently selected nodes across all masters.

And the nice part: the LLM can call the command directly to execute the action. If _corner.inktrap doesn’t exist (or the name is misspelled), the tool returns an error that includes the list of available corners—so the LLM can either auto-correct and retry, or ask the user for clarification.

This makes the workflow genuinely interactive.

Next step: add a guard that warns the LLM (and the user) when the selected node path isn’t compatible across all masters.



Thank you I update the Glyphs MCP server.