Grasshopper

algorithmic modeling for Rhino

hello,

i have a range of number from 1 to 8760. they represents 24 hours x 365 days = 8760. How can i set the time for every hour? for example when it is 1, this means the time is 01:00, when it is 2 then the time is 02:00...when it is 23 the the time is 23:00, but then when it is 49 then it is 01:00 of the next day...any idea?

thx in advance!

Nassif

Views: 817

Replies to This Discussion

You can do Math -> Operators -> Modulus of the number by 24 (screenshot).

oh thx...ok that is a good start, but it is a mistake from my side that i didn't explain more...

well, i have a definition, when it is every one hour that the range is from 1 to 8760 ( which is 24 hours x 365 days ), and with modulus in the screenshot above, i could manage to do for every hour. but sometimes in my definition, i have a range from 1 to 35040, which is 365 x 24 x 4 ( 4 here defines every 15 minutes), on other word, when the number is one, then i have 01:00 O'Clock, when the number is 2 then i have 01:15 O'clock, when the number is 3 then i have 01:30 O'Clock...etc , so when the number is 97, which is the next day ( and after the number 96 which is equal 24 hours x 4), then I should have again 01:00 O'Clock.

I hope my idea is clear, thanks in advance!

Nassif

Something like this?

           

int hours = 25;
DateTime DT = DateTime.MinValue;
DT = DT.AddHours(hours);
Console.WriteLine(DT.Hour);


you will always get the right hour... where is a time component you could use for this purpose

mmm, sorry michael, i have no idea what the above lines mean ... :( can you be kind and send me a screenshot so i can follow you

thanks

hey, somehow it worked, thx. is there a way to convert the number to time, in other word, if 22.5 that means 22:30, if 22.75 that means 22:45...etc

thanks for your support!

I just found out that there is a time related Grasshopper component that can do this easily - Construct Smooth Time (screenshot)

Hallo again!

You might want to check out all the components in Math -> Time. I think they may be of use to you. Screenshot below for range 1 to 8760.

thx a lot guys!! i managed :)

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service