-
-
Notifications
You must be signed in to change notification settings - Fork 411
feat: load_family() returning elements #2969
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Conversation
|
Unable to trigger custom agent "Code Reviewer"You have run out of credits 😔 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR introduces a new function load_family2() to provide an alternative family loading method that returns a list of loaded family symbols instead of a boolean result.
Key changes:
- Added
load_family2()function that loads a family file and returns all family symbols from the loaded family - Returns an empty list on error or if the family is already loaded, rather than a boolean
|
|
||
| res = doc.LoadFamily(family_file, FamilyLoaderOptionsHandler(), ret_ref) | ||
|
|
||
| if ( res != True ): |
Copilot
AI
Dec 15, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comparing boolean values using != True is redundant. Use if not res: instead for more idiomatic Python code.
| if ( res != True ): | |
| if not res: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should be fixed @vitspec99
| res = doc.LoadFamily(family_file, FamilyLoaderOptionsHandler(), ret_ref) | ||
|
|
||
| if ( res != True ): | ||
| mlogger.debug("Cann't load Family from file=%s. It's may be OK if Family already loaded.", family_file) |
Copilot
AI
Dec 15, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Corrected spelling of 'Cann't' to 'Cannot' and 'It's may be' to 'It may be'.
| mlogger.debug("Cann't load Family from file=%s. It's may be OK if Family already loaded.", family_file) | |
| mlogger.debug("Cannot load Family from file=%s. It may be OK if Family already loaded.", family_file) |
|
Thinking out loud here: |
|
It was my thought too. But I decide to start new function firstly and if function idea usefull and code is OK original load_family() interface/code may be changed. |
|
Can you make a pass on copilot's comments please @vitspec99 |
|
Please implement directly this change to hte original function load_family and do not add a new function
so if you fix the above and its usage in the ensure module, this should be good enough for me to review and test |
PR for issue-2954
Description
New function load_family2() introduced.
It loads Family and returns list[DB.FamilySymbol] of loaded Family or empty list of error occured.
Checklist
Before submitting your pull request, ensure the following requirements are met:
pipenv run black {source_file_or_directory}Related Issues
Thank you for contributing to pyRevit! 🎉