I write a program that forms a divided surface using a reference to the face of the shape. But when applied to walls (the search string with category selection is highlighted below), the program does nothing. How do I apply this program to all walls in a project only?
public class Command : IExternalCommand
{
public Result Execute(
ExternalCommandData commandData,
ref string message,
ElementSet elements)
{
UIApplication app = commandData.Application;
Document doc = app.ActiveUIDocument.Document;
Autodesk.Revit.Creation.Application creApp
= app.Application.Create;
try
{
FilteredElementCollector forms = new FilteredElementCollector(doc);
forms.OfCategory(BuiltInCategory.OST_CurtainGridsWall); // !!problem string!!
using (Transaction tx = new Transaction(doc))
{
tx.Start("Create Devided Surface");
foreach (Form form in forms)
{
FamilyItemFactory factory = doc.FamilyCreate;
Options options = creApp.NewGeometryOptions();
options.ComputeReferences = true;
options.View = doc.ActiveView;
GeometryElement element = form.get_Geometry(options);
foreach (GeometryObject geoObject in element) // 2013
{
Solid solid = geoObject as Solid;
foreach (Face face in solid.Faces)
{
if (face.Reference != null)
{
if (null != face)
{
}
}
}
}
}
tx.Commit();
}
return Result.Succeeded;
}
catch (Exception ex)
{
message = ex.Message;
return Result.Failed;
}
}
}