From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
03-09-2017 04:45 AM
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.
Solved! Go to Solution.
03-09-2017 05:50 AM
03-09-2017 06:33 AM
Hey GerdW,
would you mind to give me a minimal working example (only if it is quickly done)?
Thank you for your answer,
Labphew
03-09-2017 06:44 AM - edited 03-09-2017 06:45 AM
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.
03-09-2017 06:48 AM - edited 03-09-2017 06:48 AM
03-09-2017 08:09 AM
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.
03-09-2017 08:17 AM
03-09-2017 08:28 AM - edited 03-09-2017 08:30 AM
@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...
03-09-2017 08:45 AM
Labphew wrote:
I don't know who of you two I should mark as solution...
You can mark both as solutions.
03-09-2017 10:38 AM
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.