Rhino3dm fails to read DocumentUserTexts

Hi,
I am trying to read a document user text from a standalone .net app, but the API always fails with my test model which contains several usertexts.

  • I tried a loop with File3dm.Strings.DocumentUserTextCount but this always returns 0.

  • I also tried to loop every entry names with no success:

      For Each section As String In CurrentFile3dm.Strings.GetSectionNames
          For Each entry As String In CurrentFile3dm.Strings.GetEntryNames(section)
              MsgBox(CurrentFile3dm.Strings.GetValue(section, entry)
          Next
      Next
    

Any idea?
Thanks

Hi @mafieulemouton,

Let me know if the attached is helpful.

test_rhino3dm_console.zip (2.5 KB)
test_doc_user_strings.3dm (23.4 KB)

– Dale

Thanks @Dale that’s perfect:

        Using CurrentFile3dm = File3dm.Read(FilePath)
            For i = 0 To CurrentFile3dm.Strings.Count - 1
                Dim key = CurrentFile3dm.Strings.GetKey(i)
                Dim value = CurrentFile3dm.Strings.GetValue(key)
                MsgBox($"{i}: Key = {key}, Value = {value}.")
            Next
        End Using

Although this solution works perfectly, you should probably fix or remove the non-working properties/functions (Previous post).

Best regards

Hi @mafieulemouton,

File3dmStringTable.Count and File3dmStringTable.DocumentUserTextCount return two different results.

You’d only use the Section/Entry/Value scheme if you were interacting with legacy RhinoScript.

– Dale

1 Like