Skip to content
Permalink
Browse files

Made command of circular stirrup and remove bugs in circular stirrup

  • Loading branch information...
amrit3701 committed Aug 6, 2017
1 parent 32f883a commit d55dc9e61eb431956172794afeddd660eb5c1374
Showing with 34 additions and 14 deletions.
  1. +15 −11 CircularStirrup.py
  2. +19 −3 RebarTools.py
@@ -51,23 +51,27 @@ def getpointsOfCircularStirrup(FacePRM, s_cover, b_cover, t_cover, pitch, edges,
R = diameter / 2 - dx
R = FacePRM[0][0] / 2 - s_cover
points = []
if direction[2] == 1:
z = 0#b_cover
if direction[2] in {-1,1}:
z = pitch
l = 0
zz = - t_cover
if direction[2] == 1:
zz = FacePRM[1][2] - t_cover
elif direction[2] == -1:
zz = FacePRM[1][2] + b_cover
count = 0
print "abs ", abs(size - b_cover - t_cover)
while (z < abs(size - b_cover - t_cover)):

print "z: ", z
while (round(z) <= abs(size - b_cover - t_cover)):
for i in range(0, int(edges)):
iAngle = i * (2 * math.pi) / edges
x = R * math.cos(iAngle)
y = R * math.sin(iAngle)
x = FacePRM[1][0] + R * math.cos(iAngle)
y = FacePRM[1][1] + R * math.sin(iAngle)
points.append(FreeCAD.Vector(x, y, zz))
count += 1
zz -= dz
if direction[2] == 1:
zz -= dz
elif direction[2] == -1:
zz += dz
z += dz
#print "points: ", points
return points

class _CircularStirrupTaskPanel:
@@ -160,7 +164,7 @@ def editCircularStirrup(Rebar, s_cover, b_cover, diameter, t_cover, pitch, edges
face = structure.Shape.Faces[getFaceNumber(facename) - 1]
StructurePRM = getTrueParametersOfStructure(structure)
# Get parameters of the face where sketch of rebar is drawn
FacePRM = getParametersOfFace(structure, facename)
FacePRM = getParametersOfFace(structure, facename, False)
size = (ArchCommands.projectToVector(structure.Shape.copy(), face.normalAt(0, 0))).Length
normal = face.normalAt(0,0)
normal = face.Placement.Rotation.inverted().multVec(normal)
@@ -83,8 +83,6 @@ def Activated(self):
# Call to CommandUShaepRebar() function
LShapeRebar.CommandLShapeRebar()



class StirrupTool:

def GetResources(self):
@@ -121,12 +119,30 @@ def Activated(self):
# Call to CommandBentShaepRebar() function
BentShapeRebar.CommandBentShapeRebar()

class CircularStirrupTool:

def GetResources(self):
return {'Pixmap' : os.path.split(os.path.abspath(__file__))[0]+'/icons/dropdown_list/StirrupRebar.svg',
'MenuText': QT_TRANSLATE_NOOP("Arch_Rebar_Stirrup", "Circular Stirrup"),
'ToolTip' : QT_TRANSLATE_NOOP("Arch_Rebar_Stirrup", "Creates a Stirrup bar reinforcement from the selected face of the Structural element.")}

def IsActive(self):
if FreeCADGui.ActiveDocument:
return True
else:
return False

def Activated(self):
import CircularStirrup
# Call to CommandStirrup() function
CircularStirrup.CommandCircularStirrup()

FreeCADGui.addCommand('Arch_Rebar_Straight', StraightRebarTool())
FreeCADGui.addCommand('Arch_Rebar_UShape', UShapeRebarTool())
FreeCADGui.addCommand('Arch_Rebar_LShape', LShapeRebarTool())
FreeCADGui.addCommand('Arch_Rebar_Stirrup', StirrupTool())
FreeCADGui.addCommand('Arch_Rebar_BentShape', BentShapeRebarTool())
FreeCADGui.addCommand('Arch_Rebar_CircularStirrup', CircularStirrupTool())

# List of all rebar commands
RebarCommands = ["Arch_Rebar_Straight", "Arch_Rebar_UShape", "Arch_Rebar_LShape", "Arch_Rebar_Stirrup", "Arch_Rebar_BentShape"]
RebarCommands = ["Arch_Rebar_Straight", "Arch_Rebar_UShape", "Arch_Rebar_LShape", "Arch_Rebar_Stirrup", "Arch_Rebar_BentShape", "Arch_Rebar_CircularStirrup"]

0 comments on commit d55dc9e

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