draw line center and save line size

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

draw line center and save line size

anairc
Hello.

I would like to know if there is any macro that can help me on the following task:

I would like to have the measure of a line, each time I draw one, as well as some kind of marker of its center drawn .

Thank you in advanced.

Cheers,
Ana C.
Reply | Threaded
Open this post in threaded view
|

Re: draw line center and save line size

Wayne Rasband
On Jul 16, 2008, at 7:56 AM, anairc wrote:

> Hello.
>
> I would like to know if there is any macro that can help me on the
> following
> task:
>
> I would like to have the measure of a line, each time I draw one, as
> well as
> some kind of marker of its center drawn .

Here is a macro tool that does this.

  macro "Line Length Tool -C00bL1de0L1ee1" {
         getCursorLoc(x, y, z, flags);
         xstart = x; ystart = y;
         x2=x; y2=y;
         while (true) {
             getCursorLoc(x, y, z, flags);
             if (flags&16==0) {
                 dx=x2-xstart; dy=y2-ystart;
                 if (selectionType==5) {
                    run("Measure");
                    run("Label");
                    run("Select None");
                 }
                 exit;
             }
             if (x!=x2 || y!=y2)
                 makeLine(xstart, ystart, x, y);
             x2=x; y2=y;
             wait(10);
         };
     }
  }

-wayne
Reply | Threaded
Open this post in threaded view
|

Re: draw line center and save line size

anairc
Thank you for your reply

Cheers,
Ana


Wayne Rasband wrote
On Jul 16, 2008, at 7:56 AM, anairc wrote:

> Hello.
>
> I would like to know if there is any macro that can help me on the
> following
> task:
>
> I would like to have the measure of a line, each time I draw one, as
> well as
> some kind of marker of its center drawn .

Here is a macro tool that does this.

  macro "Line Length Tool -C00bL1de0L1ee1" {
         getCursorLoc(x, y, z, flags);
         xstart = x; ystart = y;
         x2=x; y2=y;
         while (true) {
             getCursorLoc(x, y, z, flags);
             if (flags&16==0) {
                 dx=x2-xstart; dy=y2-ystart;
                 if (selectionType==5) {
                    run("Measure");
                    run("Label");
                    run("Select None");
                 }
                 exit;
             }
             if (x!=x2 || y!=y2)
                 makeLine(xstart, ystart, x, y);
             x2=x; y2=y;
             wait(10);
         };
     }
  }

-wayne