Extend parameter lookup helpers (query.py)#3298
Open
Wurschdhaud wants to merge 2 commits intopyrevitlabs:developfrom
Open
Extend parameter lookup helpers (query.py)#3298Wurschdhaud wants to merge 2 commits intopyrevitlabs:developfrom
query.py)#3298Wurschdhaud wants to merge 2 commits intopyrevitlabs:developfrom
Conversation
Contributor
|
Unable to trigger custom agent "Code Reviewer". You have run out of credits 😔 |
query/parameters.py)query.py)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
get_parampreviously only accepted a string name, routing everything throughLookupParameter— which the Revit docs flag as ambiguous and non-portable. This PR broadens the API and consolidates the scatteredsafe_get_parameterhelper into it.What changed
get_paramnow dispatches on identifier type:str(original behaviour),DB.BuiltInParameter,System.Guid, andDB.ElementIdDB.ElementIdresolution prefers GUID lookup, falls back toDefinition, matching whatsafe_get_parameterdidsafe_get_parametercan be removed — all call sites migrate toget_param(elem, param_id)with no other changesBackwards compatibility
Fully backwards compatible.
get_param(element, "some name")behaves identically to before.Why
LookupParameteron strings is kept but not extendedIt remains the right tool when you're confident a name is unique.
get_paramsis the documented safer path when that assumption doesn't hold.Checklist
Before submitting your pull request, ensure the following requirements are met:
pipenv run black {source_file_or_directory}