Skip to content
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

Preflight checks hackathon 2024 #2454

Open
wants to merge 30 commits into
base: develop
Choose a base branch
from

Conversation

jmcouffin
Copy link
Contributor

Hi guys,
@dosymep @sanzoghenzo @eirannejad @GiuseppeDotto @thumDer
@dnenov @davidvadkerti @dariaivanciucova
Would you give care to give me your evaluation of the work done by the few preflight checks hackathon participants?
It should not take you long, I hope to collect your input to provide the results by next monday.

  • cad_audit
  • walltypes_naming_convention
  • and radar_check

set the order and add comments following my template to evaluate:

  1. radar_check
    I like the idea, it is pretty elaborate
  2. cad_audit
    fair entry, coding style is a bit weak
  3. walltypes
    the idea is good, it lack a bit of love, and could be extended to lots of naming_convention checks on the same principes adding a UI/UX to configure the check

jmcouffin and others added 30 commits September 3, 2024 09:56
This Error has been lingering for a while, I decided to give it a shot.
Causes:
1- Document is not workshared, OR
2- The script is trying to get the .Name and .Category of document objects that doesn't own these attribute objects, this is typical for dependent elements such as sketchplanes, graphicOverrides, roomboundaries.

Solution:
Filter out element that doesn't have a name or a category and sort them under a seperate list called "Unassigned"

Give it a try.
This Model Checker swiftly verifies the extents of the Revit model. 
Placing model extents more than 10 miles from the project's 
internal origin can lead to issues with accuracy, tolerance, 
performance, and viewport display. This check ensures that the 
model remains within a 10-mile radius of the internal origin.
Fix Model Checker Attribute Error
Made the changes below per Jean-Marc's feedback.

1- you may want to present digits results in a tabular form for readability and ease in comparison.

Response: Added output.print_table

2- the project base point cannot be placed at more than 10 miles in more recent version of Revit

Response: Good to know! I removed the report for the location of the project basept.

3- you may want to use the convert unit util to display the distances in the same units as in the UI

Response: I used the unitutils to convert the internal distances to the model distances, however in metric I am having hard time to show the suffix (mm, M, km)....etc

4- you may want to limit the amount of objects output in the output windows using linkify as it may greatly slow the tool

Response: Set the limit of linkify to 10 prints per category, if there are more violating objects, then it will show a message "Manual investigation is required"

5- I tend to prefer print_md over print_html as it is more efficient and improves readability

Response: I switched most of them to use print_md. also I used pyrevit emojis instead of html colors.



please take a look and let me know if this makes sense.
Update radar_check.py - Rev1
My proposal for a comprehensive audit of cad instances. See details described in the ModelChecker class comments.
It would replace the old LISTDWGs by F. Beaupere, from the Project panel, link tools.
Bonus: It also extends the basic functionality of RPW by adding radio buttons and a cancel button.
Updated the script for better compliance and fixed issues reported by @jmcouffin and @dosymep
Update radar_check.py - Code Cleanup, expanding tabulated info
This code is based on a true story.

Naming conventions are the foundation of a project. Naming is essential for model checks, filters, and view settings. Until now, I created my checks using Revit export text files with Power-BI. PyRevit enables continuous checking of all categories against their predefined names with just a click.
Added basic rounding for coordinates for better readability,
A template for a loadable .json file.   Just a list of strings.
update extionsion.py added.   file.json template list-template added.
replace static path by select_file(*.json)
add a default path, just for having more confort
Update radar_check.py - Rounding Coordinates
walltypes_naming_convention_check
@jmcouffin jmcouffin added the Extension Checks Issues related to pyRevit extension checks [subsystem] label Nov 4, 2024
@jmcouffin jmcouffin self-assigned this Nov 4, 2024
@sanzoghenzo
Copy link
Contributor

I'm not qualified to judge this since I never used the model checker and I don't use Revit/pyRevit - i just develop code for my colleagues!

I just can give an opinion on the code itself

  1. radar check: it needs a lot of love! in order of importance
    • the doc global variable is used inside the function that have the document argument; while not a problem in this specific case, it results in functions that are not portable;
    • one of the function returns a constant (INTERNAL_ORIGIN) that is then rewritten to itself; this is unneeded cognitive load.
    • there's a class with a single method that never accesses self, so it should be a function!
    • some functions are too long and returns many variables; it is more or less trivial to split them into smaller, simpler functions
    • some functions are called twice or more with the same parameters, the result should be stored in a variable and reused
    • other un-pythonic things here and there, formatting needs some fixes
  2. cad audit: medium complexity, medium code quality 😅
    • collect_cadinstances gets called two times, the second time just to get the length of the list... wasted CPU cycles here
    • the timer is initialized above the function that needs to be timed, but this means that it is started when the file is loaded and not when the function is actually called! I would put it either inside of the function or move the timing inside the startTest method
    • there's a bunch of appends one after another, it is better to just create the list with the elements in it at once
    • (not sure on this one, but couldn't the two static methods of ButtonClass just be functions?)
    • there are a bit of repeated code, that can also use more calls to the pyrevit library
    • other un-pythonic things here and there
  3. walltypes: the simplest and cleanest one, but there are still some design choices I would have avoided:
    • uses a json file just for a list of strings, it might be just a plain text file
    • lists are used where generators or sets would be better choices (less memory usage and faster membership checks)
    • hardcoded path that couls pose a problem for clones not in the default location
    • the found key is not used, it wastes memory
    • the value of the wrong key could be computed with a difference between sets and stored in a variable by its own for easier access

PS: I realize just now that the notion page example has unneeded lines (all the methods that have only a pass statement should be removed) that propagated to all the contestant's code 😅

@thumDer
Copy link
Contributor

thumDer commented Nov 5, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Extension Checks Issues related to pyRevit extension checks [subsystem]
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants