def getSelectedFace(self): getSelectedFace(self) normal = facenormalDirection() if not round(normal.z) in {1, -1}: self.form.topCoverLabel.setText( translate("RebarAddon", "Left Cover")) self.form.bottomCoverLabel.setText( translate("RebarAddon", "Right Cover")) else: self.form.topCoverLabel.setText( translate("RebarAddon", "Top Cover")) self.form.bottomCoverLabel.setText( translate("RebarAddon", "Bottom Cover"))
def __init__(self, Rebar=None): if not Rebar: self.CustomSpacing = None selected_obj = FreeCADGui.Selection.getSelectionEx()[0] self.SelectedObj = selected_obj.Object self.FaceName = selected_obj.SubElementNames[0] else: self.CustomSpacing = Rebar.CustomSpacing self.FaceName = Rebar.Base.Support[0][1][0] self.SelectedObj = Rebar.Base.Support[0][0] self.form = FreeCADGui.PySideUic.loadUi( str(Path(__file__).with_suffix(".ui"))) self.form.setWindowTitle( QtGui.QApplication.translate("RebarAddon", "Stirrup Rebar", None)) self.form.bentAngle.addItems(["135", "90"]) self.form.amount_radio.clicked.connect(self.amount_radio_clicked) self.form.spacing_radio.clicked.connect(self.spacing_radio_clicked) self.form.image.setPixmap( QtGui.QPixmap(str(Path(__file__).parent / "icons" / "Stirrup.svg"))) self.form.customSpacing.clicked.connect( lambda: runRebarDistribution(self)) self.form.removeCustomSpacing.clicked.connect( lambda: removeRebarDistribution(self)) self.form.PickSelectedFace.clicked.connect( lambda: getSelectedFace(self)) # self.form.toolButton.setIcon( # self.form.toolButton.style().standardIcon( # QtGui.QStyle.SP_DialogHelpButton # ) # ) self.form.toolButton.clicked.connect(lambda: showPopUpImageDialog( str(Path(__file__).parent / "icons" / "StirrupDetailed.svg"))) self.Rebar = Rebar
def __init__(self, Rebar=None): if not Rebar: self.CustomSpacing = None selected_obj = FreeCADGui.Selection.getSelectionEx()[0] self.SelectedObj = selected_obj.Object self.FaceName = selected_obj.SubElementNames[0] else: self.CustomSpacing = Rebar.CustomSpacing self.FaceName = Rebar.Base.Support[0][1][0] self.SelectedObj = Rebar.Base.Support[0][0] self.form = FreeCADGui.PySideUic.loadUi( os.path.splitext(__file__)[0] + ".ui" ) self.form.setWindowTitle( QtGui.QApplication.translate("RebarAddon", "Straight Rebar", None) ) self.form.orientationValue.addItems(["Horizontal", "Vertical"]) self.form.coverAlong.addItems(["Bottom Side", "Top Side"]) self.form.amount_radio.clicked.connect(self.amount_radio_clicked) self.form.spacing_radio.clicked.connect(self.spacing_radio_clicked) self.form.customSpacing.clicked.connect( lambda: runRebarDistribution(self) ) self.form.removeCustomSpacing.clicked.connect( lambda: removeRebarDistribution(self) ) self.form.PickSelectedFace.setCheckable(True) self.form.PickSelectedFace.toggle() self.form.PickSelectedFace.clicked.connect( lambda: getSelectedFace(self) ) self.form.image.setPixmap( QtGui.QPixmap( os.path.split(os.path.abspath(__file__))[0] + "/icons/StraightRebarH.svg" ) ) self.form.orientationValue.currentIndexChanged.connect( self.changeOrientation ) self.form.coverAlong.currentIndexChanged.connect(self.changeCoverAlong) # help_button = QtWidgets.QStyle() # self.form.toolButton.setIcon( # self.form.toolButton.style().standardIcon( # help_button.SP_DialogHelpButton # ) # ) # self.form.toolButton2 = QtWidgets.QToolButton() # self.form.toolButton2.setIcon( # self.form.toolButton2.style().standardIcon( # QtGui.QStyle.SP_DialogHelpButton # ) # ) self.form.toolButton.clicked.connect( lambda: showPopUpImageDialog( os.path.split(os.path.abspath(__file__))[0] + "/icons/StraightRebarDetailed.svg" ) ) self.Rebar = Rebar