Open kengey opened 5 years ago
hmm... wasn't aware the API returned different format....
Are you trying to convert the C API GUID to the format Ruby API returns?
I was, but I decided to use the name of the definition to make comparisons.
Ref persistent IDs not yet implemented for definitions ... (always returns 0.)
Issue: https://github.com/SketchUp/api-issue-tracker/issues/187 - UPDATE: Implemented at release 2020.1
Logged as: SKOR-13727
@thomthom what would be the expected behavior here? If developers are storing the GUIDs somewhere a change in how they are formatted could be a breaking change. Do we add a new C API function that matches that of Ruby and deprecate the old one?
Yea, at this point we'd have to add a new function. Too bad we didn't catch this.
What about a macro to do the conversion instead ?
String representations of guids are not the same in ruby as in c. In ruby they are hex guids, in c they appear to be base64 encoded. They also do not seem to be the same bytewise
For example
0AYSk22fqbIQMGaS9XUgk$
is the c guid forMarc
while0a89cb82-0a9d-2549-a590-91c2617aabbf
is the guid reported by ruby for the same component definitionMarc
. It looks like the c variant uses an IFC-specific base64 encoding ($ is not a valid base64 character (https://www.lifewire.com/base64-encoding-overview-1166412), but it is for ifc-specific base64 (https://technical.buildingsmart.org/resources/ifcimplementationguidance/ifc-guid/)EDIT: they might be the same bytewise however, I did not notice IFCBASE64 0 is 0 while normal base64 0 is A..
EDIT2: when I map the characters reported by c using the following map:
I get
AKicuCCp0lSaWQkcJhequ/
instead of0AYSk22fqbIQMGaS9XUgk$
. Still not valid base64, but getting close.