diff options
author | Alan Odom <clockmender@icloud.com> | 2020-01-29 20:48:38 +0300 |
---|---|---|
committer | Rune Morling <ermo.blender.org@spammesenseless.net> | 2020-02-01 18:42:29 +0300 |
commit | 877308f917482708ab85b9c29268623c8e0877b6 (patch) | |
tree | e977717428ca23fe58aae392c7578d77a20978e3 /precision_drawing_tools/pdt_design.py | |
parent | 7805692b57fac260e8738e26d935c5e229e9875c (diff) |
PDT: Refactor per Pylint suggestions + readability
- Remove unused imports
- Add comments where appropriate
- Improve readability of variable names
- Re-implement a couple of functions using dictionaries instead of if-statements
- Results of Pylint & Black operations, plus some fixes to code.
Diffstat (limited to 'precision_drawing_tools/pdt_design.py')
-rw-r--r-- | precision_drawing_tools/pdt_design.py | 46 |
1 files changed, 9 insertions, 37 deletions
diff --git a/precision_drawing_tools/pdt_design.py b/precision_drawing_tools/pdt_design.py index 20cb6ac3..b6a12633 100644 --- a/precision_drawing_tools/pdt_design.py +++ b/precision_drawing_tools/pdt_design.py @@ -21,42 +21,14 @@ # Author: Alan Odom (Clockmender), Rune Morling (ermo) Copyright (c) 2019 # ----------------------------------------------------------------------- # -import bmesh -import bpy -import numpy as np from bpy.types import Operator -from mathutils import Vector -from mathutils.geometry import intersect_point_line -from math import sin, cos, tan, pi, sqrt -from .pdt_functions import ( - check_selection, - set_axis, - view_coords, - view_coords_i, - intersection, -) from .pdt_msg_strings import ( - PDT_ERR_EDOB_MODE, - PDT_ERR_INT_LINES, - PDT_ERR_INT_NO_ALL, PDT_ERR_NON_VALID, - PDT_ERR_NO_ACT_OBJ, - PDT_ERR_SEL_2_OBJS, - PDT_ERR_SEL_2_VERTIO, - PDT_ERR_SEL_3_OBJS, - PDT_ERR_SEL_3_VERTIO, - PDT_ERR_SEL_4_OBJS, - PDT_ERR_SEL_4_VERTS, - PDT_ERR_TAPER_ANG, - PDT_ERR_TAPER_SEL, - PDT_ERR_VERT_MODE, - PDT_INF_OBJ_MOVED, PDT_LAB_ABS, PDT_LAB_DEL, PDT_LAB_DIR, PDT_LAB_INTERSECT, PDT_LAB_PERCENT, - PDT_LAB_PLANE, ) @@ -587,21 +559,21 @@ class PDT_OT_Fillet(Operator): val_round = context.preferences.addons[__package__].preferences.pdt_input_round if pg.fillet_intersect: pg.command = ( - f"fi{str(round(pg.fillet_radius, val_round))}" - f",{str(round(pg.fillet_segments, val_round))}" - f",{str(round(pg.fillet_profile, val_round))}" + f"fi{str(round(pg.fillet_radius, val_round))}" + f",{str(round(pg.fillet_segments, val_round))}" + f",{str(round(pg.fillet_profile, val_round))}" ) elif pg.fillet_vertices_only: pg.command = ( - f"fv{str(round(pg.fillet_radius, val_round))}" - f",{str(round(pg.fillet_segments, val_round))}" - f",{str(round(pg.fillet_profile, val_round))}" + f"fv{str(round(pg.fillet_radius, val_round))}" + f",{str(round(pg.fillet_segments, val_round))}" + f",{str(round(pg.fillet_profile, val_round))}" ) else: pg.command = ( - f"fe{str(round(pg.fillet_radius, val_round))}" - f",{str(round(pg.fillet_segments, val_round))}" - f",{str(round(pg.fillet_profile, val_round))}" + f"fe{str(round(pg.fillet_radius, val_round))}" + f",{str(round(pg.fillet_segments, val_round))}" + f",{str(round(pg.fillet_profile, val_round))}" ) return {"FINISHED"} |