LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Draw by hand onto x/y-graph

Solved!
Go to solution

Hey all,

 

I create a control program for a piezo mirror that moves the focus of a laser beam on a sample. I included several possibilities to create figures that the beam will then carf into the material.

 

Now I would like to include additionally the possibility to draw a figure by hand /mouse onto a x/y-graph that can then be read out by the program as an x/y-Array.

Is this easily possible or would this require a lot of effort? Does someone know how to implement this?

 

Thank you in advance.

0 Kudos
Message 1 of 28
(1,508 Views)

Hi Labphew,

 

ou can use mouse move events to track your mouse movement.

Use them to draw your XY graph background image…

Best regards,
GerdW
CLAD expired, using 2009SP1 + LV2011SP1 + LV2017 (+LV2019 sometimes) on Win7+cRIO
Kudos are welcome Smiley Wink

0 Kudos
Message 2 of 28
(1,480 Views)

Hey GerdW,

 

would you mind to give me a minimal working example (only if it is quickly done)? 

 

Thank you for your answer,

Labphew

0 Kudos
Message 3 of 28
(1,472 Views)
Solution
Accepted by topic author Labphew

I would use a free cursor and then use the Cursor Release event.  This way the array won't get huge with every tiny movement.  You just take the position when the user lets go of the cursor.


There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
Message 4 of 28
(1,468 Views)
Solution
Accepted by topic author Labphew

See this small VI for tracking mouse movement…

Best regards,
GerdW
CLAD expired, using 2009SP1 + LV2011SP1 + LV2017 (+LV2019 sometimes) on Win7+cRIO
Kudos are welcome Smiley Wink

Message 5 of 28
(1,463 Views)

Hey again,

 

thank you very much. It helped me to figure out my problem. However "coordinates" are not the coordinates in the xy-graph, but the vertical and horizontal coordinates of the pane. I cannot use these position-coordinates to plot the graph etc.

The better property for my problem is "CursLoc" where I have to drag and drop the Cursor to draw something but at least "CursLoc" then gives the correct coordinates.

 

Nethertheless thank you very much.

 

0 Kudos
Message 6 of 28
(1,446 Views)

Labphew,

 

you just need to subtract a fixed offset: coordinates in graph := mouse position - position of the graph

 

Best regards,
GerdW
CLAD expired, using 2009SP1 + LV2011SP1 + LV2017 (+LV2019 sometimes) on Win7+cRIO
Kudos are welcome Smiley Wink

Message 7 of 28
(1,440 Views)

@crossrulz

 

thank you for your answer. Together with the minimal working example of GerdW I solved my problem.

 

I used curser movement as event but included a "wait" in the event case, so that the number of points can be reduced.

 

I don't know who of you two I should mark as solution...

 

0 Kudos
Message 8 of 28
(1,435 Views)

Labphew wrote:

I don't know who of you two I should mark as solution...


You can mark both as solutions.


There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
0 Kudos
Message 9 of 28
(1,430 Views)

Shame that Draw Graph with Events.vi is no longer in the Example Finder.  It does exactly what the OP wants.  I've used (stolen?) it to jumpstart many mouse-drawing programs.  Found many mentions of it on-line but no code.  Smiley Sad

LabVIEW 8.5.1 - 2018 Pro Dev
0 Kudos
Message 10 of 28
(1,414 Views)