Jump to content

Simple expression question


Tom

Recommended Posts

I have simple expression, that returns floating value in Font sop in Text parameter. All I want to do, is to get value, that is only with two decimal numbers, behing point, not eight.

For example, i get 3.12345, but want to get only 3.12.

Searched for this in help, but I didnt find.

Thanks in advance,

Tom.

Link to comment
Share on other sites

I have simple expression, that returns floating value in Font sop in Text parameter. All I want to do, is to get value, that is only with two decimal numbers, behing point, not eight.

For example, i get 3.12345, but want to get only 3.12.

Searched for this in help, but I didnt find.

Thanks in advance,

Tom.

you might want to try python.

Change your expression language to python > Set Keyframe on first frame and use round function in Text parameter.

round(3.16159265,2)

3.16

Cheers!!

Edited by vectorblur
Link to comment
Share on other sites

you might want to try python.

Change your expression language to python > Set Keyframe on first frame and use round function in Text parameter.

round(3.16159265,2)

3.16

Cheers!!

Ah my bad. just realized you are not really looking for this.

it may be over killing but string slicing will do the job.

a = 3.99999

b = str(a)

return b[0:4]

3.99

Edited by vectorblur
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...