PDT: Update Docstrings per Design Spec Document

This commit is contained in:
Alan Odom 2020-01-30 20:58:48 +00:00 committed by Rune Morling
parent 0e4dd304d6
commit 83ad65d377
12 changed files with 339 additions and 102 deletions

View File

@ -87,8 +87,11 @@ def vector_build(context, pg, obj, operation, values, num_values):
Args:
context: Blender bpy.context instance.
PDT parameter group as pg, object, operation,
command line values, required number of values.
pg: PDT Parameters Group - our variables
obj: The Active Object
operation: The Operation e.g. Create New Vertex
values: The paramters passed e.g. 1,4,3 for Catrtesan Coordinates
num_values: The number of values passed - determines the function
Returns:
Vector to position, or offset items.
@ -123,19 +126,9 @@ def vector_build(context, pg, obj, operation, values, num_values):
def placement_normal(context, operation):
"""Manipulates Geometry, or Objects by Normal Intersection between 3 points.
-- set position of CUrsor (CU)
-- set position of Pivot Point (PP)
-- MoVe geometry/objects (MV)
-- Extrude Vertices (EV)
-- Split Edges (SE)
-- add a New Vertex (NV)
Invalid Options result in "oops" Error.
Local vector variable 'vector_delta' used to reposition features.
Args:
context: Blender bpy.context instance.
operation: The Operation e.g. Create New Vertex
Returns:
Status Set.
@ -186,7 +179,7 @@ def placement_normal(context, operation):
pg.pivot_loc = vector_delta
elif operation == "G":
if obj.mode == "EDIT":
if extend_all :
if extend_all:
for v in [v for v in bm.verts if v.select]:
v.co = vector_delta
bm.select_history.clear()
@ -212,7 +205,7 @@ def placement_normal(context, operation):
elif operation == "V" and obj.mode == "EDIT":
vector_new = vector_delta
vertex_new = bm.verts.new(vector_new)
if extend_all :
if extend_all:
for v in [v for v in bm.verts if v.select]:
bm.edges.new([v, vertex_new])
else:
@ -230,18 +223,9 @@ def placement_normal(context, operation):
def placement_arc_centre(context, operation):
"""Manipulates Geometry, or Objects to an Arc Centre defined by 3 points on an Imaginary Arc.
-- set position of CUrsor (CU)
-- set position of Pivot Point (PP)
-- MoVe geometry/objects (MV)
-- Extrude Vertices (EV)
-- add a New vertex (NV)
Invalid Options result in "oops" Error.
Local vector variable 'vector_delta' used to reposition features.
Args:
context: Blender bpy.context instance.
operation: The Operation e.g. Create New Vertex
Returns:
Status Set.
@ -288,7 +272,7 @@ def placement_arc_centre(context, operation):
bm.select_history.clear()
vertex_new.select_set(True)
elif operation == "G":
if extend_all :
if extend_all:
for v in [v for v in bm.verts if v.select]:
v.co = vector_delta
bm.select_history.clear()
@ -299,7 +283,7 @@ def placement_arc_centre(context, operation):
bmesh.update_edit_mesh(obj.data)
elif operation == "V":
vertex_new = bm.verts.new(vector_delta)
if extend_all :
if extend_all:
for v in [v for v in bm.verts if v.select]:
bm.edges.new([v, vertex_new])
v.select_set(False)
@ -338,19 +322,9 @@ def placement_arc_centre(context, operation):
def placement_intersect(context, operation):
"""Manipulates Geometry, or Objects by Convergance Intersection between 4 points, or 2 Edges.
- Reads pg.plane scene variable and operates in Working Plane to:
-- set position of CUrsor (CU)
-- set position of Pivot Point (PP)
-- MoVe geometry/objects (MV)
-- Extrude Vertices (EV)
-- add a New vertex (NV)
Invalid Options result in "oops" Error.
Local vector variable 'vector_delta' used to reposition features.
Args:
context: Blender bpy.context instance.
operation: The Operation e.g. Create New Vertex
Returns:
Status Set.
@ -426,32 +400,32 @@ def placement_intersect(context, operation):
bm.edges.new([vertex_a, vertex_new])
process = True
else:
if operation == "G" and extend_all :
if operation == "G" and extend_all:
vertex_b.co = vector_delta
elif operation == "V" and extend_all :
elif operation == "V" and extend_all:
vertex_new = bm.verts.new(vector_delta)
bm.edges.new([vertex_b, vertex_new])
else:
return
if (vertex_c.co - vector_delta).length < (vertex_d.co - vector_delta).length:
if operation == "G" and extend_all :
if operation == "G" and extend_all:
vertex_c.co = vector_delta
elif operation == "V" and extend_all :
elif operation == "V" and extend_all:
bm.edges.new([vertex_c, vertex_new])
else:
return
else:
if operation == "G" and extend_all :
if operation == "G" and extend_all:
vertex_d.co = vector_delta
elif operation == "V" and extend_all :
elif operation == "V" and extend_all:
bm.edges.new([vertex_d, vertex_new])
else:
return
bm.select_history.clear()
bmesh.ops.remove_doubles(bm, verts=bm.verts, dist=0.0001)
if not process and not extend_all :
if not process and not extend_all:
pg.error = PDT_ERR_INT_NO_ALL
context.window_manager.popup_menu(oops, title="Error", icon="ERROR")
bmesh.update_edit_mesh(obj.data)

View File

@ -25,47 +25,59 @@
class SelectionError(Exception):
"""Selection Error Exception."""
pass
class InvalidVector(Exception):
"""Invalid Vector Exception."""
pass
class CommandFailure(Exception):
"""Command Failure Exception."""
pass
class ObjectModeError(Exception):
"""Object Mode Error Exception."""
pass
class MathsError(Exception):
"""Mathematical Expression Error Exception."""
pass
class InfRadius(Exception):
"""Infinite Radius Error Exception."""
pass
class NoObjectError(Exception):
"""No Active Object Exception."""
pass
class IntersectionError(Exception):
"""Failure to Find Intersect Exception."""
pass
class InvalidOperation(Exception):
"""Invalid Operation Error Exception."""
pass
class VerticesConnected(Exception):
"""Vertices Already Connected Exception."""
pass
class InvalidAngle(Exception):
"""Angle Given was Outside Parameters Exception."""
pass
class ShaderError(Exception):
"""GL Shader Error Exception."""
pass

View File

@ -117,7 +117,15 @@ class PDT_OT_LineOnBisection(bpy.types.Operator):
@classmethod
def poll(cls, context):
"""Only allow operation on a mesh object in EDIT mode."""
"""Only allow operation on a mesh object in EDIT mode.
Args:
context: Blender bpy.context instance.
Returns:
Boolean.
"""
obj = context.active_object
if obj is None:
return False

View File

@ -33,7 +33,7 @@ def point_on_edge(point, edge):
"""Find Point on Edge.
Args:
point: vector
point: vector
edge: tuple containing 2 vectors.
Returns:
@ -102,7 +102,7 @@ def test_coplanar(edge1, edge2):
def closest_idx(intersect_point, edge):
"""Get Closest Vertex to input point.
If both points in e are equally far from intersect_point, then v1 is returned.
If both points in edge are equally far from intersect_point, then v1 is returned.
Args:
intersect_point: vector
@ -146,12 +146,30 @@ def closest_vector(intersect_point, edge):
def coords_tuple_from_edge_idx(bm, idx):
"""Return Tuple from Vertex."""
"""Return Tuple from Vertices.
Args:
bm: Object Bmesh
idx: Index of chosen Edge
Returns:
Tuple from Edge Vertices.
"""
return tuple(v.co for v in bm.edges[idx].verts)
def vectors_from_indices(bm, raw_vert_indices):
"""Return List of vectors from input indices."""
"""Return List of vectors from input Vertex Indices.
Args:
bm: Object Bmesh
raw_vert_indices: List of Chosen Vertex Indices
Returns:
List of Vertex coordinates.
"""
return [bm.verts[i].co for i in raw_vert_indices]
@ -163,7 +181,7 @@ def vertex_indices_from_edges_tuple(bm, edge_tuple):
edge_tuple: contains 2 edge indices.
Returns:
The vertex indices of edge_tuple.
The vertex indices of edge_tuple as an Integer list.
"""
def find_verts(ind_v, ind_w):
@ -176,11 +194,12 @@ def get_vert_indices_from_bmedges(edges):
"""Return List of Edges for evaluation.
Args:
bmedges: a list of 2 bm edges
edges: a list of 2 bm edges
Returns:
The vertex indices of edge_tuple as a flat list.
"""
temp_edges = []
debug(edges)
for e in edges:
@ -190,7 +209,16 @@ def get_vert_indices_from_bmedges(edges):
def num_edges_point_lies_on(intersect_point, edges):
"""Returns the number of edges that a point lies on."""
"""Returns the number of edges that a point lies on.
Args:
intersection_point: Vector describing 3D coordinates of intersection point
edges: List of Bmesh edges
Returns:
Number of Intersecting Edges (Integer).
"""
res = [point_on_edge(intersect_point, edge) for edge in [edges[:2], edges[2:]]]
return len([i for i in res if i])
@ -199,12 +227,13 @@ def find_intersecting_edges(bm, intersect_point, idx1, idx2):
"""Find Intercecting Edges.
Args:
intersect_point: Vector
intersect_point: Vector describing 3D coordinates of intersection point
idx1, ix2: edge indices
Returns:
The list of edge indices where intersect_point is on those edges.
"""
if not intersect_point:
return []
idxs = [idx1, idx2]
@ -222,5 +251,6 @@ def vert_idxs_from_edge_idx(bm, idx):
Returns:
Vertex Indices of Edge.
"""
edge = bm.edges[idx]
return edge.verts[0].index, edge.verts[1].index

View File

@ -304,7 +304,15 @@ def command_run(self, context):
def pdt_help(self, context):
"""Display PDT Command Line help in a pop-up."""
"""Display PDT Command Line help in a pop-up.
Args:
Self: Itself as a reference for action
context: Blender bpy.context instance
Returns:
Nothing.
"""
label = self.layout.label
label(text="Primary Letters (Available Secondary Letters):")
label(text="")
@ -355,7 +363,10 @@ def command_maths(context, mode, pg, expression, output_target):
Args:
context: Blender bpy.context instance.
mode, pg, expression, output_target
mode: The Operation Mode, e.g. a for Absolute
pg: PDT Parameters Group - our variables
expression: The Maths component of the command input e.g. sqrt(56)
output_target: The output variable box on the UI
Returns:
Nothing.
@ -395,7 +406,12 @@ def command_parse(context):
context: Blender bpy.context instance.
Returns:
pg, values_out, obj, obj_loc, bm, verts.
pg: PDT Parameters Group - our variables
values_out: The Output Values as a list of numbers
obj: The Active Object
obj_loc: The objects location in 3D space
bm: The objects Bmesh
verts: The object's selected vertices, or selected history vertices.
"""
scene = context.scene
pg = scene.pdt_pg
@ -448,7 +464,12 @@ def move_cursor_pivot(context, pg, operation, mode, obj, verts, values):
Args:
context: Blender bpy.context instance.
pg, operation, mode, obj, verts, values
pg: PDT Parameters Group - our variables
operation: The Operation e.g. Create New Vertex
mode: The Operation Mode, e.g. a for Absolute
obj: The Active Object
verts: The object's selected vertices, or selected history vertices
values: The paramters passed e.g. 1,4,3 for Catrtesan Coordinates
Returns:
Nothing.
@ -519,7 +540,13 @@ def move_entities(context, pg, operation, mode, obj, bm, verts, values):
Args:
context: Blender bpy.context instance.
pg, operation, mode, obj, bm, verts, values
pg: PDT Parameters Group - our variables
operation: The Operation e.g. Create New Vertex
mode: The Operation Mode, e.g. a for Absolute
obj: The Active Object
bm: The objects Bmesh
verts: The object's selected vertices, or selected history vertices
values: The paramters passed e.g. 1,4,3 for Catrtesan Coordinates
Returns:
Nothing.
@ -636,7 +663,14 @@ def split_edges(context, pg, operation, mode, obj, obj_loc, bm, values):
Args:
context: Blender bpy.context instance.
pg, operation, mode, obj, obj_loc, bm, verts, values
pg: PDT Parameters Group - our variables
operation: The Operation e.g. Create New Vertex
mode: The Operation Mode, e.g. a for Absolute
obj: The Active Object
obj_loc: The objects location in 3D space
bm: The objects Bmesh
verts: The object's selected vertices, or selected history vertices
values: The paramters passed e.g. 1,4,3 for Catrtesan Coordinates
Returns:
Nothing.
@ -733,7 +767,14 @@ def extrude_vertices(context, pg, operation, mode, obj, obj_loc, bm, verts, valu
Args:
context: Blender bpy.context instance.
pg, operation, mode, obj, onj_loc, bm, verts, values
pg: PDT Parameters Group - our variables
operation: The Operation e.g. Create New Vertex
mode: The Operation Mode, e.g. a for Absolute
obj: The Active Object
obj_loc: The objects location in 3D space
bm: The objects Bmesh
verts: The object's selected vertices, or selected history vertices
values: The paramters passed e.g. 1,4,3 for Catrtesan Coordinates
Returns:
Nothing.
@ -791,7 +832,7 @@ def extrude_vertices(context, pg, operation, mode, obj, obj_loc, bm, verts, valu
raise PDT_InvalidVector
verts = [v for v in bm.verts if v.select].copy()
new_vertex = bm.verts.new(vector_delta)
if extend_all :
if extend_all:
for v in [v for v in bm.verts if v.select]:
bm.edges.new([v, new_vertex])
v.select_set(False)
@ -808,7 +849,12 @@ def extrude_geometry(context, pg, operation, mode, obj, bm, values):
Args:
context: Blender bpy.context instance.
pg, operation, mode, obj, bm, verts, values
pg: PDT Parameters Group - our variables
operation: The Operation e.g. Create New Vertex
mode: The Operation Mode, e.g. a for Absolute
obj: The Active Object
bm: The objects Bmesh
values: The paramters passed e.g. 1,4,3 for Catrtesan Coordinates
Returns:
Nothing.
@ -856,7 +902,12 @@ def duplicate_geometry(context, pg, operation, mode, obj, bm, values):
Args:
context: Blender bpy.context instance.
pg, operation, mode, obj, bm, verts, values
pg: PDT Parameters Group - our variables
operation: The Operation e.g. Create New Vertex
mode: The Operation Mode, e.g. a for Absolute
obj: The Active Object
bm: The objects Bmesh
values: The paramters passed e.g. 1,4,3 for Catrtesan Coordinates
Returns:
Nothing.
@ -904,7 +955,13 @@ def fillet_geometry(context, pg, mode, obj, bm, verts, values):
Args:
context: Blender bpy.context instance.
pg, operation, mode, obj, bm, verts, values
pg: PDT Parameters Group - our variables
operation: The Operation e.g. Create New Vertex
mode: The Operation Mode, e.g. a for Absolute
obj: The Active Object
bm: The objects Bmesh
verts: The object's selected vertices, or selected history vertices
values: The paramters passed e.g. 1,4,3 for Catrtesan Coordinates
Returns:
Nothing.

View File

@ -35,14 +35,30 @@ from .pdt_functions import oops
def failure_message(context):
"""Warn to the user to select 1 edge and 1 face."""
"""Warn to the user to select 1 edge and 1 face.
Args:
context: Blender bpy.context instance.
Returns:
Nothing.
"""
pg = context.scene.pdt_pg
pg.error = f"Select One Face and One Edge"
context.window_manager.popup_menu(oops, title="Error", icon="ERROR")
def failure_message_on_plane(context):
"""Report an informative error message in a popup."""
"""Report an informative error message in a popup.
Args:
context: Blender bpy.context instance.
Returns:
Nothing.
"""
pg = context.scene.pdt_pg
pg.error = f"{PDT_ERR_NOINT}"
context.window_manager.popup_menu(oops, title="Error", icon="ERROR")
@ -51,10 +67,11 @@ def extend_vertex(context):
"""Computes Edge Extension to Face.
Args:
None
context: Blender bpy.context instance.
Returns:
Nothing."""
Nothing.
"""
obj = bpy.context.edit_object
pg = context.scene.pdt_pg
@ -116,7 +133,15 @@ class PDT_OT_EdgeToFace(bpy.types.Operator):
@classmethod
def poll(cls, context):
"""Only allow this to work if a mesh is selected in EDIT mode."""
"""Only allow this to work if a mesh is selected in EDIT mode.
Args:
context: Blender bpy.context instance.
Returns:
Boolean.
"""
obj = context.object
if obj is None:
return False
@ -129,7 +154,8 @@ class PDT_OT_EdgeToFace(bpy.types.Operator):
context: Blender bpy.context instance.
Returns:
Status Set."""
Status Set.
"""
pg = context.scene.pdt_pg
pg.command = f"etf"

View File

@ -48,6 +48,13 @@ def debug(msg, prefix=""):
The printed message will be of the form:
{prefix}{caller file name:line number}| {msg}
Args:
msg: Incomming message to display
prefix: Always Blank
Returns:
Nothing.
"""
pdt_debug = bpy.context.preferences.addons[__package__].preferences.debug
@ -55,7 +62,14 @@ def debug(msg, prefix=""):
import traceback
def extract_filename(fullpath):
"""Return only the filename part of fullpath (excluding its path)."""
"""Return only the filename part of fullpath (excluding its path).
Args:
fullpath: Filename's full path
Returns:
filename.
"""
# Expected to end up being a string containing only the filename
# (i.e. excluding its preceding '/' separated path)
filename = fullpath.split('/')[-1]
@ -83,6 +97,9 @@ def oops(self, context):
Note:
Uses pg.error scene variable
Returns:
Nothing.
"""
scene = context.scene
@ -265,8 +282,8 @@ def view_dir(dis_v, ang_v):
Angles are Converts to Radians from degrees.
Args:
dis_v: Scene distance
ang_v: Scene angle
dis_v: Scene PDT distance
ang_v: Scene PDT angle
Returns:
World Vector.
@ -315,8 +332,8 @@ def arc_centre(vector_a, vector_b, vector_c):
Args:
vector_a: Active vector location
vector_b: Other vector location
vector_d: Last vector location
vector_b: Second vector location
vector_c: Third vector location
Returns:
Vector representing Arc Centre and Float representing Arc Radius.
@ -353,10 +370,11 @@ def intersection(vertex_a, vertex_b, vertex_c, vertex_d, plane):
whether the lines are convergent using standard Numpy Routines
Args:
vertex_a: Active vector location of first line
vertex_b: Other vector location of first line
vertex_d: Last vector location of 2nd line
vertex_c: First vector location of 2nd line
vertex_b: Second vector location of first line
vertex_c: Third vector location of 2nd line
vertex_d: Fourth vector location of 2nd line
plane: Working Plane 4 Vector Locations representing 2 lines and Working Plane
Returns:
Intersection Vector and Boolean for convergent state.
"""
@ -472,20 +490,21 @@ def get_percent(obj, flip_percent, per_v, data, scene):
return Vector((coord_out[0], coord_out[1], coord_out[2]))
def obj_check(obj, scene, operator):
def obj_check(obj, scene, operation):
"""Check Object & Selection Validity.
Args:
obj: Active Object
scene: Active Scene
operator: Operation to check
operation: The Operation e.g. Create New Vertex
Returns:
Object Bmesh and Validity Boolean.
Object Bmesh
Validity Boolean.
"""
pg = scene.pdt_pg
_operator = operator.upper()
_operation = operation.upper()
if obj is None:
pg.error = PDT_ERR_NO_ACT_OBJ
@ -493,7 +512,7 @@ def obj_check(obj, scene, operator):
return None, False
if obj.mode == "EDIT":
bm = bmesh.from_edit_mesh(obj.data)
if _operator == "S":
if _operation == "S":
if len(bm.edges) < 1:
pg.error = f"{PDT_ERR_SEL_1_EDGEM} {len(bm.edges)})"
bpy.context.window_manager.popup_menu(oops, title="Error", icon="ERROR")
@ -501,7 +520,7 @@ def obj_check(obj, scene, operator):
return bm, True
if len(bm.select_history) >= 1:
vector_a = None
if _operator not in {"D", "E", "F", "G", "N", "S"}:
if _operation not in {"D", "E", "F", "G", "N", "S"}:
vector_a = check_selection(1, bm, obj)
else:
verts = [v for v in bm.verts if v.select]

View File

@ -149,7 +149,7 @@ class PDT_OT_Link(Operator):
Linked Objects are placed at Cursor Location
Args:
context
context: Blender bpy.context instance.
Notes:
Uses pg.lib_objects, pg.lib_collections & pg.lib_materials

View File

@ -28,6 +28,18 @@
#
# Menu Labels
#
"""This file contains all the Message Strings.
These strings are called by various programmes in PDT,
they can be set to suit individual User requirements.
Args:
None
Returns:
None
"""
PDT_LAB_ABS = "Absolute" # "Global"
PDT_LAB_DEL = "Delta" # "Relative"
PDT_LAB_DIR = "Direction" # "Polar"

View File

@ -118,7 +118,15 @@ class PDT_OT_ViewPlaneRotate(Operator):
@classmethod
def poll(cls, context):
"""Check Onject Status."""
"""Check Object Status.
Args:
context: Blender bpy.context instance.
Returns:
Nothing.
"""
obj = context.object
if obj is None:
return False
@ -173,7 +181,15 @@ class PDT_OT_ViewPlaneScale(Operator):
@classmethod
def poll(cls, context):
"""Check Onject Status."""
"""Check Object Status.
Args:
context: Blender bpy.context instance.
Returns:
Nothing.
"""
obj = context.object
if obj is None:
return False
@ -285,7 +301,15 @@ class PDT_OT_PivotSelected(Operator):
@classmethod
def poll(cls, context):
"""Check Onject Status."""
"""Check Object Status.
Args:
context: Blender bpy.context instance.
Returns:
Nothing.
"""
obj = context.object
if obj is None:
return False
@ -337,7 +361,15 @@ class PDT_OT_PivotOrigin(Operator):
@classmethod
def poll(cls, context):
"""Check Onject Status."""
"""Check Object Status.
Args:
context: Blender bpy.context instance.
Returns:
Nothing.
"""
obj = context.object
if obj is None:
return False
@ -377,7 +409,15 @@ class PDT_OT_PivotWrite(Operator):
@classmethod
def poll(cls, context):
"""Check Onject Status."""
"""Check Object Status.
Args:
context: Blender bpy.context instance.
Returns:
Nothing.
"""
obj = context.object
if obj is None:
return False
@ -425,7 +465,15 @@ class PDT_OT_PivotRead(Operator):
@classmethod
def poll(cls, context):
"""Check Onject Status."""
"""Check Object Status.
Args:
context: Blender bpy.context instance.
Returns:
Nothing.
"""
obj = context.object
if obj is None:
return False

View File

@ -85,7 +85,8 @@ class PDT_OT_ViewRotL(Operator):
Notes:
Uses pg.vrotangle scene variable
Returns: Status Set.
Returns:
Status Set.
"""
scene = context.scene
@ -229,7 +230,8 @@ class PDT_OT_ViewIso(Operator):
Returns:
Status Set.
"""
# Try working this out in your head!
# Rotate view 45 degrees about Z then 32.2644 about X
context.region_data.view_rotation = Quaternion((0.8205, 0.4247, -0.1759, -0.3399))
context.region_data.view_perspective = "ORTHO"
return {"FINISHED"}

View File

@ -40,6 +40,7 @@ def order_points(edge, point_list):
v1, v2 = edge
def dist(coord):
"""MEasure distance between two coordinates."""
return (v1 - coord).length
point_list = sorted(point_list, key=dist)
@ -47,7 +48,15 @@ def order_points(edge, point_list):
def remove_permutations_that_share_a_vertex(bm, permutations):
"""Get useful Permutations."""
"""Get useful Permutations.
Args:
bm: Object's Bmesh
permutations: Possible Intersection Edges as a list
Returns:
List of Edges.
"""
final_permutations = []
for edges in permutations:
@ -62,7 +71,15 @@ def remove_permutations_that_share_a_vertex(bm, permutations):
def get_valid_permutations(bm, edge_indices):
"""Get useful Permutations."""
"""Get useful Permutations.
Args:
bm: Object's Bmesh
edge_indices: List of indices of Edges to consider
Returns:
List of suitable Edges.
"""
raw_permutations = itertools.permutations(edge_indices, 2)
permutations = [r for r in raw_permutations if r[0] < r[1]]
@ -71,7 +88,15 @@ def get_valid_permutations(bm, edge_indices):
def can_skip(closest_points, vert_vectors):
"""Check if the intersection lies on both edges and return True
when criteria are not met, and thus this point can be skipped."""
when criteria are not met, and thus this point can be skipped.
Args:
closest_points: List of Coordinates of points to consider
vert_vectors: List of Coordinates of vertices to consider
Returns:
Boolean.
"""
if not closest_points:
return True
@ -86,7 +111,15 @@ def can_skip(closest_points, vert_vectors):
def get_intersection_dictionary(bm, edge_indices):
"""Return a dictionary of edge indices and points found on those edges."""
"""Return a dictionary of edge indices and points found on those edges.
Args:
bm, Object's Bmesh
edge_indices: List of Edge Indices
Returns:
Dictionary of Vectors.
"""
bm.verts.ensure_lookup_table()
bm.edges.ensure_lookup_table()
@ -109,7 +142,7 @@ def get_intersection_dictionary(bm, edge_indices):
# reaches this point only when an intersection happens on both edges.
[list_k[edge].append(points[0]) for edge in edges]
# k will contain a dict of edge indices and points found on those edges.
# list_k will contain a dict of edge indices and points found on those edges.
for edge_idx, unordered_points in list_k.items():
tv1, tv2 = bm.edges[edge_idx].verts
v1 = bm.verts[tv1.index].co
@ -121,7 +154,15 @@ def get_intersection_dictionary(bm, edge_indices):
def update_mesh(bm, int_dict):
"""Make new geometry (delete old first)."""
"""Make new geometry (delete old first).
Args:
bm, Object's Bmesh
int_dict: Dictionary of Indices of Vertices
Returns:
Nothing.
"""
orig_e = bm.edges
orig_v = bm.verts
@ -142,7 +183,16 @@ def update_mesh(bm, int_dict):
def unselect_nonintersecting(bm, d_edges, edge_indices):
"""Deselects Non-Intersection Edges"""
"""Deselects Non-Intersection Edges.
Args:
bm, Object's Bmesh
d_edges: List of Intersecting Edges
edge_indices: List of Edge Indices to consider
Returns:
Nothing.
"""
if len(edge_indices) > len(d_edges):
reserved_edges = set(edge_indices) - set(d_edges)
@ -204,7 +254,6 @@ class PDT_OT_IntersectAllEdges(bpy.types.Operator):
"""Check to see object is in correct condidtion.
Args:
Class,
context: Blender bpy.context instance.
Returns: