PDT: Docstring fixes and a small bug fix

All Docstrings have been examined for typos and format, etc.

Small code change to set Selection Mode to "SEL" if operation is not
"C" or "P" to avoid possible errors when using other operations.
This commit is contained in:
Alan Odom 2020-02-04 12:51:17 +00:00 committed by Rune Morling
parent 2a4f0769e5
commit 1a6900ade7
12 changed files with 280 additions and 240 deletions

View File

@ -359,9 +359,9 @@ class PDTSceneProperties(PropertyGroup):
name="Pivot Factor", min=0.4, max=10, default=2, precision=1, description=PDT_DES_PPSIZE
)
pivot_width: IntProperty(name="Width", min=1, max=5, default=2, description=PDT_DES_PPWIDTH)
# FIXME: might as well become pivot_angle
pivot_ang: FloatProperty(name="Pivot Angle", min=-180, max=180, default=0.0)
# FIXME: pivot_dist for consistency?
pivot_dis: FloatProperty(
name="Pivot Dist", default=0.0, min=0, update=scale_set, description=PDT_DES_PIVOTDIS,
)

View File

@ -37,7 +37,7 @@ def point_on_edge(point, edge):
edge: tuple containing 2 vectors.
Returns:
True if point p happens to lie on the edge, False otherwise.
True if point happens to lie on the edge, False otherwise.
"""
intersect_point, _percent = intersect_point_line(point, *edge)
@ -48,7 +48,8 @@ def point_on_edge(point, edge):
def line_from_edge_intersect(edge1, edge2):
"""Get New Line from Intersections.
Prepares input for sending to intersect_line_line
Note:
Prepares input for sending to intersect_line_line
Args:
edge1, edge2: tuples containing 2 vectors.
@ -82,9 +83,10 @@ def get_intersection(edge1, edge2):
def test_coplanar(edge1, edge2):
"""Test 2 Edges are Co-planar.
The line that describes the shortest line between the two edges would be short if the
lines intersect mathematically. If this line is longer than 1.0e-5 then they are either
coplanar or parallel
Note:
The line that describes the shortest line between the two edges would be short if the
lines intersect mathematically. If this line is longer than 1.0e-5 then they are either
coplanar or parallel
Args:
edge1, edge2: tuples containing 2 vectors.
@ -102,7 +104,8 @@ def test_coplanar(edge1, edge2):
def closest_idx(intersect_point, edge):
"""Get Closest Vertex to input point.
If both points in edge are equally far from intersect_point, then v1 is returned.
Note:
If both points in edge are equally far from intersect_point, then v1 is returned.
Args:
intersect_point: vector
@ -126,7 +129,8 @@ def closest_idx(intersect_point, edge):
def closest_vector(intersect_point, edge):
"""Return Closest Vector to input Point.
If both points in e are equally far from intersect_point, then v1 is returned.
Note:
If both points in e are equally far from intersect_point, then v1 is returned.
Args:
intersect_point: vector
@ -177,7 +181,7 @@ def vertex_indices_from_edges_tuple(bm, edge_tuple):
"""Return List of vertices.
Args:
bm: is a bmesh representation
bm: Active object's Bmesh
edge_tuple: contains 2 edge indices.
Returns:
@ -228,7 +232,7 @@ def find_intersecting_edges(bm, intersect_point, idx1, idx2):
Args:
intersect_point: Vector describing 3D coordinates of intersection point
idx1, ix2: edge indices
idx1, idx2: edge indices
Returns:
The list of edge indices where intersect_point is on those edges.
@ -245,8 +249,8 @@ def vert_idxs_from_edge_idx(bm, idx):
"""Find Vertex Indices form Edge Indices.
Args:
Object Bmesh as bm
Selection Index as idx
bm: Object's Bmesh
idx: Selection Index
Returns:
Vertex Indices of Edge.

View File

@ -99,9 +99,6 @@ class PDT_OT_CommandReRun(Operator):
def command_run(self, context):
"""Run Command String as input into Command Line.
Args:
context: Blender bpy.context instance.
Note:
Uses pg.command, pg.error & many other 'pg.' variables to set PDT menu items,
or alter functions
@ -124,7 +121,7 @@ def command_run(self, context):
A = Absolute XYZ, D = Delta XYZ, I = Distance at Angle, P = Percent
X = X Delta, Y = Y, Delta Z, = Z Delta, O = Output (Maths Operation only)
V = Vertex Bevel, E = Edge Bevel
V = Vertex Bevel, E = Edge Bevel, I = Intersect then Bevel
Capitals and lower case letters are both allowed
@ -134,11 +131,14 @@ def command_run(self, context):
Example; CA,,3 - Cursor to Absolute, is re-interpreted as CA0,0,3
Exception for Maths Operation, Values section is evaluated as Maths command
Exception for Maths Operation, Values section is evaluated as Maths expression
Example; madegrees(atan(3/4)) - sets PDT Angle to smallest angle of 3,4,5 Triangle;
(36.8699 degrees)
Args:
context: Blender bpy.context instance.
Returns:
Nothing.
"""
@ -308,7 +308,6 @@ def pdt_help(self, context):
"""Display PDT Command Line help in a pop-up.
Args:
Self: Itself as a reference for action
context: Blender bpy.context instance
Returns:
@ -410,8 +409,8 @@ def command_parse(context):
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
obj_loc: The object's location in 3D space
bm: The object's Bmesh
verts: The object's selected vertices, or selected history vertices.
"""
scene = context.scene
@ -433,10 +432,13 @@ def command_parse(context):
# Apply System Rounding
decimal_places = context.preferences.addons[__package__].preferences.pdt_input_round
values_out = [str(round(float(v), decimal_places)) for v in values]
bm = "None"
bm = "No Bmesh"
obj_loc = Vector((0,0,0))
verts = []
if mode_sel == 'REL' and operation not in {"C", "P"}:
pg.select = 'SEL'
if mode_sel == 'SEL' and mode not in {"a"}:
bm, good = obj_check(obj, scene, operation)
if good and obj.mode == 'EDIT':
@ -466,7 +468,7 @@ def move_cursor_pivot(context, pg, operation, mode, obj, verts, values):
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
values: The parameters passed e.g. 1,4,3 for Cartesian Coordinates
Returns:
Nothing.
@ -543,9 +545,9 @@ def move_entities(context, pg, operation, mode, obj, bm, verts, values):
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
bm: The object's Bmesh
verts: The object's selected vertices, or selected history vertices
values: The paramters passed e.g. 1,4,3 for Catrtesan Coordinates
values: The parameters passed e.g. 1,4,3 for Cartesian Coordinates
Returns:
Nothing.
@ -666,10 +668,10 @@ def split_edges(context, pg, operation, mode, obj, obj_loc, bm, values):
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
obj_loc: The object's location in 3D space
bm: The object's Bmesh
verts: The object's selected vertices, or selected history vertices
values: The paramters passed e.g. 1,4,3 for Catrtesan Coordinates
values: The parameters passed e.g. 1,4,3 for Cartesian Coordinates
Returns:
Nothing.
@ -770,10 +772,10 @@ def extrude_vertices(context, pg, operation, mode, obj, obj_loc, bm, verts, valu
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
obj_loc: The object's location in 3D space
bm: The object's Bmesh
verts: The object's selected vertices, or selected history vertices
values: The paramters passed e.g. 1,4,3 for Catrtesan Coordinates
values: The parameters passed e.g. 1,4,3 for Cartesian Coordinates
Returns:
Nothing.
@ -852,8 +854,8 @@ def extrude_geometry(context, pg, operation, mode, obj, bm, values):
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
bm: The object's Bmesh
values: The parameters passed e.g. 1,4,3 for Cartesian Coordinates
Returns:
Nothing.
@ -905,8 +907,8 @@ def duplicate_geometry(context, pg, operation, mode, obj, bm, values):
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
bm: The object's Bmesh
values: The parameters passed e.g. 1,4,3 for Cartesian Coordinates
Returns:
Nothing.
@ -958,9 +960,9 @@ def fillet_geometry(context, pg, mode, obj, bm, verts, values):
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
bm: The object's Bmesh
verts: The object's selected vertices, or selected history vertices
values: The paramters passed e.g. 1,4,3 for Catrtesan Coordinates
values: The parameters passed e.g. 1,4,3 for Cartesian Coordinates
Returns:
Nothing.
@ -972,7 +974,8 @@ def fillet_geometry(context, pg, mode, obj, bm, verts, values):
return
if mode in {"i", "v"}:
vert_bool = True
elif mode == "e":
else:
# Must be "e"
vert_bool = False
# Note that passing an empty parameter results in that parameter being seen as "0"
# _offset <= 0 is ignored since a bevel/fillet radius must be > 0 to make sense

View File

@ -83,18 +83,18 @@ from .pdt_msg_strings import (
def vector_build(context, pg, obj, operation, values, num_values):
"""Build Movement Vector from input Fields.
"""Build Movement Vector from Input Fields.
Args:
context: Blender bpy.context instance.
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
values: The paramters passed e.g. 1,4,3 for Cartesian Coordinates
num_values: The number of values passed - determines the function
Returns:
Vector to position, or offset items.
Vector to position, or offset, items.
"""
scene = context.scene
@ -495,9 +495,10 @@ def placement_intersect(context, operation):
def join_two_vertices(context):
"""Joins 2 Free Vertices that do not form part of a Face.
Joins two vertices that do not form part of a single face
It is designed to close open Edge Loops, where a face is not required
or to join two disconnected Edges.
Note:
Joins two vertices that do not form part of a single face
It is designed to close open Edge Loops, where a face is not required
or to join two disconnected Edges.
Args:
context: Blender bpy.context instance.
@ -535,9 +536,10 @@ def join_two_vertices(context):
def set_angle_distance_two(context):
"""Measures Angle and Offsets between 2 Points in View Plane.
Uses 2 Selected Vertices to set pg.angle and pg.distance scene variables
also sets delta offset from these 2 points using standard Numpy Routines
Works in Edit and Oject Modes.
Note:
Uses 2 Selected Vertices to set pg.angle and pg.distance scene variables
also sets delta offset from these 2 points using standard Numpy Routines
Works in Edit and Oject Modes.
Args:
context: Blender bpy.context instance.
@ -615,9 +617,10 @@ def set_angle_distance_two(context):
def set_angle_distance_three(context):
"""Measures Angle and Offsets between 3 Points in World Space, Also sets Deltas.
Uses 3 Selected Vertices to set pg.angle and pg.distance scene variables
also sets delta offset from these 3 points using standard Numpy Routines
Works in Edit and Oject Modes.
Note:
Uses 3 Selected Vertices to set pg.angle and pg.distance scene variables
also sets delta offset from these 3 points using standard Numpy Routines
Works in Edit and Oject Modes.
Args:
context: Blender bpy.context instance.
@ -684,9 +687,10 @@ def set_angle_distance_three(context):
def origin_to_cursor(context):
"""Sets Object Origin in Edit Mode to Cursor Location.
Keeps geometry static in World Space whilst moving Object Origin
Requires cursor location
Works in Edit and Object Modes.
Note:
Keeps geometry static in World Space whilst moving Object Origin
Requires cursor location
Works in Edit and Object Modes.
Args:
context: Blender bpy.context instance.
@ -725,10 +729,11 @@ def origin_to_cursor(context):
def taper(context):
"""Taper Geometry along World Axes.
Similar to Shear command except that it shears by angle rather than displacement.
Rotates about World Axes and displaces along World Axes, angle must not exceed +-80 degrees.
Rotation axis is centred on Active Vertex.
Works only in Edit mode.
Note:
Similar to Shear command except that it shears by angle rather than displacement.
Rotates about World Axes and displaces along World Axes, angle must not exceed +-80 degrees.
Rotation axis is centred on Active Vertex.
Works only in Edit mode.
Args:
context: Blender bpy.context instance.

View File

@ -42,16 +42,17 @@ class PDT_OT_PlacementAbs(Operator):
def execute(self, context):
"""Manipulates Geometry, or Objects by Absolute (World) Coordinates.
- Reads pg.operate from Operation Mode Selector as 'operation'
- Reads pg.cartesian_coords scene variables to:
-- set position of CUrsor (CU)
-- set postion of Pivot Point (PP)
-- MoVe geometry/objects (MV)
-- Extrude Vertices (EV)
-- Split Edges (SE)
-- add a New Vertex (NV)
Note:
- Reads pg.operate from Operation Mode Selector as 'operation'
- Reads pg.cartesian_coords scene variables to:
-- set position of CUrsor (CU)
-- set postion of Pivot Point (PP)
-- MoVe geometry/objects (MV)
-- Extrude Vertices (EV)
-- Split Edges (SE)
-- add a New Vertex (NV)
Invalid Options result in self.report Error.
Invalid Options result in self.report Error.
Args:
context: Blender bpy.context instance.
@ -122,18 +123,19 @@ class PDT_OT_PlacementDelta(Operator):
def execute(self, context):
"""Manipulates Geometry, or Objects by Delta Offset (Increment).
- Reads pg.operation from Operation Mode Selector as 'operation'
- Reads pg.select, pg.plane, pg.cartesian_coords scene variables to:
-- 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)
-- Duplicate Geometry (DG)
-- Extrude Geometry (EG)
Note:
- Reads pg.operation from Operation Mode Selector as 'operation'
- Reads pg.select, pg.plane, pg.cartesian_coords scene variables to:
-- 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)
-- Duplicate Geometry (DG)
-- Extrude Geometry (EG)
Invalid Options result in self.report Error.
Invalid Options result in self.report Error.
Args:
context: Blender bpy.context instance.
@ -218,18 +220,19 @@ class PDT_OT_PlacementDis(Operator):
def execute(self, context):
"""Manipulates Geometry, or Objects by Distance at Angle (Direction).
- Reads pg.operation from Operation Mode Selector as 'operation'
- Reads pg.select, pg.distance, pg.angle, pg.plane & pg.flip_angle scene variables to:
-- 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)
-- Duplicate Geometry (DG)
-- Extrude Geometry (EG)
Note:
- Reads pg.operation from Operation Mode Selector as 'operation'
- Reads pg.select, pg.distance, pg.angle, pg.plane & pg.flip_angle scene variables to:
-- 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)
-- Duplicate Geometry (DG)
-- Extrude Geometry (EG)
Invalid Options result in self.report Error.
Invalid Options result in self.report Error.
Args:
context: Blender bpy.context instance.
@ -306,16 +309,17 @@ class PDT_OT_PlacementPer(Operator):
def execute(self, context):
"""Manipulates Geometry, or Objects by Percentage between 2 points.
- Reads pg.operation from Operation Mode Selector as 'operation'
- Reads pg.percent, pg.extend & pg.flip_percent scene variables to:
-- 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)
Note:
- Reads pg.operation from Operation Mode Selector as 'operation'
- Reads pg.percent, pg.extend & pg.flip_percent scene variables to:
-- 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 self.report Error.
Invalid Options result in self.report Error.
Args:
context: Blender bpy.context instance.
@ -362,16 +366,17 @@ class PDT_OT_PlacementNormal(Operator):
def execute(self, context):
"""Manipulates Geometry, or Objects by Normal Intersection between 3 points.
- Reads pg.operation from Operation Mode Selector as 'operation'
- Reads pg.extend scene variable to:
-- 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)
Note:
- Reads pg.operation from Operation Mode Selector as 'operation'
- Reads pg.extend scene variable to:
-- 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 self.report Error.
Invalid Options result in self.report Error.
Args:
context: Blender bpy.context instance.
@ -410,14 +415,15 @@ class PDT_OT_PlacementCen(Operator):
def execute(self, context):
"""Manipulates Geometry, or Objects to an Arc Centre defined by 3 points on an Imaginary Arc.
- Reads pg.operation from Operation Mode Selector as 'operation'
-- set position of CUrsor (CU)
-- set position of Pivot Point (PP)
-- MoVe geometry/objects (MV)
-- Extrude Vertices (EV)
-- add a New vertex (NV)
Note:
- Reads pg.operation from Operation Mode Selector as 'operation'
-- 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 self.report Error.
Invalid Options result in self.report Error.
Args:
context: Blender bpy.context instance.
@ -454,17 +460,16 @@ class PDT_OT_PlacementInt(Operator):
def execute(self, context):
"""Manipulates Geometry, or Objects by Convergance Intersection between 4 points, or 2 Edges.
- Reads pg.operation from Operation Mode Selector as 'operation'
- 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)
Note:
- Reads pg.operation from Operation Mode Selector as 'operation'
- 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 "self.report" Error.
Local vector variable 'vector_delta' used to reposition features.
Invalid Options result in "self.report" Error.
Args:
context: Blender bpy.context instance.
@ -508,9 +513,10 @@ class PDT_OT_JoinVerts(Operator):
def execute(self, context):
"""Joins 2 Free Vertices that do not form part of a Face.
Joins two vertices that do not form part of a single face
It is designed to close open Edge Loops, where a face is not required
or to join two disconnected Edges.
Note:
Joins two vertices that do not form part of a single face
It is designed to close open Edge Loops, where a face is not required
or to join two disconnected Edges.
Args:
context: Blender bpy.context instance.
@ -541,12 +547,14 @@ class PDT_OT_Fillet(Operator):
def execute(self, context):
"""Create Fillets by Vertex or by Geometry.
Fillets connected edges, or connected faces
Note:
Fillets connected edges, or connected faces
Uses:
- pg.fillet_radius ; Radius of fillet
- pg.fillet_segments ; Number of segments
- pg.fillet_profile ; Profile, values 0 to 1
- pg.fillet_vertices_only ; Vertices (True), or Face/Edges
- pg.fillet_radius ; Radius of fillet
- pg.fillet_segments ; Number of segments
- pg.fillet_profile ; Profile, values 0 to 1
- pg.fillet_vertices_only ; Vertices (True), or Face/Edges
- pg.fillet_intersect ; Intersect dges first (True), or not
Args:
context: Blender bpy.context instance.
@ -588,9 +596,10 @@ class PDT_OT_Angle2(Operator):
def execute(self, context):
"""Measures Angle and Offsets between 2 Points in View Plane.
Uses 2 Selected Vertices to set pg.angle and pg.distance scene variables
also sets delta offset from these 2 points using standard Numpy Routines
Works in Edit and Oject Modes.
Note:
Uses 2 Selected Vertices to set pg.angle and pg.distance scene variables
also sets delta offset from these 2 points using standard Numpy Routines
Works in Edit and Oject Modes.
Args:
context: Blender bpy.context instance.
@ -614,9 +623,10 @@ class PDT_OT_Angle3(Operator):
def execute(self, context):
"""Measures Angle and Offsets between 3 Points in World Space, Also sets Deltas.
Uses 3 Selected Vertices to set pg.angle and pg.distance scene variables
also sets delta offset from these 3 points using standard Numpy Routines
Works in Edit and Oject Modes.
Note:
Uses 3 Selected Vertices to set pg.angle and pg.distance scene variables
also sets delta offset from these 3 points using standard Numpy Routines
Works in Edit and Oject Modes.
Args:
context: Blender bpy.context instance.
@ -640,9 +650,10 @@ class PDT_OT_Origin(Operator):
def execute(self, context):
"""Sets Object Origin in Edit Mode to Cursor Location.
Keeps geometry static in World Space whilst moving Object Origin
Requires cursor location
Works in Edit and Object Modes.
Note:
Keeps geometry static in World Space whilst moving Object Origin
Requires cursor location
Works in Edit and Object Modes.
Args:
context: Blender bpy.context instance.
@ -673,10 +684,11 @@ class PDT_OT_Taper(Operator):
def execute(self, context):
"""Taper Geometry along World Axes.
Similar to Shear command except that it shears by angle rather than displacement.
Rotates about World Axes and displaces along World Axes, angle must not exceed +-80 degrees.
Rotation axis is centred on Active Vertex.
Works only in Edit mode.
Note:
Similar to Blender Shear command except that it shears by angle rather than displacement.
Rotates about World Axes and displaces along World Axes, angle must not exceed +-80 degrees.
Rotation axis is centred on Active Vertex.
Works only in Edit mode.
Args:
context: Blender bpy.context instance.

View File

@ -30,6 +30,7 @@ from mathutils.geometry import intersect_line_plane
from .pdt_msg_strings import (
PDT_ERR_NOINT,
PDT_ERR_EDOB_MODE,
PDT_ERR_SEL_1_E_1_F,
)
from .pdt_functions import oops
@ -45,7 +46,7 @@ def failure_message(context):
"""
pg = context.scene.pdt_pg
pg.error = f"Select One Face and One Edge"
pg.error = f"{PDT_ERR_SEL_1_E_1_F}"
context.window_manager.popup_menu(oops, title="Error", icon="ERROR")

View File

@ -45,9 +45,10 @@ PDT_ShaderError = pdt_exception.ShaderError
def debug(msg, prefix=""):
"""Print a debug message to the console if PDT's or Blender's debug flags are set.
The printed message will be of the form:
Note:
The printed message will be of the form:
{prefix}{caller file name:line number}| {msg}
{prefix}{caller file name:line number}| {msg}
Args:
msg: Incomming message to display
@ -90,14 +91,12 @@ def debug(msg, prefix=""):
def oops(self, context):
"""Error Routine.
Displays error message in a popup.
Note:
Displays error message in a popup.
Args:
context: Blender bpy.context instance.
Note:
Uses pg.error scene variable
Returns:
Nothing.
"""
@ -110,10 +109,11 @@ def oops(self, context):
def set_mode(mode_pl):
"""Sets Active Axes for View Orientation.
Sets indices of axes for locational vectors:
"XY": a1 = x, a2 = y, a3 = z
"XZ": a1 = x, a2 = z, a3 = y
"YZ": a1 = y, a2 = z, a3 = x
Note:
Sets indices of axes for locational vectors:
"XY": a1 = x, a2 = y, a3 = z
"XZ": a1 = x, a2 = z, a3 = y
"YZ": a1 = y, a2 = z, a3 = x
Args:
mode_pl: Plane Selector variable as input
@ -133,14 +133,13 @@ def set_mode(mode_pl):
def set_axis(mode_pl):
"""Sets Active Axes for View Orientation.
Sets indices for axes from taper vectors
Note:
Sets indices for axes from taper vectors
Axis order: Rotate Axis, Move Axis, Height Axis
Args:
mode_pl: Taper Axis Selector variable as input
Note:
Axis order: Rotate Axis, Move Axis, Height Axis
Returns:
3 Integer Indicies.
"""
@ -159,7 +158,8 @@ def set_axis(mode_pl):
def check_selection(num, bm, obj):
"""Check that the Object's select_history has sufficient entries.
If selection history is not Verts, clears selection and history.
Note:
If selection history is not Verts, clears selection and history.
Args:
num: The number of entries required for each operation
@ -253,7 +253,8 @@ def view_coords(x_loc, y_loc, z_loc):
def view_coords_i(x_loc, y_loc, z_loc):
"""Converts Screen Oriented input Vector values to new World Vector.
Converts View tranformation Matrix to Rotational Matrix
Note:
Converts View tranformation Matrix to Rotational Matrix
Args:
x_loc: X coordinate from vector
@ -278,8 +279,9 @@ def view_coords_i(x_loc, y_loc, z_loc):
def view_dir(dis_v, ang_v):
"""Converts Distance and Angle to View Oriented Vector.
Converts View Transformation Matrix to Rotational Matrix (3x3)
Angles are Converts to Radians from degrees.
Note:
Converts View Transformation Matrix to Rotational Matrix (3x3)
Angles are Converts to Radians from degrees.
Args:
dis_v: Scene PDT distance
@ -366,8 +368,11 @@ def arc_centre(vector_a, vector_b, vector_c):
def intersection(vertex_a, vertex_b, vertex_c, vertex_d, plane):
"""Calculates Intersection Point of 2 Imagined Lines from 4 Vectors.
Calculates Converging Intersect Location and indication of
whether the lines are convergent using standard Numpy Routines
Note:
Calculates Converging Intersect Location and indication of
whether the lines are convergent using standard Numpy Routines
Args:
vertex_a: Active vector location of first line
vertex_b: Second vector location of first line
@ -426,11 +431,12 @@ def intersection(vertex_a, vertex_b, vertex_c, vertex_d, plane):
def get_percent(obj, flip_percent, per_v, data, scene):
"""Calculates a Percentage Distance between 2 Vectors.
Calculates a point that lies a set percentage between two given points
using standard Numpy Routines.
Note:
Calculates a point that lies a set percentage between two given points
using standard Numpy Routines.
Works for either 2 vertices for an object in Edit mode
or 2 selected objects in Object mode.
Works for either 2 vertices for an object in Edit mode
or 2 selected objects in Object mode.
Args:
obj: The Object under consideration
@ -576,7 +582,8 @@ SHADER = gpu.shader.from_builtin("3D_UNIFORM_COLOR") if not bpy.app.background e
def draw_3d(coords, gtype, rgba, context):
"""Draw Pivot Point Graphics.
Draws either Lines Points, or Tris using defined shader
Note:
Draws either Lines Points, or Tris using defined shader
Args:
coords: Input Coordinates List
@ -603,9 +610,10 @@ def draw_3d(coords, gtype, rgba, context):
def draw_callback_3d(self, context):
"""Create Coordinate List for Pivot Point Graphic.
Creates coordinates for Pivot Point Graphic consisting of 6 Tris
and one Point colour coded Red; X axis, Green; Y axis, Blue; Z axis
and a yellow point based upon screen scale
Note:
Creates coordinates for Pivot Point Graphic consisting of 6 Tris
and one Point colour coded Red; X axis, Green; Y axis, Blue; Z axis
and a yellow point based upon screen scale
Args:
context: Blender bpy.context instance.
@ -688,14 +696,13 @@ def draw_callback_3d(self, context):
def scale_set(self, context):
"""Sets Scale by dividing Pivot Distance by System Distance.
Sets Pivot Point Scale Factors by Measurement
Note:
Sets Pivot Point Scale Factors by Measurement
Uses pg.pivotdis & pg.distance scene variables
Args:
context: Blender bpy.context instance.
Note:
Uses pg.pivotdis & pg.distance scene variables
Returns:
Status Set.
"""

View File

@ -68,14 +68,13 @@ class PDT_OT_Append(Operator):
def execute(self, context):
"""Appends Objects from PDT Library file.
Appended Objects are placed at Cursor Location.
Note:
Appended Objects are placed at Cursor Location.
Uses pg.lib_objects, pg.lib_collections & pg.lib_materials
Args:
context: Blender bpy.context instance.
Note:
Uses pg.lib_objects, pg.lib_collections & pg.lib_materials
Returns:
Status Set.
"""
@ -146,14 +145,13 @@ class PDT_OT_Link(Operator):
def execute(self, context):
"""Links Objects from PDT Library file.
Linked Objects are placed at Cursor Location
Note:
Linked Objects are placed at Cursor Location
Uses pg.lib_objects, pg.lib_collections & pg.lib_materials
Args:
context: Blender bpy.context instance.
Note:
Uses pg.lib_objects, pg.lib_collections & pg.lib_materials
Returns:
Status Set.
"""

View File

@ -26,20 +26,21 @@
# If you edit this file do not change any of the PDT_ format, just the Text Value in "'s
# Do not delete any of the PDT_ lines
#
# 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.
Note:
These strings are called by various programmes in PDT,
they can be set to suit individual User requirements.
Args:
None
Args:
None
Returns:
None
"""
Returns:
None.
"""
# Menu Labels
#
PDT_LAB_ABS = "Absolute" # "Global"
PDT_LAB_DEL = "Delta" # "Relative"
PDT_LAB_DIR = "Direction" # "Polar"

View File

@ -50,7 +50,8 @@ class PDT_OT_ModalDrawOperator(bpy.types.Operator):
def handle_add(self, context):
"""Draw Pivot Point Graphic if not displayed.
Draws 7 element Pivot Point Graphic
Note:
Draws 7 element Pivot Point Graphic
Args:
context: Blender bpy.context instance.
@ -69,7 +70,8 @@ class PDT_OT_ModalDrawOperator(bpy.types.Operator):
def handle_remove(self, context):
"""Remove Pivot Point Graphic if displayed.
Removes 7 element Pivot Point Graphic
Note:
Removes 7 element Pivot Point Graphic
Args:
context: Blender bpy.context instance.
@ -86,7 +88,8 @@ class PDT_OT_ModalDrawOperator(bpy.types.Operator):
def execute(self, context):
"""Pivot Point Show/Hide Button Function.
Operational execute function for Show/Hide Pivot Point function
Note:
Operational execute function for Show/Hide Pivot Point function
Args:
context: Blender bpy.context instance.
@ -136,8 +139,9 @@ class PDT_OT_ViewPlaneRotate(Operator):
def execute(self, context):
"""Rotate Selected Vertices about Pivot Point.
Rotates any selected vertices about the Pivot Point
in View Oriented coordinates, works in any view orientation.
Note:
Rotates any selected vertices about the Pivot Point
in View Oriented coordinates, works in any view orientation.
Args:
context: Blender bpy.context instance.
@ -199,8 +203,9 @@ class PDT_OT_ViewPlaneScale(Operator):
def execute(self, context):
"""Scales Selected Vertices about Pivot Point.
Scales any selected vertices about the Pivot Point
in View Oriented coordinates, works in any view orientation
Note:
Scales any selected vertices about the Pivot Point
in View Oriented coordinates, works in any view orientation
Args:
context: Blender bpy.context instance.
@ -250,7 +255,8 @@ class PDT_OT_PivotToCursor(Operator):
def execute(self, context):
"""Moves Pivot Point to Cursor Location.
Moves Pivot Point to Cursor Location in active scene
Note:
Moves Pivot Point to Cursor Location in active scene
Args:
context: Blender bpy.context instance.
@ -277,7 +283,8 @@ class PDT_OT_CursorToPivot(Operator):
def execute(self, context):
"""Moves Cursor to Pivot Point Location.
Moves Cursor to Pivot Point Location in active scene
Note:
Moves Cursor to Pivot Point Location in active scene
Args:
context: Blender bpy.context instance.
@ -319,8 +326,9 @@ class PDT_OT_PivotSelected(Operator):
def execute(self, context):
"""Moves Pivot Point centroid of Selected Geometry.
Moves Pivot Point centroid of Selected Geometry in active scene
using Snap_Cursor_To_Selected, then puts cursor back to original location.
Note:
Moves Pivot Point centroid of Selected Geometry in active scene
using Snap_Cursor_To_Selected, then puts cursor back to original location.
Args:
context: Blender bpy.context instance.
@ -378,7 +386,8 @@ class PDT_OT_PivotOrigin(Operator):
def execute(self, context):
"""Moves Pivot Point to Object Origin.
Moves Pivot Point to Object Origin in active scene
Note:
Moves Pivot Point to Object Origin in active scene
Args:
context: Blender bpy.context instance.
@ -426,8 +435,9 @@ class PDT_OT_PivotWrite(Operator):
def execute(self, context):
"""Writes Pivot Point Location to Object's Custom Properties.
Writes Pivot Point Location to Object's Custom Properties
as Vector to 'PDT_PP_LOC' - Requires Confirmation through dialogue
Note:
Writes Pivot Point Location to Object's Custom Properties
as Vector to 'PDT_PP_LOC' - Requires Confirmation through dialogue
Args:
context: Blender bpy.context instance.
@ -482,8 +492,9 @@ class PDT_OT_PivotRead(Operator):
def execute(self, context):
"""Reads Pivot Point Location from Object's Custom Properties.
Sets Pivot Point Location from Object's Custom Properties
using 'PDT_PP_LOC'
Note:
Sets Pivot Point Location from Object's Custom Properties
using 'PDT_PP_LOC'
Args:
context: Blender bpy.context instance.

View File

@ -42,15 +42,14 @@ class PDT_OT_ViewRot(Operator):
def execute(self, context):
"""View Rotation by Absolute Values.
Rotations are converted to 3x3 Quaternion Rotation Matrix.
This is an Absolute Rotation, not an Incremental Orbit.
Note:
Rotations are converted to 3x3 Quaternion Rotation Matrix.
This is an Absolute Rotation, not an Incremental Orbit.
Uses pg.rotation_coords scene variable
Args:
context: Blender bpy.context instance.
Note:
Uses pg.rotation_coords scene variables
Returns:
Status Set.
"""
@ -77,14 +76,13 @@ class PDT_OT_ViewRotL(Operator):
def execute(self, context):
"""View Orbit Left by Delta Value.
Orbits view to the left about its vertical axis
Note:
Uses pg.vrotangle scene variable
Orbits view to the left about its vertical axis
Args:
context: Blender bpy.context instance.
Note:
Uses pg.vrotangle scene variable
Returns:
Status Set.
"""
@ -106,14 +104,13 @@ class PDT_OT_ViewRotR(Operator):
def execute(self, context):
"""View Orbit Right by Delta Value.
Orbits view to the right about its vertical axis
Note:
Uses pg.vrotangle scene variable
Orbits view to the right about its vertical axis
Args:
context: Blender bpy.context instance.
Note:
Uses pg.vrotangle scene variable
Returns:
Status Set.
"""
@ -135,14 +132,13 @@ class PDT_OT_ViewRotU(Operator):
def execute(self, context):
"""View Orbit Up by Delta Value.
Orbits view up about its horizontal axis
Note:
Uses pg.vrotangle scene variable
Orbits view up about its horizontal axis
Args:
context: Blender bpy.context instance.
Note:
Uses pg.vrotangle scene variable
Returns:
Status Set.
"""
@ -164,14 +160,13 @@ class PDT_OT_ViewRotD(Operator):
def execute(self, context):
"""View Orbit Down by Delta Value.
Orbits view down about its horizontal axis
Note:
Uses pg.vrotangle scene variable
Orbits view down about its horizontal axis
Args:
context: Blender bpy.context instance.
Note:
Uses pg.vrotangle scene variable
Returns:
Status Set.
"""
@ -193,14 +188,13 @@ class PDT_OT_ViewRoll(Operator):
def execute(self, context):
"""View Roll by Delta Value.
Rolls view about its normal axis
Note:
Uses pg.vrotangle scene variable
Rolls view about its normal axis
Args:
context: Blender bpy.context instance.
Note:
Uses pg.vrotangle scene variable
Returns:
Status Set.
"""
@ -222,7 +216,8 @@ class PDT_OT_ViewIso(Operator):
def execute(self, context):
"""Set Isometric View.
Set view orientation to Orthographic Isometric
Note:
Set view orientation to Orthographic Isometric
Args:
context: Blender bpy.context instance.

View File

@ -40,7 +40,8 @@ def order_points(edge, point_list):
v1, v2 = edge
def dist(coord):
"""MEasure distance between two coordinates."""
"""Measure distance between two coordinates."""
return (v1 - coord).length
point_list = sorted(point_list, key=dist)
@ -203,7 +204,8 @@ def unselect_nonintersecting(bm, d_edges, edge_indices):
def intersect_all(context):
"""Computes All intersections with Crossing Geometry.
Deletes original edges and replaces with new intersected edges
Note:
Deletes original edges and replaces with new intersected edges
Args:
context: Blender bpy.context instance.
@ -251,7 +253,7 @@ class PDT_OT_IntersectAllEdges(bpy.types.Operator):
@classmethod
def poll(cls, context):
"""Check to see object is in correct condidtion.
"""Check to see object is in correct condition.
Args:
context: Blender bpy.context instance.
@ -267,7 +269,8 @@ class PDT_OT_IntersectAllEdges(bpy.types.Operator):
def execute(self, context):
"""Computes All intersections with Crossing Geometry.
Deletes original edges and replaces with new intersected edges
Note:
Deletes original edges and replaces with new intersected edges
Args:
context: Blender bpy.context instance.