0

I used the splitface tool in revit and created a spliface object on a wall.

I'm trying to use C# so that if I click on the splitface then it's material will change. I looked at some examples

Element splitelem = document.GetElement(wall.SplitElementId);
Autodesk.Revit.DB.Options opt = new Options();
Autodesk.Revit.DB.GeometryElement geomElem = wall.get_Geometry(opt);
int faceval = 0;
ElementId m = new ElementId(11534);

foreach (GeometryObject geomObj in geomElem)
{
    // change the material using doc.paint();
}

but this isn't working.

stefankmitph
  • 3,236
  • 2
  • 18
  • 22
revitenthusiast
  • 15
  • 1
  • 1
  • 7

2 Answers2

0

You could try iterating over the geometry objects, determining all the faces, and painting the faces you are after using the Document.Paint method taking the arguments (ElementId element, Face, ElementId material).

Taryn
  • 242,637
  • 56
  • 362
  • 405
Jeremy Tammik
  • 7,333
  • 2
  • 12
  • 17
0
        Autodesk.Revit.DB.Options opt = new Options();
        Autodesk.Revit.DB.GeometryElement geomElem = wall.get_Geometry(opt);
        ElementId m = new ElementId(11534);
        foreach (GeometryObject geomObj in geomElem)
        {
            if (geomObj is Face)
            {
                Face f = geomObj as Face;
                doc.Paint(wall.Id, f, m);
            }

        }