Stephen Sorenson Posted April 14, 2017 Share Posted April 14, 2017 So I'm working on a custom dialog script to select various plugin objects I've created by type. I'm using vs.GetRField to get data from my 'Diameter' field, but since it's passing as a string interpretation (6'0" shows up as 6e000') it's not in a usable format to match to my incoming data from the vs.GetEditReal function (which shows up as 72.000000). I'm wondering if there's a function I'm not seeing or finding that will get that info in the units format like I need. I couldn't seem to get vs.GetObjectVariableReal to work for me either but perhaps I'm using it wrong. I figured the index value would be the number (or n-1) in the plug-in definition parameters. Quote Link to comment
JBenghiat Posted April 14, 2017 Share Posted April 14, 2017 ValidNumStr will convert the text to a number for comparison, and is fairly robust. There is also Str2Num, but it's less effective in some cases. Num2StrF will convert a number to a distance formatted string, but in this case I would recommend comparing numbers. I also recommend using Eq() to compare numbers within a tolerance. -Josh 1 Quote Link to comment
Hippocode Posted April 14, 2017 Share Posted April 14, 2017 There is no global way of doing this, certainly with third party plug-ins. The functions mentioned by Josh are the best option for default units. VS based plug-ins will have limited implementations for anything not being a default unit. With the SDK there are more options, including translating units while being shown in worksheets but not everything will be exposed, certainly not from third party developers. There are interfaces available for energy and irrigation units. 1 Quote Link to comment
Stephen Sorenson Posted April 14, 2017 Author Share Posted April 14, 2017 Thanks Josh! ValidNumStr appears to work for my application (in early tests). And thanks for the recommendation on Eq() as 1' seems to want to come back as 11.999... Steve 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.