Input a calculated number to text

Hi, i made a dynamo code to sum concrete quantities of a quantities chart, is there a way i can export the sum i made to a text?

Many options. File Write Text comes to mind. You could also export to CSV.

i see, but is there a way to create a text ballon on revit, not to export to .txt file or CSV. , or maybe adding the value on another quantitie chart

Do you mean like a task dialog box?

Not at the PC, but one of the TextNote constructors likely, perhaps TextNote.ByStringOriginScale.

You could also update an existing text note, set a parameter value, or otherwise append data into your project.

The real question is what do you want to do? First do it in Revit and then attempt to do it with Dynamo. As a general guideline what you can’t do with Revit you can’t do with the API and therefore you can’t do with Dynamo.

When I read the title of this thread I imagined something like this:


:laughing:

Do you mean String.FromObject node?

Then use a parameter and to set it to with SetParameterValue

If IN[0] == 0:
    OUT='Zero'
If IN[0] == 22:
    OUT='Twenty-Two'
If IN[0] == 100:
    OUT='One-hundred'
else
   return None

:stuck_out_tongue_winking_eye:

1 Like

:rofl: :rofl: :rofl: :rofl: :rofl:

What’s even funnier is that never even occurred to me! :joy:

def number_to_words(n):
    if n < 0:
        return "Number out of range"
    elif n <= 19:
        words = ["Zero", "One", "Two", "Three", "Four", "Five",
                 "Six", "Seven", "Eight", "Nine", "Ten",
                 "Eleven", "Twelve", "Thirteen", "Fourteen", "Fifteen",
                 "Sixteen", "Seventeen", "Eighteen", "Nineteen"]
        return words[n]
    elif n < 100:  # Adjusted to be less than 100
        tens = ["Twenty", "Thirty", "Forty", "Fifty", "Sixty", "Seventy", "Eighty", "Ninety"]
        if n % 10 == 0:
            return tens[(n // 10) - 2]  # -2 to adjust index for 20 starting at 0
        else:
            return tens[(n // 10) - 2] + "-" + number_to_words(n % 10)
    elif n == 100:
        return "One-hundred"
    else:
        return str(n)
        
OUT = (number_to_words(IN[0]))  


And yes… it only goes to 100 (because I wrote it for amusement for a specific thing I was counting - I can’t actually remember what).

2 Likes