ActiveDoc.Write losing usertext on object attributes-RhinoCommon


#1

OK, did this couple times to make sure but if can be verified just to make sure it’s just not one of those that it’s near end of day Friday things. I have simple brep object (in this test case simple surface) and attach user text via RhinoObject.Attributes.SetUserText(string,string) and can check to make sure worked via getusertext in command line…now when I save file via…

FileWriteOptions fwo = new FileWriteOptions();
fwo.IncludeBitmapTable = true;
fwo.SuppressDialogBoxes = true;
fwo.WriteUserData = true;
RhinoDoc.ActiveDoc.WriteFile(savefile, fwo);

and reopen the file the user text is gone. (both checking via RhinoObject.attributes.GetUserText and also simple command line getusertext passing allkeys as option)

If I go back and attach user text to object’s geometry instead (rhinoobject.geometry.setusertext) it stays…

if I do simple file, export in rhino on object the user text stays attached via rhinoobject.attributes.setusertext…


(John Brock) #2

moved to Developer category


(Dale Fugier) #3

Hi Chris,

I’m looking at this…


(Dale Fugier) #4

Hi Chris,

I am not able to repeat what you’ve reported. This is what I tested.

1.) Launched Rhino
2.) Create a Sphere.
3.) Ran the SetUserText command, added Attribute data with Key = Test and String = Chris.
4.) Ran the GetUserText commandto verify the data.
5.) Ran a RhinoCommon command that does this:

protected override Result RunCommand(RhinoDoc doc, RunMode mode)
{
  string savefile = @"C:\Users\Dale\Desktop\TestChris.3dm";
  Rhino.FileIO.FileWriteOptions fwo = new Rhino.FileIO.FileWriteOptions();
  fwo.IncludeBitmapTable = true;
  fwo.SuppressDialogBoxes = true;
  fwo.WriteUserData = true;
  doc.WriteFile(savefile, fwo);
  return Result.Success;
}

6.) Closed and restarted Rhino.
7.) Opened "TestChris."
8.) Ran the GetUserText commandto verify the data.

Let me know what I am missing.

– Dale


#5

ok, i’ll see if I can repeat and if so whip up quick sample.