- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I am working on a tool that changes the SelectionColor introduced in the Revit 2020.1 API temporarily while doing a selection.pickObjects command using Revit 2022.1.4.
Our custom families seems to "remember" the color used for selection after the color is changed back. I am wondering exactly what could cause this behavior.
Code:
public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
{
//Save original color
var currentColor = ColorOptions.GetColorOptions().SelectionColor;
//Set temporary selection color
ColorOptions.GetColorOptions().SelectionColor = new Color(0, 255, 0);
List<Reference> references = new List<Reference>();
try
{
references.AddRange(commandData.Application.ActiveUIDocument.Selection
.PickObjects(
ObjectType.Element,
new AllSelectionFilter(),
"Choose geometry")
.ToList());
}
catch { }
//Set color back
ColorOptions.GetColorOptions().SelectionColor = currentColor;
return Result.Succeeded;
}
Color has been changed to green. Pickobjects in progress. Looks ok.
Color changed in the beginning to green before running pick objects. Looks ok.
Selecting all elements AFTER code has been run. Custom elements at bottom maintains the green color
Multiselection on custom elements at the bottom after running the command displays these in green even though the color was set back to blue.
Single selection looks ok.
Looks ok for single selection.
Selecting all elements and changing to a different view seems to change the color back.
Changing to a different view seems to also change the color of the custom elements to the color set after the command.
During a second pick objects session, the custom objects now remembers the color reset in the previous step and ignores the green temporary color.
However when switching back to the original view and running the command for a second time, the custom objects now ignores the color change and remembers the color shift from when I changed to the 3D view.
What could be the issue here?
Solved! Go to Solution.
Developer Advocacy and Support +