Release of 2015-02-28 :
-fix of problem with a line center point which isn't in the middle because of fillet
This commit is contained in:
parent
dbc3d6d60b
commit
b177cdf719
|
@ -51,7 +51,7 @@ if not sys.path.__contains__("/usr/lib/freecad/lib"):
|
||||||
|
|
||||||
import WFGui_2015 as WFGui
|
import WFGui_2015 as WFGui
|
||||||
global myRelease
|
global myRelease
|
||||||
myRelease = "2105_02_26"
|
myRelease = "2105_02_28"
|
||||||
|
|
||||||
import os.path
|
import os.path
|
||||||
import math
|
import math
|
||||||
|
@ -451,6 +451,7 @@ def meanObjects(objs,info=0):
|
||||||
|
|
||||||
return mean
|
return mean
|
||||||
|
|
||||||
|
|
||||||
def minMaxObjectsLimits(objs,info=0):
|
def minMaxObjectsLimits(objs,info=0):
|
||||||
""" Return the min and max limits along the 3 Axis for all selected objects.
|
""" Return the min and max limits along the 3 Axis for all selected objects.
|
||||||
"""
|
"""
|
||||||
|
@ -621,14 +622,19 @@ def centerObjectsPoint(objs,info=0):
|
||||||
print_point(center,"Center of all objects selected is : ")
|
print_point(center,"Center of all objects selected is : ")
|
||||||
return center
|
return center
|
||||||
|
|
||||||
|
|
||||||
def centerLinePoints(edge, index, number,info=0):
|
def centerLinePoints(edge, index, number,info=0):
|
||||||
""" Return the point at index/number of the Line.
|
""" Return the point at index/number of the Line.
|
||||||
"""
|
"""
|
||||||
Vector_A = None
|
Vector_A = edge.Vertexes[0].Point
|
||||||
distance = edge.Length / 2
|
Vector_B = edge.Vertexes[-1].Point
|
||||||
|
distance = Vector_B.sub(Vector_A).Length / 2
|
||||||
|
|
||||||
|
#distance = edge.Length / 2
|
||||||
if number != 0:
|
if number != 0:
|
||||||
distance = index * (edge.Length / number)
|
distance = index * (edge.Length / number)
|
||||||
Vector_A = edge.valueAt( distance )
|
#Vector_A = edge.valueAt( distance )
|
||||||
|
Vector_A = Vector_A.add(Vector_B.sub(Vector_A).normalize().multiply( distance ))
|
||||||
if info != 0:
|
if info != 0:
|
||||||
print_point(Vector_A,"Point of line selected is : ")
|
print_point(Vector_A,"Point of line selected is : ")
|
||||||
return Vector_A
|
return Vector_A
|
||||||
|
@ -638,8 +644,14 @@ def centerLinePoint(edge,info=0):
|
||||||
""" Return the center point of the Line.
|
""" Return the center point of the Line.
|
||||||
"""
|
"""
|
||||||
center = None
|
center = None
|
||||||
Vector_A=edge.valueAt( 0.0 )
|
#VVector_A=edge.valueAt( 0.0 )
|
||||||
Vector_B=edge.valueAt( edge.Length )
|
Vector_A = edge.Vertexes[0].Point
|
||||||
|
if info != 0:
|
||||||
|
print_point(Vector_A,"Origin of line selected is : ")
|
||||||
|
#Vector_B=edge.valueAt( edge.Length )
|
||||||
|
Vector_B = edge.Vertexes[-1].Point
|
||||||
|
if info != 0:
|
||||||
|
print_point(Vector_B,"End of line selected is : ")
|
||||||
Vector_MidPoint = Vector_B + Vector_A
|
Vector_MidPoint = Vector_B + Vector_A
|
||||||
center = Vector_MidPoint.multiply(0.5)
|
center = Vector_MidPoint.multiply(0.5)
|
||||||
if info != 0:
|
if info != 0:
|
||||||
|
@ -1699,8 +1711,8 @@ def plot_extremaLinePoint():
|
||||||
if msg != 0:
|
if msg != 0:
|
||||||
print_msg(str(Edge_List[i]))
|
print_msg(str(Edge_List[i]))
|
||||||
edge = Edge_List[i]
|
edge = Edge_List[i]
|
||||||
Vector_A = edge.valueAt( 0.0 )
|
Vector_A = edge.Vertexes[0].Point
|
||||||
Vector_B = edge.valueAt( edge.Length )
|
Vector_B = edge.Vertexes[-1].Point
|
||||||
if msg != 0:
|
if msg != 0:
|
||||||
print_point(Vector_A, msg="First Point : ")
|
print_point(Vector_A, msg="First Point : ")
|
||||||
print_point(Vector_B, msg="Last Point : ")
|
print_point(Vector_B, msg="Last Point : ")
|
||||||
|
@ -1767,7 +1779,7 @@ def plot_centerLinePoint():
|
||||||
if m_numberLinePart == 2:
|
if m_numberLinePart == 2:
|
||||||
if msg != 0:
|
if msg != 0:
|
||||||
print_msg(str(Edge_List[i]))
|
print_msg(str(Edge_List[i]))
|
||||||
Vector_Line_Center = centerLinePoint(Edge_List[i],info=1)
|
Vector_Line_Center = centerLinePoint(Edge_List[i],info=msg)
|
||||||
if msg != 0:
|
if msg != 0:
|
||||||
print_point(Vector_Line_Center, msg="MidPoint : ")
|
print_point(Vector_Line_Center, msg="MidPoint : ")
|
||||||
|
|
||||||
|
@ -1775,7 +1787,7 @@ def plot_centerLinePoint():
|
||||||
print_point(Vector_Line_Center,str(Center_User_Name) + result_msg + " at :")
|
print_point(Vector_Line_Center,str(Center_User_Name) + result_msg + " at :")
|
||||||
else:
|
else:
|
||||||
for j in range( 1, m_numberLinePart ):
|
for j in range( 1, m_numberLinePart ):
|
||||||
Vector_Line_Center = centerLinePoints(Edge_List[i], j , m_numberLinePart, info=1)
|
Vector_Line_Center = centerLinePoints(Edge_List[i], j , m_numberLinePart, info=msg)
|
||||||
Center_User_Name = plot_point(Vector_Line_Center, part, name)
|
Center_User_Name = plot_point(Vector_Line_Center, part, name)
|
||||||
print_point(Vector_Line_Center,str(Center_User_Name) + result_msg + " at :")
|
print_point(Vector_Line_Center,str(Center_User_Name) + result_msg + " at :")
|
||||||
else:
|
else:
|
||||||
|
@ -2677,12 +2689,17 @@ def extensionLinePointAxis(value):
|
||||||
printError_msg("Extension must be valid number !")
|
printError_msg("Extension must be valid number !")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def plot_linePointAxis():
|
def plot_linePointAxis():
|
||||||
""" Plot an Axis perpendicular to an other axis and passing trougth a Point.
|
"""
|
||||||
|
Plot an Axis Perpendicular to an Axis and crossing a Point
|
||||||
|
-Select one Axis and one Point NOT on the previous Axis.
|
||||||
"""
|
"""
|
||||||
msg=0
|
msg=0
|
||||||
createFolders('WorkAxis')
|
createFolders('WorkAxis')
|
||||||
error_msg = "Unable to create Perpendicular Axis : \nSelect one Point and one Line only !"
|
error_msg = "Unable to create Perpendicular Axis : \n " + \
|
||||||
|
"Select one Point and one Line only !\n" + \
|
||||||
|
"The Point is NOT on the Line!"
|
||||||
result_msg = " : Perpendicular Axis created !"
|
result_msg = " : Perpendicular Axis created !"
|
||||||
name = "Perpendicular Line"
|
name = "Perpendicular Line"
|
||||||
part = "Part::Feature"
|
part = "Part::Feature"
|
||||||
|
@ -2729,12 +2746,14 @@ def plot_linePointAxis():
|
||||||
|
|
||||||
|
|
||||||
def plot_pointLineAxis():
|
def plot_pointLineAxis():
|
||||||
""" Plot an Axis paralell to an other axis and passing trougth a Point.
|
"""
|
||||||
|
Plot an Axis Parallel to an Axis and crossing a Point.
|
||||||
|
-Select one Axis and one Point NOT on the previous Axis.
|
||||||
"""
|
"""
|
||||||
msg=0
|
msg=0
|
||||||
createFolders('WorkAxis')
|
createFolders('WorkAxis')
|
||||||
error_msg = "Unable to create Parallel Axis : \nSelect one Point and one Line only !"
|
error_msg = "Unable to create Parallel Axis : \nSelect one Point and one Line only !"
|
||||||
result_msg = " : Paralell Axis created !"
|
result_msg = " : Parallel Axis created !"
|
||||||
name = "Parallel Line"
|
name = "Parallel Line"
|
||||||
part = "Part::Feature"
|
part = "Part::Feature"
|
||||||
global m_attach_point
|
global m_attach_point
|
||||||
|
@ -4926,15 +4945,15 @@ def object_parallel():
|
||||||
# Javier Martinez Garcia 2015
|
# Javier Martinez Garcia 2015
|
||||||
SelObj = Gui.Selection.getSelectionEx()
|
SelObj = Gui.Selection.getSelectionEx()
|
||||||
try:
|
try:
|
||||||
NormalA = SelObj[0].SubObjects[0].normalAt(0,0)
|
NormalA = SelObj[0].SubObjects[0].normalAt(0,0)
|
||||||
NormalB = SelObj[1].SubObjects[0].normalAt(0,0)
|
NormalB = SelObj[1].SubObjects[0].normalAt(0,0)
|
||||||
if NormalA.cross(NormalB).Length == 0.0:
|
if NormalA.cross(NormalB).Length == 0.0:
|
||||||
print_gui_msg("\nFaces are parallel\n")
|
print_gui_msg("\nFaces are parallel\n")
|
||||||
else:
|
else:
|
||||||
print_gui_msg("\nNon parallel faces\n")
|
print_gui_msg("\nNon parallel faces\n")
|
||||||
|
|
||||||
except:
|
except:
|
||||||
printError_msg("\nWrong selection!\n")
|
printError_msg("\nWrong selection!\n")
|
||||||
|
|
||||||
|
|
||||||
def object_perpendicular():
|
def object_perpendicular():
|
||||||
|
@ -4943,15 +4962,15 @@ def object_perpendicular():
|
||||||
# Javier Martinez Garcia 2015
|
# Javier Martinez Garcia 2015
|
||||||
SelObj = Gui.Selection.getSelectionEx()
|
SelObj = Gui.Selection.getSelectionEx()
|
||||||
try:
|
try:
|
||||||
NormalA = SelObj[0].SubObjects[0].normalAt(0,0)
|
NormalA = SelObj[0].SubObjects[0].normalAt(0,0)
|
||||||
NormalB = SelObj[1].SubObjects[0].normalAt(0,0)
|
NormalB = SelObj[1].SubObjects[0].normalAt(0,0)
|
||||||
if NormalA.dot(NormalB) == 0.0:
|
if NormalA.dot(NormalB) == 0.0:
|
||||||
print_gui_msg("\nFaces are perpendicular\n")
|
print_gui_msg("\nFaces are perpendicular\n")
|
||||||
else:
|
else:
|
||||||
print_gui_msg("\nNon perpendicular faces\n")
|
print_gui_msg("\nNon perpendicular faces\n")
|
||||||
|
|
||||||
except:
|
except:
|
||||||
printError_msg("\nWrong selection!\n")
|
printError_msg("\nWrong selection!\n")
|
||||||
|
|
||||||
|
|
||||||
def object_coplanar():
|
def object_coplanar():
|
||||||
|
@ -5085,6 +5104,7 @@ class WorkFeatureTab():
|
||||||
"button_isCoplanar" : "object_coplanar",
|
"button_isCoplanar" : "object_coplanar",
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
self.connections_for_text_changed = {
|
self.connections_for_text_changed = {
|
||||||
"distance_point_on_line" : "distanceLinePoint",
|
"distance_point_on_line" : "distanceLinePoint",
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user