Announcements
Welcome to the Revit Ideas Board! Before posting, please read the helpful tips here. Thank you for your Ideas!
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Show lock icon when using API call SetElementIds()

Show lock icon when using API call SetElementIds()

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.

 

2022-05-22 14.33.53 Revit_0DXppg7DXx.png

 

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.

 

2022-05-22 15.34.42 Revit_GU3lhxk4Rt.png

 

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.

1 Comment
steven.williams.as
Enthusiast

This screencast shows how the constraint lock icon is displayed.

 

Screencast: Select by ID shows constraint lock icon 

Can't find what you're looking for? Ask the community or share your knowledge.

Submit Idea  

Forma Design Contest


Autodesk Design & Make Report