Grasshopper

algorithmic modeling for Rhino

Hey,

 

how do I get a List with starting 001,002,003...054... and ending 110. A List starting with 1 and ending with 110 is easy (Series-Format("{0}",x)) but to insert the two zeros in front of the numbers with less than an amount of 10 and one zero in front of the numbers with less than an amount of 100 I do not get. :-(

 

Best Regards

 

DeDackel

Views: 4955

Replies to This Discussion

Hi Dedackelzucht,

 

here is a part of a definition I've created some time ago.

(aim was to create a binary system converter)

This should do exactly what you want.

 

Best,

Martin.

 

Attachments:

Thank you!

I like it when not everything is hidden behind one component or function. Nice solution!

 

Best regards

 

DeDackel

Format ("{0:0##}",x) seems to work.

Hey Pieter,

I was sure I tried this one...it works! Many thanks

Best Regards

DeDackel

Can I ask a case in which this conversion would be needed, out of interest.
headings is the usual situation for me. heading east = 090 degrees. I use the right string function of a larger number eg right(1000 + x, 3) where x = 1 gives 001

Hey Michael,

my reason is much simpler than Dannys. I use this function to name construction elements. In this case it shows that there are more then 99 elements but less then 1000, because the number is a digit number.

Best Regards

 

DeDackel

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service