GeometryObjectGraphicsStyleId Property |
The ElementId of the GeometryObject's GraphicsStyle
Namespace: Autodesk.Revit.DBAssembly: RevitAPI (in RevitAPI.dll) Version: 27.0.4.0 (27.0.4.0)
Syntaxpublic ElementId GraphicsStyleId { get; }Public ReadOnly Property GraphicsStyleId As ElementId
Get
public:
property ElementId^ GraphicsStyleId {
ElementId^ get ();
}member GraphicsStyleId : ElementId with get
Property Value
ElementId
RemarksThis property provides the id of the GraphicsStyle assigned to the GeometryObject.
This can be used to find the category of the object.
Example
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;
}
}
}
}
See Also