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

Update radar_check.py #2419

Open
wants to merge 1 commit into
base: Preflight-Checks_Hackathon_2024
Choose a base branch
from

Conversation

jmcouffin
Copy link
Contributor

reviewed tayO radar check

@jmcouffin jmcouffin added the Enhancement Enhancement request [class->Improved #{number}: {title}] label Oct 17, 2024
@jmcouffin
Copy link
Contributor Author

@tay0thman I reviewed more seriously your code, did quite a few edit for clarity and pep8 compliance
renamed lots of variables and methods.

  • you need to review one last thing: pbt and psp aren't showing in display units
  • +nice to have, make X Y Z andangle when necessary in separate columns ;p

ref: #2418

@tay0thman
Copy link

Good insights, I just learned that PEP8 is a thing, one more item to learn about.

I'll make some updates on my side and will generate a pull request early next week.

Thank you @jmcouffin for your time reviewing and providing feedback.

Copy link
Member

@dosymep dosymep left a comment

Choose a reason for hiding this comment

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

@tay0thman, you need to check

  • code formatting, lots of missing and extra spaces,
  • non-pep8 variable naming,
  • the length of the lines should not be more around 79 symbols
  • shadows names

# Create a 3D view
t = Transaction(doc, "Create 3D View")
Copy link
Member

Choose a reason for hiding this comment

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

I recommend using with statement for any transaction, if is possible better use revit.Transaction class

violatingRVT = []
badelements = []
def get_tempbbox(self, toggle_CAD, toggle_RVT, toggle_IFC, toggle_all):
violating_CAD = []
Copy link
Member

Choose a reason for hiding this comment

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

Variable in function should be lowercase

class Get3DViewBoundingBox():
def get_tempbbox(self, ToggleCAD, ToggleRVT, ToggleIFC, ToggleAll):
Copy link
Member

Choose a reason for hiding this comment

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

Argument name should be lowercase

view3dtype = [v for v in view3Dtypes if v.ViewFamily == DB.ViewFamily.ThreeDimensional][0]
view = DB.View3D.CreateIsometric(doc, view3dtype.Id)
worksets = FilteredWorksetCollector(doc).OfKind(WorksetKind.UserWorkset).ToWorksets()
view_3D_types = DB.FilteredElementCollector(doc).OfClass(DB.ViewFamilyType).WhereElementIsElementType().ToElements()
Copy link
Member

Choose a reason for hiding this comment

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

PEP 8: E501 line too long (124 > 120 characters)

value=distance,
maxAccuracy=False,
forEditing=False)
ui_units = DB.UnitFormatUtils.Format(units=doc.GetUnits(), unitType=DB.UnitType.UT_Length, value=distance, maxAccuracy=False, forEditing=False)
Copy link
Member

Choose a reason for hiding this comment

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

It is advisable to make the code formatting similar in the same places

@@ -266,20 +241,19 @@ def check_model_extents(doc, output):
print(output.linkify(y.Id)+ str(y.Name)+ " - Is part of design option - "+ str(y.DesignOption.Name) )
Copy link
Member

Choose a reason for hiding this comment

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

missing spaces, formatting is messed up

for element in elements:
if element.get_BoundingBox(view) is not None and hasattr(element, 'Name') and hasattr(element, 'Category'):
bbox = element.get_BoundingBox(view)
if check_bounding_box(bbox, INTERNAL_ORIGIN, 52800) == 0:
Copy link
Member

Choose a reason for hiding this comment

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

magic number, needs create constant or comment with unit of measurement

#__________________________________________check the distnaces of base and survey points
divider = "_"*100
test_score = 0
# __________________________________________check the distnaces of base and survey points
Copy link
Member

Choose a reason for hiding this comment

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

misspelling distnaces


output.print_md('### :OK_hand_medium_skin_tone: ............Survey Point is less than 10 miles (16KM) away from the Internal Origin.')
baseptdistance = calculate_distance(basept, INTERNAL_ORIGIN)
tabledata = [['InternaL Origin Coordinates', str(INTERNAL_ORIGIN)],
Copy link
Member

Choose a reason for hiding this comment

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

misspelling InternaL

output.print_md('### :thumbs_down_medium_skin_tone: ............Distant objects are still being detected!')
output.print_md('### :warning: ............Further Analysis Required.')
else:
output.print_md('### :OK_hand_medium_skin_tone: ............All Objects are located less than 10 miles (16KM) away from the Internal Origin.***')
output.print_md('### :OK_hand_medium_skin_tone: ............All Objects are located less than 10 miles (16KM) away from the Internal Origin.')
sys.exit()
Copy link
Member

Choose a reason for hiding this comment

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

I think better to use script.exit() docs

@tay0thman
Copy link

Thank you @dosymep for your thorough review and feedback, good to know how important these items are and will change the code to reflect these recommendations very shortly.

Thanks again

Copy link

@tay0thman tay0thman left a comment

Choose a reason for hiding this comment

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

These Edits makes sense, I am approving them and testing on my scenarios using multiple models. I'll carry all necessary edits to meet with the additional comments.

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}]
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants