Get attribute user text in c# Rhinocommon

Dear all,

I’m trying to read the user attribute texts linked to a obect in a Rhino file. I would like to be able to read them and add them to a list. So i can pick the correct keys and values afterwards.
(below a image with the type of information i would like to read)

image

Below is the piece of code that I wrote to select the object in the document. The code does run, but the collection stays empty.

//Select a curve object

        Rhino.DocObjects.ObjRef rhObject0;
        var rc = Rhino.Input.RhinoGet.GetOneObject("Select curve", false, Rhino.DocObjects.ObjectType.Curve, out rhObject0);            
        if (rc != Rhino.Commands.Result.Success)
            return rc;

        
        //validate selection

        var curveObject = rhObject0.Curve();
        if (curveObject == null)
            return Rhino.Commands.Result.Failure;

        // Get attributes user text

        NameValueCollection objectAttributes = new NameValueCollection();
        objectAttributes = curveObject.GetUserStrings();

Can anyone point me in the correct direction? I’m pretty new at coding.

Kind regards Reinder

This project sample should help you.

Dear Travis,

Thank you for the information. I’m going to try this out.

kind regards Reinder