Hey all, thanks for the input. It helped tremendously. I adapted your macro tool @imagejan and am quite happy with it.

The only thing I would wish for: Is it possible that the perdendicular lines are **drawn in real time** while dragging the “Main Line”?

I can do a bit of scripting but this is out of my capabilities. Here’s the macro tool script so far:

```
macro "Perpendicular Line Tool - C000-B11-L0440-L3399-L8cc8" {
var leftButton = 16;
getCursorLoc(xStart, yStart, zStart, flagStart);
if (flagStart&leftButton==0) {
print("Not the left button. Stopping...");
return;
}
// drag mode
while (true) {
getCursorLoc(x, y, z, flags);
if (flags&leftButton==0) {
// if single point, then return immediately
if(xStart == x && yStart == y) {
return;
}
// go to parallel mode
// starting from line xStart, yStart, x, y
drawPerpendicularLines(xStart, yStart, x, y);
Overlay.clear();
return;
}
makeLine(xStart, yStart, x, y);
wait(10);
}
makeOval(x-radius, y-radius, radius*2, radius*2);
}
function drawPerpendicularLines(x1, y1, x2, y2) {
makeLine(x1, y1, x2, y2);
while (true) {
getCursorLoc(x, y, z, modifiers);
if (modifiers&leftButton!=0) {
return;
}
// get slope of line
dx = (x2-x1);
dy = (y2-y1);
// calculate perp line endpoints
xa = (x1 - dy/4); ya = (y1 + dx/4);
xb = (x1 + dy/4); yb = (y1 - dx/4);
xc = (x2 + dy/4); yc = (y2 - dx/4);
xd = (x2 - dy/4); yd = (y2 + dx/4);
Overlay.drawLine(xa, ya, xb, yb);
Overlay.drawLine(xc, yc, xd, yd);
Overlay.show;
wait(10);
}
}
```

EDIT: Another two bugs I found so far:

- You have to click on the image once before you can start another line, to erase the previous one, which I would like to prevent.
- You can’t adapt the line after drawing it, only by switching to the normal line tool. And if you move the line, it erases the perpendicular overlay lines.

I don’t know enough java or imagej macro to fix this myself