Jump to content
menghuihantang

How to rotate a control/indicator object

Recommended Posts

Trying to make a clock interface.

In the image, the Pendulum and clock needles are controls. I try to make the Pendulum move as a real clock, but how to rotate the control. I can move its position from right to left, but doesn't seem like a clock anymore.

So can I rotate the angle of a control? A control doesn't have a property about its own angle.

post-9524-124941303756_thumb.jpg

  • Like 1

Share this post


Link to post
Share on other sites

Hi,

I tried to do something similar. I did not find a way to use a user control part to rotate a full image. (Not saying it’s impossible, but looks that way). Way I would make the clock would be rotating pngs. Check out this thread

Share this post


Link to post
Share on other sites

Hi,

I tried to do something similar. I did not find a way to use a user control part to rotate a full image. (Not saying it’s impossible, but looks that way). Way I would make the clock would be rotating pngs. Check out this thread

If the clock arms do not need to look exactly like this you could use a gauge. Otherwise it will not really work anyhow in LabVIEW.

The arms would need to be imported as graphics and doing that as vector graphic would be difficult to impossible in all versions of LabVIEW so far, but rotating bitmaps is a very ugly thing to do.

Rolf Kalbermatter

Share this post


Link to post
Share on other sites

Trying to make a clock interface.

In the image, the Pendulum and clock needles are controls. I try to make the Pendulum move as a real clock, but how to rotate the control. I can move its position from right to left, but doesn't seem like a clock anymore.

So can I rotate the angle of a control? A control doesn't have a property about its own angle.

post-9524-124941303756_thumb.jpg

Animated "Gif" image.

Share this post


Link to post
Share on other sites
Animated "Gif" image.
Unfortunately, you can't time an animated gif well enough. The animations have too loose a time slice to be reliable, and anytime the UI thread gets tied up, they can hang. Further you have no ability to reset it in LabVIEW -- whenever you launched the VI, that would be the time displayed.

Share this post


Link to post
Share on other sites

Just a idea, (I have not tested this)

A array of diffrent image(yes I know that will be many :D ). and some code in the back that select the correct image based on the local time.

Share this post


Link to post
Share on other sites

Just a idea, (I have not tested this)

A array of diffrent image(yes I know that will be many :D ). and some code in the back that select the correct image based on the local time.

This isn't easy but you would have to make a picture for each state of the needle (with a transparent background) and then import it into a transparent picture ring. You would need 4 picture rings. Hours, minutes, seconds, and pendulum.

I've create a VI to prove the concept but it's nowhere near complete. If you have a gif of what you want to do you could probably extract the pictures and then import them into the picture ring.

Good luck,

Bruce

Clock.vi

Share this post


Link to post
Share on other sites

(raises hand) Pick me! I know this one.

As luck would have it I already made a clock program when I was first learning about how to use LabVIEW and its draw features. Here's a clock that works with the OS time, or user specified time.

http://brian-hoover....k%20Program.zip

I do have a disclaimer. I made this code several years ago and while it works, there are several coding advancements that I did not know about and did not use. First I would have created a state machine, and an event structure instead of polling every 200ms. In any case hope this works for you, here's a screen shot.

Clock.jpg

EDIT: I'm sorry I didn't read the post closely enough, what I provided is not what you are looking for, but it still may be useful.

  • Like 1

Share this post


Link to post
Share on other sites

Unfortunately, you can't time an animated gif well enough. The animations have too loose a time slice to be reliable, and anytime the UI thread gets tied up, they can hang. Further you have no ability to reset it in LabVIEW -- whenever you launched the VI, that would be the time displayed.

A pendulum swinging is just eye candy. You don't need to synchronise it.KISS.

Edited by ShaunR

Share this post


Link to post
Share on other sites

A pendulum swinging is just eye candy.

Obviously someone who has never been in a room with an authentic cuckoo clock. I had a great aunt who had over a dozen of them. On the hour every hour all hell broke loose. laugh.gif

Share this post


Link to post
Share on other sites

On the hour every hour all hell broke loose. laugh.gif

Sounds like my workplace :P

Edited by ShaunR

Share this post


Link to post
Share on other sites

The way I did it: ( I don't understand Xcontrols )

Image of the clock on the frontpanel without Pendulum

Pendulum in a gif file.

My 1st vi rotates the pendulum.gif 360 times one degree, these 360 images are saved in an image array.

The 2nd vi just uses this image array. Depending on the value (ex43), it shows the 43d element (picture) of the array.

Border of the array is made transparent, background of pendulum.gif also.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.