Message 1 of 2
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello, I am having this error when trying to retrieve the visible linked elements in a newly created view.
Specifically when stepping through the new FilteredElementCollector(Doc,View.Id,LinkedElem.Id) constructor.
Approaches I've tried so far:
-Encapsulating the view creation in a subtransaction and doc.regenerate()
-Getting the linked elements in a manually created view(with success).
-Getting the host elements in this newly created view(with success).
The only case which triggers this error is when using the linked elements overload in the newly created view.
My code is as :
linkedElem = new FilteredElementCollector(Doc)
.OfClass(typeof(RevitLinkInstance)).ToElements()[0] as RevitLinkInstance;
using (SubTransaction st = new(Doc))
{
st.Start();
VistaAtiva = CriarPlantaBaixaDoNivel(level);
Doc.Regenerate();
st.Commit();
}
List<BuiltInCategory> listaCategorias = new List<BuiltInCategory>
{BuiltInCategory.OST_StructuralColumns,BuiltInCategory.OST_StructuralFraming,BuiltInCategory.OST_Floors};
ElementMulticategoryFilter filtroMultiCategory = new ElementMulticategoryFilter(listaCategorias);
IList<Element> linkedElements = new FilteredElementCollector(Doc, VistaAtiva.Id, linkedElem.Id)
.WherePasses(filtroMultiCategory)
.ToElements();
Solved! Go to Solution.