185 def makeStraightRebar(f_cover, coverAlong, rt_cover, lb_cover, diameter, amount_spacing_check, amount_spacing_value, orientation = "Horizontal", structure = None, facename = None):
186 """ Adds the straight reinforcement bar to the selected structural object. 188 Case I: When orientation of straight rebar is 'Horizontal': 189 makeStraightRebar(FrontCover, CoverAlong, RightCover, LeftCover, Diameter, AmountSpacingCheck, AmountSpacingValue, Orientation = "Horizontal", 191 Note: Type of CoverAlong argument is a tuple. Syntax: (<Along>, <Value>). Here we have horizontal orientation so we can pass Top Side 192 and Bottom Side to <Along> arguments. 193 For eg. ("Top Side", 20) and ("Bottom Side", 20) 195 Case II: When orientation of straight rebar is 'Vertical': 196 makeStraightRebar(FrontCover, CoverAlong, TopCover, BottomCover, Diameter, AmountSpacingCheck, AmountSpacingValue, Orientation = "Horizontal", 198 Note: Type of CoverAlong argument is a tuple. Syntax: (<Along>, <Value>). Here we have vertical orientation so we can pass Left Side 199 and Right Side to <Along> arguments. 200 For eg. ("Left Side", 20) and ("Right Side", 20) 202 if not structure
and not facename:
203 selected_obj = FreeCADGui.Selection.getSelectionEx()[0]
204 structure = selected_obj.Object
205 facename = selected_obj.SubElementNames[0]
210 FreeCAD.Console.PrintError(
"Cannot identified shape or from which base object sturctural element is derived\n")
216 sketch = FreeCAD.activeDocument().addObject(
'Sketcher::SketchObject',
'Sketch')
217 sketch.MapMode =
"FlatFace" 218 sketch.Support = [(structure, facename)]
219 FreeCAD.ActiveDocument.recompute()
220 sketch.addGeometry(Part.LineSegment(points[0], points[1]),
False)
221 if amount_spacing_check:
222 rebar = Arch.makeRebar(structure, sketch, diameter, amount_spacing_value, f_cover)
223 FreeCAD.ActiveDocument.recompute()
225 size = (ArchCommands.projectToVector(structure.Shape.copy(), face.normalAt(0, 0))).Length
226 rebar = Arch.makeRebar(structure, sketch, diameter, int((size - diameter) / amount_spacing_value), f_cover)
228 rebar.ViewObject.addProperty(
"App::PropertyString",
"RebarShape",
"RebarDialog", QT_TRANSLATE_NOOP(
"App::Property",
"Shape of rebar")).RebarShape =
"StraightRebar" 229 rebar.ViewObject.setEditorMode(
"RebarShape", 2)
230 rebar.addProperty(
"App::PropertyDistance",
"FrontCover",
"RebarDialog", QT_TRANSLATE_NOOP(
"App::Property",
"Front cover of rebar")).FrontCover = f_cover
231 rebar.setEditorMode(
"FrontCover", 2)
232 rebar.addProperty(
"App::PropertyDistance",
"RightTopCover",
"RebarDialog", QT_TRANSLATE_NOOP(
"App::Property",
"Right/Top Side cover of rebar")).RightTopCover = rt_cover
233 rebar.setEditorMode(
"RightTopCover", 2)
234 rebar.addProperty(
"App::PropertyDistance",
"LeftBottomCover",
"RebarDialog", QT_TRANSLATE_NOOP(
"App::Property",
"Left/Bottom Side cover of rebar")).LeftBottomCover = lb_cover
235 rebar.setEditorMode(
"LeftBottomCover", 2)
236 rebar.addProperty(
"App::PropertyString",
"CoverAlong",
"RebarDialog", QT_TRANSLATE_NOOP(
"App::Property",
"Cover along")).CoverAlong = coverAlong[0]
237 rebar.setEditorMode(
"CoverAlong", 2)
238 rebar.addProperty(
"App::PropertyDistance",
"Cover",
"RebarDialog", QT_TRANSLATE_NOOP(
"App::Property",
"Cover of rebar along user selected side")).Cover = coverAlong[1]
239 rebar.setEditorMode(
"Cover", 2)
240 rebar.addProperty(
"App::PropertyBool",
"AmountCheck",
"RebarDialog", QT_TRANSLATE_NOOP(
"App::Property",
"Amount radio button is checked")).AmountCheck
241 rebar.setEditorMode(
"AmountCheck", 2)
242 rebar.addProperty(
"App::PropertyDistance",
"TrueSpacing",
"RebarDialog", QT_TRANSLATE_NOOP(
"App::Property",
"Spacing between of rebars")).TrueSpacing = amount_spacing_value
243 rebar.setEditorMode(
"TrueSpacing", 2)
244 rebar.addProperty(
"App::PropertyString",
"Orientation",
"RebarDialog", QT_TRANSLATE_NOOP(
"App::Property",
"Shape of rebar")).Orientation = orientation
245 rebar.setEditorMode(
"Orientation", 2)
246 if amount_spacing_check:
247 rebar.AmountCheck =
True 249 rebar.AmountCheck =
False 250 rebar.TrueSpacing = amount_spacing_value
251 rebar.Label =
"StraightRebar" 252 FreeCAD.ActiveDocument.recompute()
def getpointsOfStraightRebar(FacePRM, rt_cover, lb_cover, coverAlong, orientation)
def getParametersOfFace(structure, facename, sketch=True)
def makeStraightRebar(f_cover, coverAlong, rt_cover, lb_cover, diameter, amount_spacing_check, amount_spacing_value, orientation="Horizontal", structure=None, facename=None)