RVTDocs.com
Namespace: Autodesk.Revit.DB Class: GeometryObject

GeometryObject.GraphicsStyleId

Property
Description:
The ElementId of the GeometryObject's GraphicsStyle
Remarks:
This property provides the id of the GraphicsStyle assigned to the GeometryObject. This can be used to find the category of the object.
Syntax
public ElementId GraphicsStyleId { get; }
Examples
// find the name of the GraphicsSytleCategory for every geometric primitive in a family instance
        Options options = app.Create.NewGeometryOptions();
        GeometryElement geomElem = element.get_Geometry(options);
        foreach (GeometryObject geomObj in geomElem)
        {
            GeometryInstance geomInst = geomObj as GeometryInstance;
            if (geomInst != null)
            {
                foreach (Object obj in geomInst.SymbolGeometry)
                {
                    GeometryObject geomObject = obj as GeometryObject;
                    GraphicsStyle gStyle = doc.GetElement(geomObject.GraphicsStyleId) as GraphicsStyle;
                    if (gStyle != null)
                    {
                        string gstyleName = gStyle.GraphicsStyleCategory.Name;
                    }
                }
            }
        }