Stefan Bender Posted March 10, 2021 Share Posted March 10, 2021 Dear developers, is there an official SDK way to get the strings for the Boolean values "True" and "False"? They might be needed for tables or for displaying them in other contexts. What is the VW rule for these strings? Are they localized, uppercase, lowercase? I think it would be helpful to have some sort of consistent behavior and /or an SDK call to get the strings. I'm asking because I just got a bug report that is related to this (a plug-in of ours is trying to import values from a text file into a VW record field and it turned out that we had not specified how boolean values need to be spelled so the plug-in identifies the strings as "true" or "false"). Thanks, Quote Link to comment
JBenghiat Posted March 10, 2021 Share Posted March 10, 2021 It’s a localized string in Vectorworks.vwr. Try looking in “11000.vwstrings”. Quote Link to comment
Stefan Bender Posted March 10, 2021 Author Share Posted March 10, 2021 Thanks Joshua! However, for import purposes, we will need to accept more strings as the people providing the text files may not be familiar with Vectorworks. Quote Link to comment
JBenghiat Posted March 10, 2021 Share Posted March 10, 2021 I'm fairly sure the SDK doesn't have any built-in conversions for boolean strings. As a check, though, you can convert the string to uppercase and compare against "TRUE" and the localized true converted to upper case. Then return the localized value for true or false accordingly. When you write to the field, use SetParamBool() to ensure the correct format. I believe that regular record fields are localized but PIO fields are not. I could be wrong, though. Quote Link to comment
Sam Jones Posted March 10, 2021 Share Posted March 10, 2021 Andy Dunning shared the following functions. I hope he won't mind my sharing them here. FUNCTION Boo2Str(boo :BOOLEAN) :STRING; {Converts a boolean to a string.} BEGIN IF boo THEN Boo2Str := 'True' ELSE Boo2Str := 'False'; END; {FUNCTION Boo2Str} {==============================================================} FUNCTION TestBooleanStr(boo :STRING) :BOOLEAN; VAR str : STRING; {---------- NVW Function to Replace UprString ----------} FUNCTION UCase(str :STRING) :STRING; BEGIN UprString(str); UCase := str; END; {-------------------------------------------------------} BEGIN GetVWRString(str,'IP Resources/Strings/11000 *','3'); TestBooleanStr := (UCase(boo) = 'TRUE') | (UCase(boo) = UCase(str)); END; {FUNCTION TestBooleanStr} The call to "GetVWRString(str,'IP Resources/Strings/11000 *','3');" is the arcane magic that I did not know about. 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.