Mekkablue’s Guides through all selected nodes

When I run this script, if the nodes are at the same y position, two guidelines are created and I get this traceback:

Traceback (most recent call last):
  File "plugin.py", line 196, in drawNodeDistanceText
    unitVector = UnitVectorFromTo(NSPoint(x1, y1), NSPoint(x2, y2))
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "_transform.py", line 686, in __call__
    return self.__wrapped__(*args, **kwds)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "plugin.py", line 32, in UnitVectorFromTo
    A.x /= Length
ZeroDivisionError: float division by zero

Verticals or diagonals work as expected.

The error is not from the script. But from a plugin.

:man_shrugging: The traceback appears only when I run the script, here’s a video:
Screen Recording 2024-11-18 at 14.59.56-2

Hmm, when I start Glyphs without plugins, there is no traceback, but I still get an extra unwanted guideline.

This error looks like one from @Mark’s Show Distance and Angle plugin. I get the all the time. Bit annoying.

1 Like

I think that explains the traceback, without active Distance and Angle there is none when I run the script. But it’s only there if I run the script :thinking: I could live with the error, the extra guideline is annoying.

Reported here: Problems with zero handles · Issue #9 · Mark2Mark/Show-Distance-And-Angle-Of-Nodes · GitHub

1 Like

Pretty unlikely it has anything to do with that script. Very likely it has something to do with the point selection.

What do you mean, that more points are selected? I made a fresh rectangle, the horizontal gets two guides, the vertical one.

The script changes the selection. It selects the guides after creating them. The selection change triggers the error. I don’t think I can do anything in the script except removing the selecting part, which was the script’s raison d’être.