MaxStudio Posted August 6, 2013 Share Posted August 6, 2013 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 Quote Link to comment
MullinRJ Posted August 7, 2013 Share Posted August 7, 2013 Derek, if you convert the number to a string and display that in the OIP you can remove the units with Num2Str(). Raymond Quote Link to comment
maarten. Posted August 7, 2013 Share Posted August 7, 2013 Not completely sure, but is that variable a Real? If so, what happens if you make it an Integer or Longint? Quote Link to comment
Jonathan Pickup Posted August 7, 2013 Share Posted August 7, 2013 when you set up the field, did you make it a dimension? Quote Link to comment
MaxStudio Posted August 7, 2013 Author Share Posted August 7, 2013 (edited) 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 August 7, 2013 by MaxStudio Quote Link to comment
maarten. Posted August 8, 2013 Share Posted August 8, 2013 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). Quote Link to comment
MullinRJ Posted August 8, 2013 Share Posted August 8, 2013 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 Quote Link to comment
maarten. Posted August 9, 2013 Share Posted August 9, 2013 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). Quote Link to comment
Recommended Posts
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.