How to get the style name?

Hello,

Is it possible to get an object’s style name from the VA api ?

I have seen a GetStyleName(GUID) in the API but how can i get the GUID to pass here ?
I found the GetWallStyleId(string name) but what is the name in this call ? Is it the style name ? (in this cas i’m wrong :slightly_smiling_face: )

Thanks,

Georges

Hi @gehairing,

You first need to get the style id from the object, using the method GetProductStyle. Then, you can get the style name using the returned id:

class Sample
{
    public static string GetObjectStyleName(RhinoObject rhinoObject)
    {
        Guid objectId = rhinoObject.Id;
        if (objectId != Guid.Empty)
        {
            if (va.IsProduct(objectId))
            {
                Guid styleId = GetProductStyle(rhinoObject.Id);
                if (styleId != Guid.Empty)
                    return GetStyleName(styleId);
            }
        }

        return "";
    }
};

Regards,

Enric

1 Like

Thanks a lot Enric.
I’ll try this out next week.

Georges