Jump to content

Getting a unit record field from a custom plugin object


Recommended Posts

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.

Link to comment

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

  • Like 1
Link to comment

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.

 

  • Like 1
Link to comment

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.   Restore formatting

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