Isolate elements sequentially (bug? or pushing too far?)

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I wanted to do something that seemed simple:
1. allow the user to select some elements
2. show those elements sequentially in isolation allowing the user to pick something on each before showing the next
I thought this would be a cool way to guide the user to picking something on the actual element of interest... (so much for good intentions)
Note, that this works great with one element only. As soon are there are mulitple, it's not so great (after isolating the second element, it hides the first and shows all other elements in the view)
Am I asking too much to do successive hide/isoates within one command, is this a wish, or possibly a bug?
Sample Code:
Note: I've also tried:
1. putting a transaction group around this and committing each transaction for each isolate and disable.
2. calling regenerate just before committing the transactions
3. calling activeView.Refresh after setting isolate
4. banging rythmically on the top of the computer (/jk)
using System; using System.Collections.Generic; using System.Linq; //Autodesk using Autodesk.Revit.UI; using Autodesk.Revit.Attributes; using Autodesk.Revit.DB; using Autodesk.Revit.UI.Selection; namespace ViewIsolationIssue { [Transaction(TransactionMode.Automatic)] [Regeneration(RegenerationOption.Manual)] public class IsolateThingsSequentially : IExternalCommand { public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements) { Autodesk.Revit.UI.UIDocument UIDoc = commandData.Application.ActiveUIDocument; Autodesk.Revit.DB.Document revitDoc = UIDoc.Document; Autodesk.Revit.DB.View activeView = UIDoc.ActiveView; //Get selected instances IEnumerable<FamilyInstance> selectedInstances = new FilteredElementCollector(revitDoc, UIDoc.Selection.GetElementIds()) .OfClass(typeof(FamilyInstance)) .ToElements() .Cast<FamilyInstance>(); //For each selected assembly, sequentially isolate it for the user to pick a face foreach (FamilyInstance famInst in selectedInstances) { //Isolate instance if (activeView.CanUseTemporaryVisibilityModes()) activeView.IsolateElementTemporary(famInst.Id); //The first one works perfectly the rest... not so much... //Allow the user to pick Face Reference pickedFaceRef = UIDoc.Selection.PickObject(ObjectType.Face, "Select Face."); //Reset the temporary hide/isolate mode if (activeView.CanUseTemporaryVisibilityModes()) activeView.DisableTemporaryViewMode(TemporaryViewMode.TemporaryHideIsolate); } return Result.Succeeded; } } }
Thoughts?
Happy Friday,
-Ken