Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
blender-addons
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
blender
blender-addons
Commits
c06f76b0
Commit
c06f76b0
authored
5 years ago
by
Alan Odom
Committed by
Rune Morling
5 years ago
Browse files
Options
Downloads
Patches
Plain Diff
PDT: Revise Docstrings
Made functions more understandable by improving DocStrings
parent
ee577f16
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
pdt_tangent.py
+35
-4
35 additions, 4 deletions
pdt_tangent.py
precision_drawing_tools/pdt_command.py
+1
-1
1 addition, 1 deletion
precision_drawing_tools/pdt_command.py
with
36 additions
and
5 deletions
pdt_tangent.py
+
35
−
4
View file @
c06f76b0
...
...
@@ -113,6 +113,7 @@ def get_tangent_points(context, hloc_0, vloc_0, radius_0, hloc_p, vloc_p):
vloc_t1: Vertical Location of First Tangent Point
vloc_t2: Vertical Location of Second Tangent Point
"""
numerator
=
(
radius_0
**
2
*
(
hloc_p
-
hloc_0
))
+
(
radius_0
*
(
vloc_p
-
vloc_0
)
...
...
@@ -202,7 +203,23 @@ def make_vectors(coords, a1, a2, a3, pg):
def
tangent_setup
(
context
,
pg
,
plane
,
obj_data
,
centre_0
,
centre_1
,
centre_2
,
radius_0
,
radius_1
):
# Depth is a3
"""
This section sets up all the variables required for the tangent functions.
Args:
context: Blender bpy.context instance
pg: PDT Parameter Group of variables
plane: Working plane
obj_data: All the data of the chosen object
centre_0: Centre coordinates of the first arc
centre_1: Centre coordinates of the second arc
centre_2: Coordinates fo the point
radius_0: Radius if the first Arc
radius_1: Radius of the second Arc
Returns:
Status Set.
"""
a1
,
a2
,
a3
=
set_mode
(
plane
)
mode
=
pg
.
tangent_mode
if
plane
==
"
LO
"
:
...
...
@@ -226,6 +243,11 @@ def tangent_setup(context, pg, plane, obj_data, centre_0, centre_1, centre_2, ra
context
.
window_manager
.
popup_menu
(
oops
,
title
=
"
Error
"
,
icon
=
"
ERROR
"
)
return
{
"
FINISHED
"
}
"""
This next section will draw Point based Tangents.
These are drawn from a point to an Arc
"""
if
mode
==
"
point
"
:
if
(
(
centre_2
[
a1
]
-
centre_0
[
a1
])
**
2
+
(
centre_2
[
a2
]
-
centre_0
[
a2
])
**
2
-
radius_0
**
2
...
...
@@ -259,8 +281,12 @@ def tangent_setup(context, pg, plane, obj_data, centre_0, centre_1, centre_2, ra
return
{
"
FINISHED
"
}
"""
This next section will draw Arc based Outer Tangents.
These are drawn from an Arc to another Arc
"""
if
mode
in
{
"
outer
"
,
"
both
"
}:
# Outer Tangents
if
radius_0
==
radius_1
:
# No intersection point for outer tangents
sin_angle
=
(
centre_1
[
a2
]
-
centre_0
[
a2
])
/
distance
...
...
@@ -310,8 +336,12 @@ def tangent_setup(context, pg, plane, obj_data, centre_0, centre_1, centre_2, ra
tangent_vectors
=
make_vectors
(
coords_in
,
a1
,
a2
,
a3
,
pg
)
draw_tangents
(
tangent_vectors
,
obj_data
)
"""
This next section will draw Arc based Inner Tangents.
These are drawn from an Arc to another Arc
"""
if
mode
in
{
"
inner
"
,
"
both
"
}:
# Inner Tangents
hloc_pi
,
vloc_pi
=
get_tangent_intersect_inner
(
centre_0
[
a1
],
centre_0
[
a2
],
centre_1
[
a1
],
centre_1
[
a2
],
radius_0
,
radius_1
)
...
...
@@ -347,6 +377,8 @@ def tangent_setup(context, pg, plane, obj_data, centre_0, centre_1, centre_2, ra
tangent_vectors
=
make_vectors
(
coords_in
,
a1
,
a2
,
a3
,
pg
)
draw_tangents
(
tangent_vectors
,
obj_data
)
return
{
"
FINISHED
"
}
def
draw_tangents
(
tangent_vectors
,
obj_data
):
"""
Add Edges Representing the Tangents.
...
...
@@ -452,7 +484,6 @@ class PDT_OT_TangentOperate(Operator):
Returns:
Nothing.
"""
scene
=
context
.
scene
pg
=
scene
.
pdt_pg
plane
=
pg
.
plane
...
...
This diff is collapsed.
Click to expand it.
precision_drawing_tools/pdt_command.py
+
1
−
1
View file @
c06f76b0
...
...
@@ -460,7 +460,7 @@ def command_parse(context):
obj_loc
=
obj
.
matrix_world
.
decompose
()[
0
]
verts
=
[]
else
:
if
operation
not
in
{
"
G
"
}
:
if
operation
!=
"
G
"
:
pg
.
error
=
PDT_OBJ_MODE_ERROR
context
.
window_manager
.
popup_menu
(
oops
,
title
=
"
Error
"
,
icon
=
"
ERROR
"
)
raise
PDT_ObjectModeError
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment