Esempio n. 1
0
 public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
 {
     Application app = commandData.Application.Application;
     UIDocument uidoc = commandData.Application.ActiveUIDocument;
     uidoc.Selection.SetElementIds(RebarHelper.TaggedRebarsInView(uidoc));
     return Result.Succeeded;
 }
Esempio n. 2
0
        public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
        {
            //Here is the code:
            Application app = commandData.Application.Application;
            UIDocument uidoc = commandData.Application.ActiveUIDocument;
            Document doc = uidoc.Document;
            ICollection<ElementId> fec2 = new FilteredElementCollector(doc, doc.ActiveView.Id).OfCategory(BuiltInCategory.OST_Rebar).ToElementIds();

            HashSet<ElementId> uniqueTaggedRebars = new HashSet<ElementId>(RebarHelper.TaggedRebarsInView(uidoc));
            HashSet<ElementId> uniqueAllRebars = new HashSet<ElementId>(fec2);
            ICollection<ElementId> untaggedRebars = new List<ElementId>(uniqueAllRebars.Except(uniqueTaggedRebars));
            uidoc.Selection.SetElementIds(untaggedRebars);

            return Result.Succeeded;
        }