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: 

API Access to Family Geometric Constraints

API Access to Family Geometric Constraints

Current Situation: When working in the Revit Family Editor, geometric constraints (alignments, locks, etc.) between family elements are managed internally by Revit's constraint solver. These constraints are only visible to users when:

  1. Attempting to modify constrained geometry (which may fail with constraint errors)
  2. Breaking constraints, which generates a warning dialog listing all affected constraints and elements

Problem: There is currently no way to programmatically query these constraint relationships through the Revit API. The constraint information shown in warning dialogs (see attached screenshot) is not accessible via FilteredElementCollector, GetDependentElements(), or any other API method.

Use Case: Family authors need to audit and document constraint relationships in complex families without manually breaking each constraint. Current workflow requires:

  • Selecting each element
  • Breaking its constraints
  • Noting the warning message
  • Undoing the operation
  • Repeating for every element

This is time-consuming and error-prone for families with dozens or hundreds of constrained elements.

Requested API Enhancement: Expose family geometric constraints through the API, similar to how the warning dialog displays them. Suggested implementation:

 
python
# Proposed API usage
element = doc.GetElement(elementId)
constraints = element.GetGeometricConstraints()

for constraint in constraints:
    constraint.ConstraintType  # e.g., "Alignment", "Lock", "Equality"
    constraint.ConstrainedElements  # List of ElementIds involved
    constraint.References  # Reference planes or faces involved

Expected Benefits:

  • Enable automated constraint auditing tools
  • Facilitate family documentation
  • Help identify over-constrained geometry before errors occur
  • Improve family quality control workflows

Reference: This information is already computed and displayed by Revit (as shown in constraint violation warnings), but is not currently exposed through the API.

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

Submit Idea