# Displaying a variable as a number rather than dimension?

## Recommended Posts

I have a variable that I want to display in the object info palette.

For instance, the value of the variable is 9.

I set up a static text and use a setfield to display the 9 in the OIP. For some reason the 9 is displayed as 9" rather than 9. If I change the variable to 12 it displays 1'-0". How do I get it to display 12 instead of 1'-0"?

Thanks,

Derek

##### Link to comment

Derek, if you convert the number to a string and display that in the OIP you can remove the units with Num2Str().

Raymond

##### Link to comment

Not completely sure, but is that variable a Real? If so, what happens if you make it an Integer or Longint?

##### Link to comment

when you set up the field, did you make it a dimension?

##### Link to comment

Raymond,

Thank you, I was originally using Num2StrF(). Your suggestion to use Num2Str() has solved my problem.

Marteen,

I attempted to convert the real to an integer first and it remained in the dimension form.

Jonathan,

The fields I'm using to do the calculations are Dimensions. The field I'm using to display my calculation is Static Text. Therefor, I needed a way to convert the dimension to a real number.

Derek

Edited by MaxStudio
##### Link to comment

Using Concat() to make a string of a number could have solved it too I think. I use it sometimes because it converts almost anything to a string (even a Handle).

##### Link to comment
Using Concat() to make a string of a number could have solved it too I think.

There is a difference between Concat and Num2Str, basically format control. Num2Str will let you set the number of decimal places you see from 0 to 10. Concat will show all decimal digits (up to 15 if they exist). Both are useful in their own right.

Raymond

##### Link to comment

Indeed, and the good thing about Concat is that it doesn't add any decimal digits if there aren't any.

That's why I suggested that it could have solved it too (9 will be 9 after Concat).

## 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.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

Only 75 emoji are allowed.

×   Your previous content has been restored.   Clear editor

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

×
×

• KBASE
• #### MARIONETTE

×
• Create New...