The Paint tool functionality is available through the Revit API. Faces of elements such as walls, floors, and roofs can be painted with a material to change their appearance. It does not change the structure of the element.
The methods related to painting elements are part of the Document class. Document.Paint() applies a material to a specified face of an element. Document.RemovePaint() will remove the applied material. Additionally, the IsPainted() and GetPaintedMaterial() methods return information about the face of an element.
|
Code Region: Paint faces of a wall |
// Paint any unpainted faces of a given wall
public void PaintWallFaces(Wall wall, ElementId matId)
{
Document doc = wall.Document;
GeometryElement geometryElement = wall.get_Geometry(new Options());
foreach (GeometryObject geometryObject in geometryElement)
{
if (geometryObject is Solid)
{
Solid solid = geometryObject as Solid;
foreach (Face face in solid.Faces)
{
if (doc.IsPainted(wall.Id, face) == false)
{
doc.Paint(wall.Id, face, matId);
}
}
}
}
}
|