alx
November 18, 2024, 1:24pm
1
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.
mekkablue
(Rainer Erich Scheichelbauer)
November 18, 2024, 1:56pm
2
The error is not from the script. But from a plugin.
alx
November 18, 2024, 2:07pm
3
The traceback appears only when I run the script, here’s a video:
Hmm, when I start Glyphs without plugins, there is no traceback, but I still get an extra unwanted guideline.
SCarewe
(Sebastian Carewe)
November 18, 2024, 2:47pm
4
This error looks like one from @Mark ’s Show Distance and Angle plugin. I get the all the time. Bit annoying.
1 Like
alx
November 18, 2024, 2:55pm
5
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 I could live with the error, the extra guideline is annoying.
mekkablue
(Rainer Erich Scheichelbauer)
November 18, 2024, 4:05pm
7
Pretty unlikely it has anything to do with that script. Very likely it has something to do with the point selection.
alx
November 18, 2024, 4:18pm
8
What do you mean, that more points are selected? I made a fresh rectangle, the horizontal gets two guides, the vertical one.
mekkablue
(Rainer Erich Scheichelbauer)
November 18, 2024, 4:44pm
9
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.