Jump to content

Record Format Booleans and Localization


tbexon

Recommended Posts

So I have an event enabled PIO with a couple of Boolean parameters.

 

Up until now I've been using the below to get the parameter's current state by converting the string to bool, as GetRField returns strings, which I thought was fine.

show_weight_bool = strtobool(vs.GetRField(objectHand, objectName, "Show Weight"))

HOWEVER An unexpected bug has come up, from someone who tried this plug in on a non english version of Vectorworks (it was German in this particular instance).

 

The error thrown from the strtobool function, was:

ValueError: invalid truth value 'wahr'

From what I can gather, the GetRField seems to be returning the localized value for the checkbox (in this instance 'wahr' which I'm given to understand from a quick google means True), rather than, as I was hoping just a pythonic True, but in string form.

 

Firstly is this working as intended? I presume so as it would make sense that if you were extracting the string you would want said string to be in the localized language rather than always in english... SO does anyone have any clever ways around this? I've been hunting through the Function Reference but nothing obvious has jumped out at me, I was hoping it might be as simple as there was a vs.GetRBool or something similar that returns a BOOLEAN value, but so far I can't find it (I'm certainly not saying it's not there, just that I have not been able to locate it!) 

 

I'm hoping there's a super obvious answer that I'm just missing here!

   

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