Skip to content
Permalink
Browse files

FIXME: Stirrup geometery

  • Loading branch information...
amrit3701 committed Jul 19, 2017
1 parent 871aaff commit 122d23d147f21fbb8b84fec23b97f9dbe9346910
Showing with 29 additions and 19 deletions.
  1. +5 −1 Rebarfunc.py
  2. +24 −18 Stirrup.py
@@ -284,6 +284,10 @@ def showWarning(message):
message for the user."""
msg = QtGui.QMessageBox()
msg.setIcon(QtGui.QMessageBox.Warning)
msg.setText(message)
msg.setText(translate("RebarAddon", message))
msg.setStandardButtons(QtGui.QMessageBox.Ok)
msg.exec_()

# Qt tanslation handling
def translate(context, text, disambig=None):
return QtCore.QCoreApplication.translate(context, text, disambig)
@@ -46,68 +46,74 @@ def getpointsOfStirrup(FacePRM, s_cover, bentAngle, bentFactor, diameter, roundi
x1 = FacePRM[1][0]
y1 = FacePRM[1][1] - FacePRM[0][0] / 2 + s_cover
z1 = FacePRM[1][2] + FacePRM[0][1] / 2 - s_cover + tangent_part_length
x2 = x1 - diameter / 4
y2 = FacePRM[1][1] - FacePRM[0][0] / 2 + s_cover
z2 = FacePRM[1][2] - FacePRM[0][1] / 2 + s_cover
x3 = x2 - diameter / 4
y3 = FacePRM[1][1] + FacePRM[0][0] / 2 - s_cover
z3 = FacePRM[1][2] - FacePRM[0][1] / 2 + s_cover
x4 = x3 - diameter / 4
y4 = FacePRM[1][1] + FacePRM[0][0] / 2 - s_cover
z4 = FacePRM[1][2] + FacePRM[0][1] / 2 - s_cover
x5 = x4 - diameter / 4
y5 = FacePRM[1][1] - FacePRM[0][0] / 2 + s_cover - tangent_part_length
z5 = FacePRM[1][2] + FacePRM[0][1] / 2 - s_cover
x0 = x1
side_length = abs(y5 - y4) - tangent_part_length
normal_dis = (diameter * (side_length + tangent_part_length)) / side_length
x2 = x1 - normal_dis / 4
x3 = x2 - normal_dis / 4
x4 = x3 - normal_dis / 4
x5 = x4 - normal_dis / 4
x0 = x1 + normal_dis / 4
y0 = y1 + (tangent_length + bentFactor * diameter) * math.sin(math.radians(angle))
z0 = z1 - (tangent_length + bentFactor * diameter) * math.cos(math.radians(angle))
x6 = x5
x6 = x5 - normal_dis / 4
y6 = y5 + (tangent_length + bentFactor * diameter) * math.sin(math.radians(90 - angle))
z6 = z5 - (tangent_length + bentFactor * diameter) * math.cos(math.radians(90 - angle))
elif round(facenormal[1]) in {1,-1}:
x1 = FacePRM[1][0] - FacePRM[0][0] / 2 + s_cover
y1 = FacePRM[1][1]
z1 = FacePRM[1][2] + FacePRM[0][1] / 2 - s_cover + tangent_part_length
x2 = FacePRM[1][0] - FacePRM[0][0] / 2 + s_cover
y2 = y1 - diameter / 4
z2 = FacePRM[1][2] - FacePRM[0][1] / 2 + s_cover
x3 = FacePRM[1][0] + FacePRM[0][0] / 2 - s_cover
y3 = y2 - diameter / 4
z3 = FacePRM[1][2] - FacePRM[0][1] / 2 + s_cover
x4 = FacePRM[1][0] + FacePRM[0][0] / 2 - s_cover
y4 = y3 - diameter / 4
z4 = FacePRM[1][2] + FacePRM[0][1] / 2 - s_cover
x5 = FacePRM[1][0] - FacePRM[0][0] / 2 + s_cover - tangent_part_length
y5 = y4 - diameter / 4
z5 = FacePRM[1][2] + FacePRM[0][1] / 2 - s_cover
side_length = abs(x5 - x4) - tangent_part_length
normal_dis = (diameter * (side_length + tangent_part_length)) / side_length
y2 = y1 - normal_dis / 4
y3 = y2 - normal_dis / 4
y4 = y3 - normal_dis / 4
y5 = y4 - normal_dis / 4
y0 = y1 + normal_dis / 4
x0 = x1 + (tangent_length + bentFactor * diameter) * math.sin(math.radians(angle))
y0 = y1
z0 = z1 - (tangent_length + bentFactor * diameter) * math.cos(math.radians(angle))
x6 = x5 + (tangent_length + bentFactor * diameter) * math.sin(math.radians(90 - angle))
y6 = y5
y6 = y5 - normal_dis / 4
z6 = z5 - (tangent_length + bentFactor * diameter) * math.cos(math.radians(90 - angle))
elif round(facenormal[2]) in {1,-1}:
x1 = FacePRM[1][0] - FacePRM[0][0] / 2 + s_cover
y1 = FacePRM[1][1] + FacePRM[0][1] / 2 - s_cover + tangent_part_length
z1 = FacePRM[1][2]
x2 = FacePRM[1][0] - FacePRM[0][0] / 2 + s_cover
y2 = FacePRM[1][1] - FacePRM[0][1] / 2 + s_cover
z2 = z1 - diameter / 4
x3 = FacePRM[1][0] + FacePRM[0][0] / 2 - s_cover
y3 = FacePRM[1][1] - FacePRM[0][1] / 2 + s_cover
z3 = z2 - diameter / 4
x4 = FacePRM[1][0] + FacePRM[0][0] / 2 - s_cover
y4 = FacePRM[1][1] + FacePRM[0][1] / 2 - s_cover
z4 = z3 - diameter / 4
x5 = FacePRM[1][0] - FacePRM[0][0] / 2 + s_cover - tangent_part_length
y5 = FacePRM[1][1] + FacePRM[0][1] / 2 - s_cover
z5 = z4 - diameter / 4
side_length = abs(x5 - x4) - tangent_part_length
normal_dis = (diameter * (side_length + tangent_part_length)) / side_length
z2 = z1 - normal_dis / 4
z3 = z2 - normal_dis / 4
z4 = z3 - normal_dis / 4
z5 = z4 - normal_dis / 4
z0 = z1 + normal_dis / 4
x0 = x1 + (tangent_length + bentFactor * diameter) * math.sin(math.radians(angle))
y0 = y1 - (tangent_length + bentFactor * diameter) * math.cos(math.radians(angle))
z0 = z1
x6 = x5 + (tangent_length + bentFactor * diameter) * math.sin(math.radians(90 - angle))
y6 = y5 - (tangent_length + bentFactor * diameter) * math.cos(math.radians(90 - angle))
z6 = z5
z6 = z5 - normal_dis / 4
return [FreeCAD.Vector(x0, y0, z0), FreeCAD.Vector(x1, y1, z1),\
FreeCAD.Vector(x2, y2, z2), FreeCAD.Vector(x3, y3, z3),\
FreeCAD.Vector(x4, y4, z4), FreeCAD.Vector(x5, y5, z5),\

0 comments on commit 122d23d

Please sign in to comment.
You can’t perform that action at this time.