Skip to content
Permalink
Browse files

Implemented pick selected face in editDialog() function also

  • Loading branch information...
amrit3701 committed Jul 6, 2017
1 parent f2dd3c2 commit c19c7a91281ac07eba96106b753b237df4a8d515
Showing with 22 additions and 17 deletions.
  1. +2 −2 Rebarfunc.py
  2. +7 −4 Stirrup.py
  3. +7 −7 StraightRebar.py
  4. +6 −4 UShapeRebar.py
@@ -140,8 +140,8 @@ def getParametersOfFace(obj, selected_face, sketch=True):
normal = selected_face.normalAt(0,0)
normal = selected_face.Placement.Rotation.inverted().multVec(normal)
center_of_mass = selected_face.CenterOfMass
if not obj.Armatures:
center_of_mass = center_of_mass.sub(getBaseStructuralObject(obj).Placement.Base)
#if not obj.Armatures:
center_of_mass = center_of_mass.sub(getBaseStructuralObject(obj).Placement.Base)
# Set length and width of user selected face of structural element
flag = True
for i in range(len(normal)):
@@ -153,12 +153,12 @@ def accept(self):
if amount_check:
amount = self.form.amount.value()
editStirrup(self.Rebar, s_cover, f_cover, bentAngle, bentFactor,\
diameter, rounding, True, amount)
diameter, rounding, True, amount, self.SelectedObj, self.FaceName)
elif spacing_check:
spacing = self.form.spacing.text()
spacing = FreeCAD.Units.Quantity(spacing).Value
editStirrup(self.Rebar, s_cover, f_cover, bentAngle, bentFactor,\
diameter, rounding, False, spacing)
diameter, rounding, False, spacing, self.SelectedObj, self.FaceName)
FreeCADGui.Control.closeDialog(self)

def amount_radio_clicked(self):
@@ -230,8 +230,10 @@ def makeStirrup(s_cover, f_cover, bentAngle, bentFactor, diameter, rounding,\
FreeCAD.ActiveDocument.recompute()

def editStirrup(Rebar, s_cover, f_cover, bentAngle, bentFactor, diameter, rounding,\
amount_spacing_check, amount_spacing_value):
amount_spacing_check, amount_spacing_value, structure = None, facename = None):
sketch = Rebar.Base
if structure and facename:
sketch.Support = [(structure, facename)]
# Check if sketch support is empty.
if not sketch.Support:
showWarning("You have checked remove external geometry of base sketchs when needed.\nTo unchecked Edit->Preferences->Arch.")
@@ -250,6 +252,7 @@ def editStirrup(Rebar, s_cover, f_cover, bentAngle, bentFactor, diameter, roundi
points = getpointsOfStirrup(FacePRM, s_cover, bentAngle, bentFactor, diameter, rounding, FaceNormal)
Rebar.Base.Points = points
FreeCAD.ActiveDocument.recompute()
Rebar.Direction = FaceNormal.negative()
Rebar.OffsetStart = f_cover
Rebar.OffsetEnd = f_cover
Rebar.BentAngle = bentAngle
@@ -286,7 +289,7 @@ def editDialog(vobj):
obj.form.amount.setDisabled(True)
obj.form.spacing.setEnabled(True)
obj.form.spacing.setText(str(vobj.Object.TrueSpacing))
obj.form.PickSelectedFace.setVisible(False)
#obj.form.PickSelectedFace.setVisible(False)
FreeCADGui.Control.showDialog(obj)

def CommandStirrup():
@@ -82,11 +82,11 @@ def accept(self):
else:
if amount_check:
amount = self.form.amount.value()
editStraightRebar(self.Rebar, f_cover, b_cover, s_cover, diameter, True, amount)
editStraightRebar(self.Rebar, f_cover, b_cover, s_cover, diameter, True, amount, self.SelectedObj, self.FaceName)
elif spacing_check:
spacing = self.form.spacing.text()
spacing = FreeCAD.Units.Quantity(spacing).Value
editStraightRebar(self.Rebar, f_cover, b_cover, s_cover, diameter, False, spacing)
editStraightRebar(self.Rebar, f_cover, b_cover, s_cover, diameter, False, spacing, self.SelectedObj, self.FaceName)
FreeCADGui.Control.closeDialog(self)

def amount_radio_clicked(self):
@@ -145,15 +145,15 @@ def makeStraightRebar(f_cover, b_cover, s_cover, diameter, amount_spacing_check,
rebar.TrueSpacing = amount_spacing_value
FreeCAD.ActiveDocument.recompute()

def editStraightRebar(Rebar, f_cover, b_cover, s_cover, diameter, amount_spacing_check, amount_spacing_value):
def editStraightRebar(Rebar, f_cover, b_cover, s_cover, diameter, amount_spacing_check, amount_spacing_value, structure = None, facename = None):
sketch = Rebar.Base
if structure and facename:
sketch.Support = [(structure, facename)]
FreeCAD.ActiveDocument.recompute()
# Check if sketch support is empty.
if not sketch.Support:
showWarning("You have checked remove external geometry of base sketchs when needed.\nTo unchecked Edit->Preferences->Arch.")
return
#if structure and facename:
# sketch.Support = [(structure, facename)]
# FreeCAD.ActiveDocument.recompute()
# Assigned values
facename = sketch.Support[0][1][0]
structure = sketch.Support[0][0]
@@ -199,7 +199,7 @@ def editDialog(vobj):
obj.form.amount.setDisabled(True)
obj.form.spacing.setEnabled(True)
obj.form.spacing.setText(str(vobj.Object.TrueSpacing))
obj.form.PickSelectedFace.setVisible(False)
#obj.form.PickSelectedFace.setVisible(False)
FreeCADGui.Control.showDialog(obj)

def CommandStraightRebar():
@@ -88,11 +88,11 @@ def accept(self):
else:
if amount_check:
amount = self.form.amount.value()
editUShapeRebar(self.Rebar, f_cover, b_cover, s_cover, diameter, t_cover, rounding, True, amount)
editUShapeRebar(self.Rebar, f_cover, b_cover, s_cover, diameter, t_cover, rounding, True, amount, self.SelectedObj, self.FaceName)
elif spacing_check:
spacing = self.form.spacing.text()
spacing = FreeCAD.Units.Quantity(spacing).Value
editUShapeRebar(self.Rebar, f_cover, b_cover, s_cover, diameter, t_cover, rounding, False, spacing)
editUShapeRebar(self.Rebar, f_cover, b_cover, s_cover, diameter, t_cover, rounding, False, spacing, self.SelectedObj, self.FaceName)
FreeCADGui.Control.closeDialog(self)

def amount_radio_clicked(self):
@@ -159,8 +159,10 @@ def makeUShapeRebar(f_cover, b_cover, s_cover, diameter, t_cover, rounding, amou
rebar.TrueSpacing = amount_spacing_value
FreeCAD.ActiveDocument.recompute()

def editUShapeRebar(Rebar, f_cover, b_cover, s_cover, diameter, t_cover, rounding, amount_spacing_check, amount_spacing_value):
def editUShapeRebar(Rebar, f_cover, b_cover, s_cover, diameter, t_cover, rounding, amount_spacing_check, amount_spacing_value, structure = None, facename = None):
sketch = Rebar.Base
if structure and facename:
sketch.Support = [(structure, facename)]
# Check if sketch support is empty.
if not sketch.Support:
showWarning("You have checked remove external geometry of base sketchs when needed.\nTo unchecked Edit->Preferences->Arch.")
@@ -218,7 +220,7 @@ def editDialog(vobj):
obj.form.amount.setDisabled(True)
obj.form.spacing.setEnabled(True)
obj.form.spacing.setText(str(vobj.Object.TrueSpacing))
obj.form.PickSelectedFace.setVisible(False)
#obj.form.PickSelectedFace.setVisible(False)
FreeCADGui.Control.showDialog(obj)

def CommandUShapeRebar():

0 comments on commit c19c7a9

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