Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add UI for making Slab reinforcement #158

2 changes: 1 addition & 1 deletion BentShapeRebar.py
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ def makeBentShapeRebar(
rounding,
amount_spacing_check,
amount_spacing_value,
orientation="Bottom Left",
orientation="Bottom",
structure=None,
facename=None,
):
Expand Down
2 changes: 1 addition & 1 deletion RebarData.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
import enum


class RebarTypes(enum.Enum):
class RebarTypes(str, enum.Enum):
"""A primitive rebar types enumeration object."""

straight = "StraightRebar"
Expand Down
32 changes: 32 additions & 0 deletions RebarTools.py
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,35 @@ def Activated():
MainBeamReinforcement.CommandBeamReinforcement()


class SlabReinforcementTool:
@staticmethod
def GetResources():
return {
"Pixmap": str(
Path(__file__).parent / "icons" / "SlabReinforcement.png"
),
"MenuText": QT_TRANSLATE_NOOP(
"Reinforcement_SlabRebars", "Slab Reinforcement"
),
"ToolTip": QT_TRANSLATE_NOOP(
"Reinforcement_SlabRebars",
"Creates a Slab Reinforcement from the selected face of the "
"Structural element.",
),
}

@staticmethod
def IsActive():
return True if FreeCADGui.activeDocument() else False

@staticmethod
def Activated():
from SlabReinforcement import MainSlabReinforcement

# Call to CommandSlabReinforcement() function
MainSlabReinforcement.CommandSlabReinforcement()


class BillOfMaterialTool:
@staticmethod
def GetResources():
Expand Down Expand Up @@ -417,6 +446,7 @@ def updateLocale():
FreeCADGui.addCommand("Reinforcement_HelicalRebar", HelicalRebarTool())
FreeCADGui.addCommand("Reinforcement_ColumnRebars", ColumnReinforcementTool())
FreeCADGui.addCommand("Reinforcement_BeamRebars", BeamReinforcementTool())
FreeCADGui.addCommand("Reinforcement_SlabRebars", SlabReinforcementTool())
FreeCADGui.addCommand("Reinforcement_BillOfMaterial", BillOfMaterialTool())
FreeCADGui.addCommand("Reinforcement_BarShapeCutList", RebarShapeCutListTool())
FreeCADGui.addCommand(
Expand All @@ -437,6 +467,7 @@ def updateLocale():
"Reinforcement_HelicalRebar",
"Reinforcement_ColumnRebars",
"Reinforcement_BeamRebars",
"Reinforcement_SlabRebars",
]

# Initialize "Arch_Rebar" command
Expand All @@ -455,6 +486,7 @@ def updateLocale():
"Reinforcement_HelicalRebar",
"Reinforcement_ColumnRebars",
"Reinforcement_BeamRebars",
"Reinforcement_SlabRebars",
"Arch_Rebar",
"Reinforcement_BillOfMaterial",
"Reinforcement_BarShapeCutList",
Expand Down
6 changes: 3 additions & 3 deletions Rebarfunc.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@


def getEdgesAngle(edge1, edge2):
""" getEdgesAngle(edge1, edge2): returns a angle between two edges."""
"""getEdgesAngle(edge1, edge2): returns a angle between two edges."""
vec1 = vec(edge1)
vec2 = vec(edge2)
angle = vec1.getAngle(vec2)
Expand Down Expand Up @@ -73,7 +73,7 @@ def getBaseStructuralObject(obj):


def getBaseObject(obj):
""" getBaseObject(obj): This function will return last base object."""
"""getBaseObject(obj): This function will return last base object."""
if hasattr(obj, "Base"):
return getBaseObject(obj.Base)
else:
Expand Down Expand Up @@ -860,7 +860,7 @@ def translate(context, text, disambig=None):


def print_in_freecad_console(*msg):
""" Print given arguments on FreeCAD console."""
"""Print given arguments on FreeCAD console."""
s = ""
for m in msg:
s += str(m) + ", "
Expand Down