Skip to content

add support for content and content_alt in bundle file#2862

Merged
jmcouffin merged 4 commits intopyrevitlabs:developfrom
Wurschdhaud:fix-#1809
Oct 14, 2025
Merged

add support for content and content_alt in bundle file#2862
jmcouffin merged 4 commits intopyrevitlabs:developfrom
Wurschdhaud:fix-#1809

Conversation

@Wurschdhaud
Copy link
Copy Markdown
Contributor

Description

Add "content" and "content_alt" as flags for the bundle file.
Fallback to content in family name is preserved, so it shouldn't break any scripts.

Usage examples:

title: "AT-AT"
content: "C:\\Users\\XXX\\Desktop\\AT-AT_.rfa"
content_alt: "C:\\Users\\XXX\\Desktop\\AT-AT_alt.rfa"

or, if simply in the same folder:

title: "AT-AT"
content: "AT-AT_.rfa"
content_alt: "AT-AT_alt.rfa"

Note:

  • documentation needs to be updated
  • the auto version check by naming convention is now gone for bundle file declarations

Checklist

Before submitting your pull request, ensure the following requirements are met:

  • Code follows the PEP 8 style guide.
  • Code has been formatted with Black using the command:
    pipenv run black {source_file_or_directory}
  • Changes are tested and verified to work as expected.

Related Issues

If applicable, link the issues resolved by this pull request:


Additional Notes

Great help by deepwiki. What a powerful tool. Don't know if the code is "pretty" enough though, pls verify.


Thank you for contributing to pyRevit! 🎉

@Wurschdhaud
Copy link
Copy Markdown
Contributor Author

And after hitting send i noticed there might be an api for checking version info...

https://www.revitapidocs.com/2022/475edc09-cee7-6ff1-a0fa-4e427a56262a.htm

Copy link
Copy Markdown
Contributor

@devloai devloai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Summary:

This PR adds support for content and content_alt flags in bundle YAML files for ContentButton components. This allows users to specify Revit family (.rfa) file paths directly in the bundle metadata, supporting both absolute and relative paths. The implementation preserves backward compatibility by falling back to the naming convention (_content.rfa, content_{version}.rfa) when metadata is not provided.

Review Summary:

The implementation correctly adds the new feature with proper fallback logic. However, there are two medium-severity issues related to error handling and validation that should be addressed to improve debuggability and robustness. The code follows Black formatting and PEP8 conventions as required.

Follow-up suggestions:

  • @devloai fix the identified issues
  • @devloai add validation for the content file paths

Wurschdhaud and others added 2 commits October 14, 2025 07:37
Support for absolute and relative paths

- Introduced new .rfa files for bundle tests.
- Updated bundle.yaml to include additional test cases for content bundles.
- Added new content bundles with specified paths and icons for better organization and testing.
jmcouffin
jmcouffin previously approved these changes Oct 14, 2025
@jmcouffin jmcouffin merged commit eed6336 into pyrevitlabs:develop Oct 14, 2025
@jmcouffin jmcouffin added Enhancement Enhancement request [class->Improved #{number}: {title}] Tools Issues related to pyRevit commands [subsystem] labels Oct 14, 2025
@jmcouffin jmcouffin self-assigned this Oct 14, 2025
@Wurschdhaud Wurschdhaud deleted the fix-#1809 branch October 14, 2025 10:03
@jmcouffin
Copy link
Copy Markdown
Contributor

This is a cool one. Thanks @Wurschdhaud
@davidvadkerti pretty sure you will like it as well. I saw your video not long ago about making a content library.

  • added bundle tests
  • handles relative and absolute paths

Doc updated
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Enhancement Enhancement request [class->Improved #{number}: {title}] Tools Issues related to pyRevit commands [subsystem]

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Content bundle _content requirement removal

2 participants