Skip to content

Conversation

@WemyssJ
Copy link
Contributor

@WemyssJ WemyssJ commented Dec 15, 2025

Print Sheet Improvements

Description

  1. Search Bar - Filters drawings, hiding sheet number / names that don't contain string. DONE

  2. Load Last Print Settings? - Ticking this will load the last print settings you used on that project. QA/TIDY CODE/IMPROVE UI

  3. Naming Format - if Project information parameter: Naming Format matches a built in pyRevit Naming Format, then choose this Naming Format by default when Print Sheet loads. QA/ALLOW NAMING FORMATS FROM pyRevit_config.ini

  4. Naming Format 2 - Allow namingformat_cb to be right clicked and copied to clipboard. DONE

  5. Embed images when exporting to DWG - Sadly don't think this is possible


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

WIP


Thank you for contributing to pyRevit! 🎉

Implement sheet search functionality to filter sheets based on user input.
Added configuration handling for print settings and improved document selection logic.
Copy link
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 several improvements to the Print Sheets tool:

  • Search bar to filter sheets by number/name
  • Load Last Print Settings feature to restore previous print configurations per project
  • Auto-select naming format from Project Information parameter
  • Right-click to copy naming format to clipboard

Review Summary:

Reviewed the PR and identified 2 critical issues, 3 high-severity issues, and 1 low-severity style issue. The most critical problem is that EditNamingFormats.xaml has been completely replaced with the wrong content (appears to be PrintSheets.xaml), which will break the Edit Formats functionality. Additionally, there's a wrong event handler binding in PrintSheets.xaml that breaks the index start feature. The code also contains bare except: clauses that violate repository guidelines requiring explicit exception types, and lacks defensive null checking before accessing ProjectInformation.

Knowledge utilized: Repository code standards (PEP 8, Black formatting, IronPython 2.7.12 requirements), review validation checklist (exception handling patterns, defensive programming), and configuration parser patterns.

Follow-up suggestions:

  • @devloai fix the identified issues - Address the critical XAML file replacement and event handler binding issues
  • @devloai ensure EditNamingFormats.xaml is reverted to its original content - Restore the naming formats editor functionality

Click="rest_index" />
<TextBox x:Name="indexstart_tb" Text="0" Margin="10,0,0,0" VerticalContentAlignment="Center" Padding="5,0,0,0"
PreviewTextInput="validate_index_start" TextChanged="options_changed"/>
PreviewTextInput="validate_index_start" TextChanged="sheet_search_changed"/>
Copy link
Contributor

Choose a reason for hiding this comment

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

Wrong event handler breaks index start functionality

The indexstart_tb TextBox is incorrectly bound to sheet_search_changed instead of options_changed. This means changing the index start value will trigger the search filter instead of updating print options.

Expected behavior: Changing index start should update print indices
Actual behavior: Changing index start triggers sheet search

Suggested change
PreviewTextInput="validate_index_start" TextChanged="sheet_search_changed"/>
PreviewTextInput="validate_index_start" TextChanged="options_changed"/>
actions

Feedback: Rate this comment to help me improve future code reviews:

  • 👍 Good - Helpful and accurate
  • 👎 Poor - Wrong, unclear, or unhelpful
  • Skip if you don't have any strong opinions either way.



def _apply_projectinfo_naming_format_default(self):
pi = self.selected_doc.ProjectInformation
Copy link
Contributor

Choose a reason for hiding this comment

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

Potential NullReferenceException when accessing ProjectInformation

The code attempts to access self.selected_doc.ProjectInformation without checking if selected_doc is None. This could throw an exception during initialization if the document isn't loaded yet.

Add a null check before accessing ProjectInformation:

def _apply_projectinfo_naming_format_default(self):
    if not self.selected_doc:
        return
        
    pi = self.selected_doc.ProjectInformation
    # ... rest of the code
actions

Feedback: Rate this comment to help me improve future code reviews:

  • 👍 Good - Helpful and accurate
  • 👎 Poor - Wrong, unclear, or unhelpful
  • Skip if you don't have any strong opinions either way.

import os.path as op
import codecs
import os, datetime, locale
import os, datetime, locale, ConfigParser
Copy link
Contributor

Choose a reason for hiding this comment

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

Import style: ConfigParser should be on separate line

According to PEP 8 style guide (repository requirement):

"Imports should usually be on separate lines"

Change to:

import os, datetime, locale
import ConfigParser
actions

Feedback: Rate this comment to help me improve future code reviews:

  • 👍 Good - Helpful and accurate
  • 👎 Poor - Wrong, unclear, or unhelpful
  • Skip if you don't have any strong opinions either way.

…l/Print Sheets.pushbutton/script.py

Co-authored-by: devloai[bot] <168258904+devloai[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Print Sheet Enchancements

1 participant