[Bf-extensions-cvs] [ce0ac829] master: Add_Dimension: angle, small correction
Spivak Vladimir cwolf3d
noreply at git.blender.org
Mon Jun 10 01:12:15 CEST 2019
Commit: ce0ac829c7c43a7171e7d9fb914b719d3ed2ce4e
Author: Spivak Vladimir (cwolf3d)
Date: Mon Jun 10 02:10:48 2019 +0300
Branches: master
https://developer.blender.org/rBACce0ac829c7c43a7171e7d9fb914b719d3ed2ce4e
Add_Dimension: angle, small correction
===================================================================
M add_dimension.py
===================================================================
diff --git a/add_dimension.py b/add_dimension.py
index e459a70e..33dd7479 100644
--- a/add_dimension.py
+++ b/add_dimension.py
@@ -1873,81 +1873,66 @@ def main(self, align_matrix):
self.Dimension_width = v.length
if Type == 'Angular1' or Type == 'Angular2' or Type == 'Angular3':
- c = ablength(self.Dimension_startlocation.x, self.Dimension_startlocation.y, self.Dimension_startlocation.z, self.Dimension_endlocation.x, self.Dimension_endlocation.y, self.Dimension_endlocation.z)
+ a = ablength(self.Dimension_startlocation.x, self.Dimension_startlocation.y, self.Dimension_startlocation.z, self.Dimension_endlocation.x, self.Dimension_endlocation.y, self.Dimension_endlocation.z)
b = ablength(self.Dimension_startlocation.x, self.Dimension_startlocation.y, self.Dimension_startlocation.z, self.Dimension_endanglelocation.x, self.Dimension_endanglelocation.y, self.Dimension_endanglelocation.z)
- a = ablength(self.Dimension_endanglelocation.x, self.Dimension_endanglelocation.y, self.Dimension_endanglelocation.z, self.Dimension_endlocation.x, self.Dimension_endlocation.y, self.Dimension_endlocation.z)
+ c = ablength(self.Dimension_endanglelocation.x, self.Dimension_endanglelocation.y, self.Dimension_endanglelocation.z, self.Dimension_endlocation.x, self.Dimension_endlocation.y, self.Dimension_endlocation.z)
self.Dimension_width = max(a, b, c)
- vanglex = self.Dimension_endanglelocation.x - self.Dimension_startlocation.x
- vangley = self.Dimension_endanglelocation.y - self.Dimension_startlocation.y
- vanglez = self.Dimension_endanglelocation.z - self.Dimension_startlocation.z
- vendx = self.Dimension_endlocation.x - self.Dimension_startlocation.x
- vendy = self.Dimension_endlocation.y - self.Dimension_startlocation.y
- vendz = self.Dimension_endlocation.z - self.Dimension_startlocation.z
if self.Dimension_XYZType == 'TOP' or self.Dimension_XYZType == 'BOTTOM':
- self.Dimension_XYType = 'X'
- g = hypot(vanglex, vangley)
- if g != 0 :
- u2 = acos(vanglex / g)
- u1 = asin(vangley / g)
- if u1 < 0 :
- u2 = -u2
- else:
- u2 = 0
- g = hypot(vendx, vendy)
- if g != 0 :
- uu2 = acos(vendx / g)
- uu1 = asin(vendy / g)
- if uu1 < 0 :
- uu2 = -uu2
- else:
- uu2 = 0
- self.Dimension_angle = degrees(u2 - uu2)
+ if self.Angle_Type == 'A':
+ c = ablength(self.Dimension_startlocation.x, self.Dimension_startlocation.y, 0, self.Dimension_endlocation.x, self.Dimension_endlocation.y, 0)
+ b = ablength(self.Dimension_startlocation.x, self.Dimension_startlocation.y, 0, self.Dimension_endanglelocation.x, self.Dimension_endanglelocation.y, 0)
+ a = ablength(self.Dimension_endanglelocation.x, self.Dimension_endanglelocation.y, self.Dimension_endanglelocation.z, self.Dimension_endlocation.x, self.Dimension_endlocation.y, 0)
+ if self.Angle_Type == 'B':
+ a = ablength(self.Dimension_startlocation.x, self.Dimension_startlocation.y, 0, self.Dimension_endlocation.x, self.Dimension_endlocation.y, 0)
+ c = ablength(self.Dimension_startlocation.x, self.Dimension_startlocation.y, 0, self.Dimension_endanglelocation.x, self.Dimension_endanglelocation.y, 0)
+ b = ablength(self.Dimension_endanglelocation.x, self.Dimension_endanglelocation.y, self.Dimension_endanglelocation.z, self.Dimension_endlocation.x, self.Dimension_endlocation.y, 0)
+ if self.Angle_Type == 'C':
+ b = ablength(self.Dimension_startlocation.x, self.Dimension_startlocation.y, 0, self.Dimension_endlocation.x, self.Dimension_endlocation.y, 0)
+ a = ablength(self.Dimension_startlocation.x, self.Dimension_startlocation.y, 0, self.Dimension_endanglelocation.x, self.Dimension_endanglelocation.y, 0)
+ c = ablength(self.Dimension_endanglelocation.x, self.Dimension_endanglelocation.y, self.Dimension_endanglelocation.z, self.Dimension_endlocation.x, self.Dimension_endlocation.y, 0)
if self.Dimension_XYZType == 'FRONT' or self.Dimension_XYZType == 'BACK':
- self.Dimension_XZType = 'Z'
- g = hypot(vanglex, vanglez)
- if g != 0 :
- u2 = acos(vanglex / g)
- u1 = asin(vanglez / g)
- if u1 < 0 :
- u2 = -u2
- else:
- u2 = 0
- g = hypot(vendx, vendz)
- if g != 0 :
- uu2 = acos(vendx / g)
- uu1 = asin(vendz / g)
- if uu1 < 0 :
- uu2 = -uu2
- else:
- uu2 = 0
- self.Dimension_angle = degrees(u2 - uu2)
+ if self.Angle_Type == 'A':
+ c = ablength(self.Dimension_startlocation.x, 0, self.Dimension_startlocation.z, self.Dimension_endlocation.x, 0, self.Dimension_endlocation.z)
+ b = ablength(self.Dimension_startlocation.x, 0, self.Dimension_startlocation.z, self.Dimension_endanglelocation.x, 0, self.Dimension_endanglelocation.z)
+ a = ablength(self.Dimension_endanglelocation.x, 0, self.Dimension_endanglelocation.z, self.Dimension_endlocation.x, 0, self.Dimension_endlocation.z)
+ if self.Angle_Type == 'B':
+ a = ablength(self.Dimension_startlocation.x, 0, self.Dimension_startlocation.z, self.Dimension_endlocation.x, 0, self.Dimension_endlocation.z)
+ c = ablength(self.Dimension_startlocation.x, 0, self.Dimension_startlocation.z, self.Dimension_endanglelocation.x, 0, self.Dimension_endanglelocation.z)
+ b = ablength(self.Dimension_endanglelocation.x, 0, self.Dimension_endanglelocation.z, self.Dimension_endlocation.x, 0, self.Dimension_endlocation.z)
+ if self.Angle_Type == 'C':
+ b = ablength(self.Dimension_startlocation.x, 0, self.Dimension_startlocation.z, self.Dimension_endlocation.x, 0, self.Dimension_endlocation.z)
+ a = ablength(self.Dimension_startlocation.x, 0, self.Dimension_startlocation.z, self.Dimension_endanglelocation.x, 0, self.Dimension_endanglelocation.z)
+ c = ablength(self.Dimension_endanglelocation.x, 0, self.Dimension_endanglelocation.z, self.Dimension_endlocation.x, 0, self.Dimension_endlocation.z)
if self.Dimension_XYZType == 'RIGHT' or self.Dimension_XYZType == 'LEFT':
- self.Dimension_YZType = 'Z'
- g = hypot(vangley, vanglez)
- if g != 0 :
- u2 = acos(vangley / g)
- u1 = asin(vanglez / g)
- if u1 < 0 :
- u2 = -u2
- else:
- u2 = 0
- g = hypot(vendy, vendz)
- if g != 0 :
- uu2 = acos(vendy / g)
- uu1 = asin(vendz / g)
- if uu1 < 0 :
- uu2 = -uu2
- else:
- uu2 = 0
- self.Dimension_angle = degrees(u2 - uu2)
+ if self.Angle_Type == 'A':
+ c = ablength(0, self.Dimension_startlocation.y, self.Dimension_startlocation.z, 0, self.Dimension_endlocation.y, self.Dimension_endlocation.z)
+ b = ablength(0, self.Dimension_startlocation.y, self.Dimension_startlocation.z, 0, self.Dimension_endanglelocation.y, self.Dimension_endanglelocation.z)
+ a = ablength(0, self.Dimension_endanglelocation.y, self.Dimension_endanglelocation.z, 0, self.Dimension_endlocation.y, self.Dimension_endlocation.z)
+ if self.Angle_Type == 'B':
+ a = ablength(0, self.Dimension_startlocation.y, self.Dimension_startlocation.z, 0, self.Dimension_endlocation.y, self.Dimension_endlocation.z)
+ c = ablength(0, self.Dimension_startlocation.y, self.Dimension_startlocation.z, 0, self.Dimension_endanglelocation.y, self.Dimension_endanglelocation.z)
+ b = ablength(0, self.Dimension_endanglelocation.y, self.Dimension_endanglelocation.z, 0, self.Dimension_endlocation.y, self.Dimension_endlocation.z)
+ if self.Angle_Type == 'C':
+ b = ablength(0, self.Dimension_startlocation.y, self.Dimension_startlocation.z, 0, self.Dimension_endlocation.y, self.Dimension_endlocation.z)
+ a = ablength(0, self.Dimension_startlocation.y, self.Dimension_startlocation.z, 0, self.Dimension_endanglelocation.y, self.Dimension_endanglelocation.z)
+ c = ablength(0, self.Dimension_endanglelocation.y, self.Dimension_endanglelocation.z, 0, self.Dimension_endlocation.y, self.Dimension_endlocation.z)
if self.Dimension_liberty == '3D':
- c = ablength(self.Dimension_startlocation.x, self.Dimension_startlocation.y, self.Dimension_startlocation.z, self.Dimension_endlocation.x, self.Dimension_endlocation.y, self.Dimension_endlocation.z)
- b = ablength(self.Dimension_startlocation.x, self.Dimension_startlocation.y, self.Dimension_startlocation.z, self.Dimension_endanglelocation.x, self.Dimension_endanglelocation.y, self.Dimension_endanglelocation.z)
- a = ablength(self.Dimension_endanglelocation.x, self.Dimension_endanglelocation.y, self.Dimension_endanglelocation.z, self.Dimension_endlocation.x, self.Dimension_endlocation.y, self.Dimension_endlocation.z)
- if b != 0 and c != 0 :
- self.Dimension_angle = degrees(acos((b**2 + c**2 - a**2)/(2*b*c)))
- else:
- self.Dimension_angle = 0
+ if self.Angle_Type == 'A':
+ c = ablength(self.Dimension_startloc
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-extensions-cvs
mailing list