Jump to content
Developer Wiki and Function Reference Links Read more... ×

# 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

#### Share this post

##### Link to post

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

Raymond

#### Share this post

##### Link to post

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

#### Share this post

##### Link to post

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

#### Share this post

##### Link to post

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

#### Share this post

##### Link to post

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

#### Share this post

##### Link to post
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

#### Share this post

##### Link to post

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

## Create an account or sign in to comment

You need to be a member in order to leave a comment

## Create an account

Sign up for a new account in our community. It's easy!

Register a new account

## Sign in

Already have an account? Sign in here.

Sign In Now

7150 Riverwood Drive, Columbia, Maryland 21046, USA   |   Contact Us:   410-290-5114

© 2018 Vectorworks, Inc. All Rights Reserved. Vectorworks, Inc. is part of the Nemetschek Group.

×

• KBASE