FACER Community

Help with formula

This one seems like it should be simple enough, but its hurting my head, so hoping someone can help or point me in the right direction. I tried a search, but couldn’t find what I was looking for.

I’m trying to create a circular progress bar that fills as a percentage between two specific (hard coded) times.

So, lets say its between 7am and 10pm. I want a circle to fill from 0% at 7am to 100% at 10pm.

So far I have (clamp(#DH#, 7, 22)/something) but I can’t figure out what the something is.

First I thought it must be 15… the difference between 7 and 22, but then I realized that anything over 15 would then give a value of more than 1, so clearly that’s not right. So then I thought, hmmm, maybe its 22. but that’s not right either since 7am does not return zero. So, clearly its more complicated than that or I’m barking up completely the wrong tree.

Can anyone help me out?

2 Likes

I can’t help sorry, but I’m sure our Math experts will soon chip in.
Just wanted to say I like your thinking on this, and am curious to see how you’re going to use it :thinking:

2 Likes

The use case is for me only, and its to give me a progress bar of where I should be at any time of the day with my step count, assuming I get up at 7am and go to bed at 10pm and assuming an even distribution of steps throughout the day. Of course it doesn’t represent reality, since we absolutely don’t distribute our step count evenly through the day, but its just a rough guide for me personally, to ensure that I’m on track for the day. I’m doing a campus challenge where, in teams we have to do 2,233,333 steps between now and the end of the first week of July. It works out between 6,900 and 10,500 each per day, depending on whether there are 4, 5 or 6 people in the team (we’re not sure yet).

2 Likes

(((clamp(#DH#, 7, 22)-7)*6.6)/100)

Give that a try

3 Likes

Beauty! That works. Thanks for that! How did you come up with it? I mean, if I change those times (7am-10pm), how do I fix the formula accordingly?

3 Likes

end time (22:00) - start time (07:00) is difference of 15 hours. 100/15=6.6666666.

example:
9am - 9pm
diff 100/12=8.33

(((clamp(#DH#, 9, 21)-9)*8.33)/100)

always subtract start time so you start at zero with the formula

5 Likes

Brilliant. Thanks so much for that. All makes sense now. :slight_smile:

3 Likes

No problem. Glad I could help :sunglasses:

2 Likes

Here’s the published face. Inspection open.

5 Likes

Looks nice. I like when gears mesh. Like things that orbit :smile:.
Thanks for the shout-out
$

2 Likes

Great Tutorial @jlcash61. Taking us through the Maths by stages. I change the numbers in formulas to get what I want out of them but do not always completely understand how it works. You went through it with The Mattie Maths philosophy.
Bookmarked this one. Thanks.

2 Likes

If I live a thousand years I would not think of this… Thank you for the explanation.
:wink:

3 Likes

Thanks. Yes, I’m a bit of a stickler when it comes to the gears. In this one it was easy - I just used three gears that are the same size. They’ll always mesh. I have a few faces with gears of different sizes that accurately mesh, but I have to use different software to get there and the vector gears are drawn with too many bezier points. They look fine, but they all go to s#$# when you try to edit them. It makes them very hard to work with. I use Affinity Designer for all my watch work, and while its great software, it’s terrible for creating gears.

3 Likes

I am going to have to learn some of those other graphic software. I use PDN for 99% of everything I do. I use autocad and fusion when I design my 3D printer stuff. I have heard some of you talking about Affinity and Illustrator. I Can mesh up simple gear trains with it, but its tedious.

Just playing around for fun:

4 Likes

I will take that has a huge compliment :sunglasses: ! Thank you very much.
$

2 Likes

I use this to display my shift (from 9AM to 5PM):
(clamp((#DH#-9+#Dm#/60)/(17-9), 0, 1))

3 Likes

Autocad is too much money for me. I’ve used this site for gear design - https://geargenerator.com/, but as I said, although I end up downloading vector graphics which make things easy to work with, there are too many curve points and its messy to try and edit.

4 Likes

btw - Affinity have a half price sale on at the moment, so Affinity Designer is just $37CAD. It has a bit of a learning curve, but I can’t imagine its harder than autocad. :smiley:

3 Likes

Thanks,. I will be having myself a look at that🤔. At that price it’s a no brainer. Yes AutoCAD is very expensive, that’s why I put it on my expense report every year when re upping the subscription.

2 Likes

@richiebee . I took the plunge and bought affinity. Was only about 5 min ago so ain’t even launched it yet

3 Likes