Rebar Addon for FreeCAD
Public Member Functions | Public Attributes | List of all members
StraightRebar._StraightRebarTaskPanel Class Reference
Collaboration diagram for StraightRebar._StraightRebarTaskPanel:
Collaboration graph

Public Member Functions

def __init__ (self, Rebar=None)
 
def changeOrientation (self)
 
def changeCoverAlong (self)
 
def getStandardButtons (self)
 
def clicked (self, button)
 
def accept (self, signal=None)
 
def amount_radio_clicked (self)
 
def spacing_radio_clicked (self)
 

Public Attributes

 CustomSpacing
 
 SelectedObj
 
 FaceName
 
 form
 
 Rebar
 

Detailed Description

Definition at line 75 of file StraightRebar.py.

Constructor & Destructor Documentation

def StraightRebar._StraightRebarTaskPanel.__init__ (   self,
  Rebar = None 
)

Definition at line 76 of file StraightRebar.py.

76  def __init__(self, Rebar = None):
77  self.CustomSpacing = None
78  if not Rebar:
79  selected_obj = FreeCADGui.Selection.getSelectionEx()[0]
80  self.SelectedObj = selected_obj.Object
81  self.FaceName = selected_obj.SubElementNames[0]
82  else:
83  self.FaceName = Rebar.Base.Support[0][1][0]
84  self.SelectedObj = Rebar.Base.Support[0][0]
85  self.form = FreeCADGui.PySideUic.loadUi(os.path.splitext(__file__)[0] + ".ui")
86  self.form.setWindowTitle(QtGui.QApplication.translate("RebarAddon", "Straight Rebar", None))
87  self.form.orientation.addItems(["Horizontal", "Vertical"])
88  self.form.coverAlong.addItems(["Bottom Side", "Top Side"])
89  self.form.amount_radio.clicked.connect(self.amount_radio_clicked)
90  self.form.spacing_radio.clicked.connect(self.spacing_radio_clicked)
91  self.form.customSpacing.clicked.connect(lambda: runRebarDistribution(self))
92  self.form.removeCustomSpacing.clicked.connect(lambda: removeRebarDistribution(self))
93  self.form.PickSelectedFace.setCheckable(True)
94  self.form.PickSelectedFace.toggle()
95  self.form.PickSelectedFace.clicked.connect(lambda: getSelectedFace(self))
96  self.form.image.setPixmap(QtGui.QPixmap(os.path.split(os.path.abspath(__file__))[0] + "/icons/StraightRebarH.svg"))
97  self.form.orientation.currentIndexChanged.connect(self.changeOrientation)
98  self.form.coverAlong.currentIndexChanged.connect(self.changeCoverAlong)
99  self.form.toolButton.setIcon(self.form.toolButton.style().standardIcon(QtGui.QStyle.SP_DialogHelpButton))
100  self.form.toolButton.clicked.connect(lambda: showPopUpImageDialog(os.path.split(os.path.abspath(__file__))[0] + "/icons/StraightRebarDetailed.svg"))
101  self.Rebar = Rebar
102 
def getSelectedFace(self)
Definition: Rebarfunc.py:278
def runRebarDistribution(self)
def showPopUpImageDialog(img)
Definition: PopUpImage.py:43
def removeRebarDistribution(self)

Member Function Documentation

def StraightRebar._StraightRebarTaskPanel.accept (   self,
  signal = None 
)

Definition at line 136 of file StraightRebar.py.

136  def accept(self, signal = None):
137  f_cover = self.form.frontCover.text()
138  f_cover = FreeCAD.Units.Quantity(f_cover).Value
139  cover = self.form.bottomCover.text()
140  cover = FreeCAD.Units.Quantity(cover).Value
141  lb_cover = self.form.l_sideCover.text()
142  lb_cover = FreeCAD.Units.Quantity(lb_cover).Value
143  rt_cover = self.form.r_sideCover.text()
144  rt_cover = FreeCAD.Units.Quantity(rt_cover).Value
145  orientation = self.form.orientation.currentText()
146  coverAlong = self.form.coverAlong.currentText()
147  diameter = self.form.diameter.text()
148  diameter = FreeCAD.Units.Quantity(diameter).Value
149  amount_check = self.form.amount_radio.isChecked()
150  spacing_check = self.form.spacing_radio.isChecked()
151  if not self.Rebar:
152  if amount_check:
153  amount = self.form.amount.value()
154  rebar = makeStraightRebar(f_cover, (coverAlong, cover), rt_cover, lb_cover, diameter, True, amount, orientation, self.SelectedObj, self.FaceName)
155  elif spacing_check:
156  spacing = self.form.spacing.text()
157  spacing = FreeCAD.Units.Quantity(spacing).Value
158  rebar = makeStraightRebar(f_cover, (coverAlong, cover), rt_cover, lb_cover, diameter, False, spacing, orientation, self.SelectedObj, self.FaceName)
159  else:
160  if amount_check:
161  amount = self.form.amount.value()
162  rebar = editStraightRebar(self.Rebar, f_cover, (coverAlong, cover), rt_cover, lb_cover, diameter, True, amount, orientation, self.SelectedObj, self.FaceName)
163  elif spacing_check:
164  spacing = self.form.spacing.text()
165  spacing = FreeCAD.Units.Quantity(spacing).Value
166  rebar = editStraightRebar(self.Rebar, f_cover, (coverAlong, cover), rt_cover, lb_cover, diameter, False, spacing, orientation, self.SelectedObj, self.FaceName)
167  if self.CustomSpacing:
168  rebar.CustomSpacing = self.CustomSpacing
169  FreeCAD.ActiveDocument.recompute()
170  self.Rebar = rebar
171  if signal == int(QtGui.QDialogButtonBox.Apply):
172  pass
173  else:
174  FreeCADGui.Control.closeDialog(self)
175 
def editStraightRebar(Rebar, f_cover, coverAlong, rt_cover, lb_cover, diameter, amount_spacing_check, amount_spacing_value, orientation, structure=None, facename=None)
def makeStraightRebar(f_cover, coverAlong, rt_cover, lb_cover, diameter, amount_spacing_check, amount_spacing_value, orientation="Horizontal", structure=None, facename=None)

Here is the call graph for this function:

Here is the caller graph for this function:

def StraightRebar._StraightRebarTaskPanel.amount_radio_clicked (   self)

Definition at line 176 of file StraightRebar.py.

177  self.form.spacing.setEnabled(False)
178  self.form.amount.setEnabled(True)
179 
def StraightRebar._StraightRebarTaskPanel.changeCoverAlong (   self)

Definition at line 118 of file StraightRebar.py.

118  def changeCoverAlong(self):
119  coverAlong = self.form.coverAlong.currentText()
120  if coverAlong == "Bottom Side":
121  self.form.bottomCoverLabel.setText("Bottom Cover")
122  elif coverAlong == "Top Side":
123  self.form.bottomCoverLabel.setText("Top Cover")
124  elif coverAlong == "Right Side":
125  self.form.bottomCoverLabel.setText("Right Cover")
126  else:
127  self.form.bottomCoverLabel.setText("Left Cover")
128 
def StraightRebar._StraightRebarTaskPanel.changeOrientation (   self)

Definition at line 103 of file StraightRebar.py.

103  def changeOrientation(self):
104  orientation = self.form.orientation.currentText()
105  if orientation == "Horizontal":
106  self.form.image.setPixmap(QtGui.QPixmap(os.path.split(os.path.abspath(__file__))[0] + "/icons/StraightRebarH.svg"))
107  self.form.r_sideCoverLabel.setText("Right Side Cover")
108  self.form.l_sideCoverLabel.setText("Left Side Cover")
109  self.form.coverAlong.clear()
110  self.form.coverAlong.addItems(["Bottom Side", "Top Side"])
111  else:
112  self.form.image.setPixmap(QtGui.QPixmap(os.path.split(os.path.abspath(__file__))[0] + "/icons/StraightRebarV.svg"))
113  self.form.r_sideCoverLabel.setText("Top Side Cover")
114  self.form.l_sideCoverLabel.setText("Bottom Side Cover")
115  self.form.coverAlong.clear()
116  self.form.coverAlong.addItems(["Right Side", "Left Side"])
117 
def StraightRebar._StraightRebarTaskPanel.clicked (   self,
  button 
)

Definition at line 132 of file StraightRebar.py.

132  def clicked(self, button):
133  if button == int(QtGui.QDialogButtonBox.Apply):
134  self.accept(button)
135 

Here is the call graph for this function:

def StraightRebar._StraightRebarTaskPanel.getStandardButtons (   self)

Definition at line 129 of file StraightRebar.py.

130  return int(QtGui.QDialogButtonBox.Ok) | int(QtGui.QDialogButtonBox.Apply) | int(QtGui.QDialogButtonBox.Cancel)
131 
def StraightRebar._StraightRebarTaskPanel.spacing_radio_clicked (   self)

Definition at line 180 of file StraightRebar.py.

181  self.form.amount.setEnabled(False)
182  self.form.spacing.setEnabled(True)
183 
184 

Member Data Documentation

StraightRebar._StraightRebarTaskPanel.CustomSpacing

Definition at line 77 of file StraightRebar.py.

StraightRebar._StraightRebarTaskPanel.FaceName

Definition at line 81 of file StraightRebar.py.

StraightRebar._StraightRebarTaskPanel.form

Definition at line 85 of file StraightRebar.py.

StraightRebar._StraightRebarTaskPanel.Rebar

Definition at line 101 of file StraightRebar.py.

StraightRebar._StraightRebarTaskPanel.SelectedObj

Definition at line 80 of file StraightRebar.py.


The documentation for this class was generated from the following file: