Grasshopper

algorithmic modeling for Rhino

REQUEST: String format syntax in String Param Expression

Just a minor wish, but it would be nice if you could include expressions in String Param objects, for instance to apply Format() to the input. 

Views: 592

Replies to This Discussion

Normally expressions are applied after the data is collected (and converted to whatever the local type is). If you want to use Format() you might want that to be applied before the number becomes a string no?

Then, it's also possible to perform some sort of string operation (say, convert to upper case), in which case you want the breps to be converted to strings before the expression is executed. 

How to solve this conflict?

--

David Rutten

david@mcneel.com

Poprad, Slovakia

the problem is always more complex than I imagined. Would it be terribly difficult to evaluate the expression on the native data type first, within a try-catch block, where the catch then .ToString()s the data before trying the evaluation a second time? is that super inefficient?

It's not inefficient so much, but it is ambiguous. What if the expression works before and after?

A possible solution is to not allow an expression as such, but just a formatting rule and always apply it before the data is converted to string.

--

David Rutten

david@mcneel.com

Poprad, Slovakia

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

Videos

  • Add Videos
  • View All

© 2025   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service