SetUserText command

In my plug-in I store some informations to the objects with this command:
Rhs.SetUserText IDObject, “DIBA”, StrInfo, False
StrInfo is a string that contains about 2000 characters. I need to store about 35000 characters, so I run this command in a loop like this:
FOR x = 1 TO 16

Sorry. This topic is the continuous of the previous:
The loop that I run is:
FOR x = 1 TO 16
Rhs.SetUserText IDObject, “DIBA” & x, StrInfo(x), False
NEXT x
but I see that Rhino stores about 20000 character in total and the others are lost.
What’s the maximum number of characters that can be stored in this way? Is there another way in order to solve my problem?
Thank in advance.

I’m able to store a lot more characters than that.

https://github.com/dalefugier/SampleCsCommands/blob/master/SampleCsEmbedTextFile.cs

I’m sorry Dale, but in my post I wrote that my problem is that I’m not be able to store about 35000 characters in the objects (in the object attribute), but you send me an example about storing data in the document. Is the same thing? Can you give me an example for storing data in object attribute?
Many thanks.

Its not the same thing. But the process is very similar. Here is an example of how to add user text to an object’s attributes.

https://github.com/dalefugier/SampleCsCommands/blob/master/SampleCsSetUserText.cs

Hi Dale,
thank you for the example you give me. I Tried it but for me there is always the same problem: for each key i can store “only” 2000 characters. I tried also to store more keys, but the maximum number that Rhino accept is 10. So in total I can store 20.000 characters, that’s about the half that I need to store in total. Is this a limit of Rhino or am I wrong?
Thanks.

Dale, sorry if I insist, can you tell me something about my problem ? Thanks.

Rudy, can you provide a sample that demonstrates your problem?

This is my code:

go.EnableGroupSelect(True)
go.SetCommandPrompt(“Select the object”)
go.GetObjects(1, -1)
If (go.CommandResult() <> IRhinoCommand.result.success) Then
Return go.CommandResult()
End If
MaxI = go.ObjectCount - 1
For i = 0 To MaxI
Dim ref As IRhinoObjRef = go.Object(i)
Dim obj As IRhinoObject = ref.Object()
Dim att As IRhinoObjectAttributes = obj.Attributes
For x = 1 To 11
s = Trim(Str(x))
bRet = att.SetUserString(“KEY” & s, Data)
Next x
Next i

Continuation of the previous post.
Data is a string variable that contains 2000 characters. I saw that this is the maximun number of characters that I can store in a key, so I did a loop for storing 11 keys. I tried to store more then 11 Keys, but when I exceed them Rhino lose the first Keys (for example if I store 15 Keys at the end I have the Keys from # 5 to #15, loosing the first four).
Thanks a lot for your help.

Hi Rudy,

See the attached example, which certainly attaches more than 2000 characters of user text to an object’s attributes.

TestRudyCommand.vb (2.6 KB)

– Dale