Skip to content

Commit

Permalink
bug fix: spacing implemented in all rebar dialogs
Browse files Browse the repository at this point in the history
  • Loading branch information
amrit3701 committed Jul 11, 2017
1 parent bcc2ea7 commit 8a3672d
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
7 changes: 5 additions & 2 deletions Stirrup.py
Expand Up @@ -30,6 +30,7 @@
from PySide.QtCore import QT_TRANSLATE_NOOP
import FreeCAD
import FreeCADGui
import ArchCommands
import os
import sys
import math
Expand Down Expand Up @@ -196,8 +197,9 @@ def makeStirrup(s_cover, f_cover, bentAngle, bentFactor, diameter, rounding,\
if amount_spacing_check:
rebar = Arch.makeRebar(structure, line, diameter, amount_spacing_value, f_cover)
else:
size = (ArchCommands.projectToVector(structure.Shape.copy(), face.normalAt(0, 0))).Length
rebar = Arch.makeRebar(structure, line, diameter,\
int((StructurePRM[1] - diameter) / amount_spacing_value), f_cover)
int((size - diameter) / amount_spacing_value), f_cover)
rebar.Direction = FaceNormal.negative()
rebar.Rounding = rounding
# Adds properties to the rebar object
Expand Down Expand Up @@ -264,7 +266,8 @@ def editStirrup(Rebar, s_cover, f_cover, bentAngle, bentFactor, diameter, roundi
FreeCAD.ActiveDocument.recompute()
Rebar.AmountCheck = True
else:
Rebar.Amount = int((StructurePRM[1] - diameter) / amount_spacing_value)
size = (ArchCommands.projectToVector(structure.Shape.copy(), face.normalAt(0, 0))).Length
Rebar.Amount = int((size - diameter) / amount_spacing_value)
FreeCAD.ActiveDocument.recompute()
Rebar.AmountCheck = False
Rebar.FrontCover = f_cover
Expand Down
7 changes: 5 additions & 2 deletions StraightRebar.py
Expand Up @@ -30,6 +30,7 @@
from PySide.QtCore import QT_TRANSLATE_NOOP
import FreeCAD
import FreeCADGui
import ArchCommands
import os
import sys
import math
Expand Down Expand Up @@ -124,7 +125,8 @@ def makeStraightRebar(f_cover, b_cover, s_cover, diameter, amount_spacing_check,
rebar = Arch.makeRebar(structure, sketch, diameter, amount_spacing_value, f_cover)
FreeCAD.ActiveDocument.recompute()
else:
rebar = Arch.makeRebar(structure, sketch, diameter, int((StructurePRM[1] - diameter) / amount_spacing_value), f_cover)
size = (ArchCommands.projectToVector(structure.Shape.copy(), face.normalAt(0, 0))).Length
rebar = Arch.makeRebar(structure, sketch, diameter, int((size - diameter) / amount_spacing_value), f_cover)
# Adds properties to the rebar object
rebar.ViewObject.addProperty("App::PropertyString", "RebarShape", "RebarDialog", QT_TRANSLATE_NOOP("App::Property", "Shape of rebar")).RebarShape = "StraightRebar"
rebar.ViewObject.setEditorMode("RebarShape", 2)
Expand Down Expand Up @@ -174,7 +176,8 @@ def editStraightRebar(Rebar, f_cover, b_cover, s_cover, diameter, amount_spacing
FreeCAD.ActiveDocument.recompute()
Rebar.AmountCheck = True
else:
Rebar.Amount = int((StructurePRM[1] - diameter) / amount_spacing_value)
size = (ArchCommands.projectToVector(structure.Shape.copy(), face.normalAt(0, 0))).Length
Rebar.Amount = int((size - diameter) / amount_spacing_value)
FreeCAD.ActiveDocument.recompute()
Rebar.AmountCheck = False
Rebar.FrontCover = f_cover
Expand Down
7 changes: 5 additions & 2 deletions UShapeRebar.py
Expand Up @@ -30,6 +30,7 @@
from PySide.QtCore import QT_TRANSLATE_NOOP
import FreeCAD
import FreeCADGui
import ArchCommands
import os
import sys
import math
Expand Down Expand Up @@ -135,7 +136,8 @@ def makeUShapeRebar(f_cover, b_cover, s_cover, diameter, t_cover, rounding, amou
rebar = Arch.makeRebar(structure, sketch, diameter, amount_spacing_value, f_cover)
FreeCAD.ActiveDocument.recompute()
else:
rebar = Arch.makeRebar(structure, sketch, diameter, int((StructurePRM[1] - diameter) / amount_spacing_value), f_cover)
size = (ArchCommands.projectToVector(structure.Shape.copy(), face.normalAt(0, 0))).Length
rebar = Arch.makeRebar(structure, sketch, diameter, int((size - diameter) / amount_spacing_value), f_cover)
rebar.Rounding = rounding
# Adds properties to the rebar object
rebar.ViewObject.addProperty("App::PropertyString", "RebarShape", "RebarDialog", QT_TRANSLATE_NOOP("App::Property", "Shape of rebar")).RebarShape = "UShapeRebar"
Expand Down Expand Up @@ -192,7 +194,8 @@ def editUShapeRebar(Rebar, f_cover, b_cover, s_cover, diameter, t_cover, roundin
FreeCAD.ActiveDocument.recompute()
Rebar.AmountCheck = True
else:
Rebar.Amount = int((StructurePRM[1] - diameter) / amount_spacing_value)
size = (ArchCommands.projectToVector(structure.Shape.copy(), face.normalAt(0, 0))).Length
Rebar.Amount = int((size - diameter) / amount_spacing_value)
FreeCAD.ActiveDocument.recompute()
Rebar.AmountCheck = False
Rebar.FrontCover = f_cover
Expand Down

0 comments on commit 8a3672d

Please sign in to comment.