When using Manage → Inquiry → Select by ID in the GUI to select a constraining line, both the line and the constraint lock are displayed. However, if multiple constraint IDs are entered, the lock symbol for each is displayed briefly and then disappears.
I would like to show the lock icon when using the API call SetElementIds(ICollection<ElementId> ids). The call currently selects the desired constraint lines, but they are difficult to see, and the constraint lock is not displayed.
public void ShowAlignments()
{
UIApplication uiapp = new UIApplication(Application);
IList<ElementId> selectedIds = new List<ElementId>();
IList<Reference> selectedRefs = uiapp.ActiveUIDocument.Selection.PickObjects(ObjectType.Element, "Pick an element");
foreach (Reference r in selectedRefs)
{
selectedIds.Add(r.ElementId);
}
HashSet<ElementId> allAlignmentIds = new HashSet<ElementId>();
foreach (ElementId id in selectedIds)
{
var cst = BuiltInCategory.OST_Constraints;
var cef = new ElementCategoryFilter(cst);
allAlignmentIds.UnionWith(doc.GetElement(id).GetDependentElements(cef));
}
uiapp.ActiveUIDocument.Selection.SetElementIds(allAlignmentIds);
}
In this screenshot, the two blue vertical lines on the left and the two red horizontal lines are both selected. This was using SetElementIds() and the Reveal Constraints view. As already noted, it is difficult to tell which lines are selected, and the lock icons do not appear. It is impossible for the user to tell which constraint corresponds to which Id. The user therefore cannot decide which constraints to delete if that is desired.
Showing the constraint lock icons would increase parity between API and GUI. It would also help to clear some confusion and frustration regarding constrained geometry.