public void RebarToSolid() { UIDocument uidoc = this.ActiveUIDocument; Document doc = uidoc.Document; ICollection rebers = new FilteredElementCollector(doc, doc.ActiveView.Id).OfCategory(BuiltInCategory.OST_Rebar).ToElements(); List List_Rebar = new List(); if(rebers==null) { TaskDialog.Show("REBAR", "NO REBAR EXISTS IN THE DRAWINGS"); } Transaction trans = new Transaction(doc); trans.Start("ACTRAN"); IEnumerable VFT = from Element in new FilteredElementCollector(doc).OfClass(typeof(ViewFamilyType)) let type = Element as ViewFamilyType where type.ViewFamily == ViewFamily.ThreeDimensional select type; View3D v3d = doc.ActiveView as View3D; foreach(Rebar r in rebers) { r.SetSolidInView(v3d, true); List_Rebar.Add(r); } trans.Commit(); }