Hi, I’m just starting to use Rhino.Inside.Revit for some structural modeling work. I’m curious to understand the differences between Intersection filter and Logical And filter. It seems to me that these two filters do the same thing, which to to combine multiple filters into one.
The difference is in collection (Element Filter vs Parameter Filters), but the output is the same…
CompoundElementFilter.Intersect(filters));
public class ElementLogicalAndFilter : ElementLogicalFilter
{
public override Guid ComponentGuid => new Guid("0E534AFB-7264-4AFF-99F3-7F7EA7DB9F3D");
public override GH_Exposure Exposure => GH_Exposure.primary;
protected override string IconTag => "∧";
public ElementLogicalAndFilter()
: base("Logical And Filter", "AndFltr", "Filter used to combine multiple filters into one that pass when all pass", "Revit", "Filter")
{ }
protected override void TrySolveInstance(IGH_DataAccess DA)
{
var filters = new List<ARDB.ElementFilter>(Params.Input.Count);
for (int i = 0; i < Params.Input.Count; ++i)
{
ARDB.ElementFilter filter = default;
if (DA.GetData(i, ref filter) && filter is object)
filters.Add(filter);
}
DA.SetData("Filter", CompoundElementFilter.Intersect(filters));
}
}
public class ElementIntersectionFilter : ElementFilterComponent
{
public override Guid ComponentGuid => new Guid("754C40D7-5AE8-4027-921C-0210BBDFAB37");
public override GH_Exposure Exposure => GH_Exposure.primary | GH_Exposure.obscure;
protected override string IconTag => "⋂";
public ElementIntersectionFilter()
: base("Intersection Filter", "Intersection", "Filter used to combine a set of filters into one that pass when all pass", "Revit", "Filter")
{ }
protected override void RegisterInputParams(GH_InputParamManager manager)
{
manager.AddParameter(new Parameters.ElementFilter(), "Filters", "F", "Filters to combine", GH_ParamAccess.list);
}
protected override void TrySolveInstance(IGH_DataAccess DA)
{
var filters = new List<ARDB.ElementFilter>();
if (!DA.GetDataList("Filters", filters))
return;
DA.SetData("Filter", CompoundElementFilter.Intersect(filters));
}
}