def __init__(self,obj):
     ArchComponent.Component.__init__(self,obj)
     obj.addProperty("App::PropertyLength","Length","1Timber","The length of this element.")
     obj.addProperty("App::PropertyLength","Width","1Timber","The width of this element.")
     obj.addProperty("App::PropertyLength","Height","1Timber","The height of this element.")
     obj.addProperty("App::PropertyEnumeration","Preset","1Timber","Preset parameters for this beam")
     obj.Preset = TimberComponent.getPresetsList()
     #obj.addProperty("App::PropertyLinkList","Armatures","Arch","Armatures contained in this element")
     #obj.addProperty("App::PropertyVector","Normal","Arch","The normal extrusion direction of this object (keep (0,0,0) for automatic normal)")
     #obj.addProperty("App::PropertyVectorList","Nodes","Arch","The structural nodes of this element")
     #obj.addProperty("App::PropertyString","Profile","Arch","A description of the standard profile this element is based upon")
     self.Type = "TBeam"
     obj.Role = Roles
     structure = Arch.makeStructure()
     #structure.setEditorMode("Width", 1)
     #structure.setEditorMode("Height", 1)
     #structure.setEditorMode("Length", 1)
     #structure.setEditorMode("Placement", 1)
     structure.MoveWithHost = True
     ArchComponent.addToComponent( obj , structure , "Base" )
Beispiel #2
0
 def __init__(self, obj):
     ArchComponent.Component.__init__(self, obj)
     obj.addProperty("App::PropertyLength", "Length", "1Timber",
                     "The length of this element.")
     obj.addProperty("App::PropertyLength", "Width", "1Timber",
                     "The width of this element.")
     obj.addProperty("App::PropertyLength", "Height", "1Timber",
                     "The height of this element.")
     obj.addProperty("App::PropertyEnumeration", "Preset", "1Timber",
                     "Preset parameters for this beam")
     obj.Preset = TimberComponent.getPresetsList()
     #obj.addProperty("App::PropertyLinkList","Armatures","Arch","Armatures contained in this element")
     #obj.addProperty("App::PropertyVector","Normal","Arch","The normal extrusion direction of this object (keep (0,0,0) for automatic normal)")
     #obj.addProperty("App::PropertyVectorList","Nodes","Arch","The structural nodes of this element")
     #obj.addProperty("App::PropertyString","Profile","Arch","A description of the standard profile this element is based upon")
     self.Type = "TBeam"
     obj.Role = Roles
     structure = Arch.makeStructure()
     #structure.setEditorMode("Width", 1)
     #structure.setEditorMode("Height", 1)
     #structure.setEditorMode("Length", 1)
     #structure.setEditorMode("Placement", 1)
     structure.MoveWithHost = True
     ArchComponent.addToComponent(obj, structure, "Base")
Beispiel #3
0
    def taskbox(self):
        "sets up a taskbox widget"
        w = QtGui.QWidget()
        ui = FreeCADGui.UiLoader()
        w.setWindowTitle(translate("Arch", "Structure options").decode("utf8"))
        grid = QtGui.QGridLayout(w)

        # presets box
        labelp = QtGui.QLabel(translate("Timber", "Preset").decode("utf8"))
        valuep = QtGui.QComboBox()
        presetslist = TimberComponent.getPresetsList()
        #fpresets = [" "]
        #for p in Presets[1:]:
        #    fpresets.append(str(translate("Arch",p[0]))+" "+p[1]+" ("+str(p[2])+"x"+str(p[3])+"mm)")
        valuep.addItems(presetslist)
        grid.addWidget(labelp, 0, 0, 1, 1)
        grid.addWidget(valuep, 0, 1, 1, 1)

        # length
        label1 = QtGui.QLabel(translate("Timber", "Length").decode("utf8"))
        self.vLength = ui.createWidget("Gui::InputField")
        self.vLength.setText(self.FORMAT % self.Length)
        grid.addWidget(label1, 1, 0, 1, 1)
        grid.addWidget(self.vLength, 1, 1, 1, 1)

        # width
        label2 = QtGui.QLabel(translate("Timber", "Width").decode("utf8"))
        self.vWidth = ui.createWidget("Gui::InputField")
        self.vWidth.setText(self.FORMAT % self.Width)
        grid.addWidget(label2, 2, 0, 1, 1)
        grid.addWidget(self.vWidth, 2, 1, 1, 1)

        # height
        label3 = QtGui.QLabel(translate("Timber", "Height").decode("utf8"))
        self.vHeight = ui.createWidget("Gui::InputField")
        self.vHeight.setText(self.FORMAT % self.Height)
        grid.addWidget(label3, 3, 0, 1, 1)
        grid.addWidget(self.vHeight, 3, 1, 1, 1)

        # horizontal button
        value5 = QtGui.QPushButton(translate("Arch", "Rotate").decode("utf8"))
        grid.addWidget(value5, 4, 0, 1, 2)

        # continue button
        label4 = QtGui.QLabel(translate("Arch", "Con&tinue").decode("utf8"))
        value4 = QtGui.QCheckBox()
        value4.setObjectName("ContinueCmd")
        value4.setLayoutDirection(QtCore.Qt.RightToLeft)
        label4.setBuddy(value4)
        if hasattr(FreeCADGui, "draftToolBar"):
            value4.setChecked(FreeCADGui.draftToolBar.continueMode)
            self.continueCmd = FreeCADGui.draftToolBar.continueMode
        grid.addWidget(label4, 5, 0, 1, 1)
        grid.addWidget(value4, 5, 1, 1, 1)

        QtCore.QObject.connect(valuep,
                               QtCore.SIGNAL("currentIndexChanged(QString)"),
                               self.setPreset)
        QtCore.QObject.connect(self.vLength,
                               QtCore.SIGNAL("valueChanged(double)"),
                               self.setLength)
        QtCore.QObject.connect(self.vWidth,
                               QtCore.SIGNAL("valueChanged(double)"),
                               self.setWidth)
        QtCore.QObject.connect(self.vHeight,
                               QtCore.SIGNAL("valueChanged(double)"),
                               self.setHeight)
        QtCore.QObject.connect(value4, QtCore.SIGNAL("stateChanged(int)"),
                               self.setContinue)
        QtCore.QObject.connect(value5, QtCore.SIGNAL("pressed()"), self.rotate)
        return w
    def taskbox(self):
        "sets up a taskbox widget"
        w = QtGui.QWidget()
        ui = FreeCADGui.UiLoader()
        w.setWindowTitle(translate("Arch","Structure options").decode("utf8"))
        grid = QtGui.QGridLayout(w)

        # presets box
        labelp = QtGui.QLabel(translate("Timber","Preset").decode("utf8"))
        valuep = QtGui.QComboBox()
        presetslist = TimberComponent.getPresetsList()
        #fpresets = [" "]
        #for p in Presets[1:]:
        #    fpresets.append(str(translate("Arch",p[0]))+" "+p[1]+" ("+str(p[2])+"x"+str(p[3])+"mm)")
        valuep.addItems(presetslist)
        grid.addWidget(labelp,0,0,1,1)
        grid.addWidget(valuep,0,1,1,1)

        # length
        label1 = QtGui.QLabel(translate("Timber","Length").decode("utf8"))
        self.vLength = ui.createWidget("Gui::InputField")
        self.vLength.setText(self.FORMAT % self.Length)
        grid.addWidget(label1,1,0,1,1)
        grid.addWidget(self.vLength,1,1,1,1)

        # width
        label2 = QtGui.QLabel(translate("Timber","Width").decode("utf8"))
        self.vWidth = ui.createWidget("Gui::InputField")
        self.vWidth.setText(self.FORMAT % self.Width)
        grid.addWidget(label2,2,0,1,1)
        grid.addWidget(self.vWidth,2,1,1,1)

        # height
        label3 = QtGui.QLabel(translate("Timber","Height").decode("utf8"))
        self.vHeight = ui.createWidget("Gui::InputField")
        self.vHeight.setText(self.FORMAT % self.Height)
        grid.addWidget(label3,3,0,1,1)
        grid.addWidget(self.vHeight,3,1,1,1)

        # horizontal button
        value5 = QtGui.QPushButton(translate("Arch","Rotate").decode("utf8"))
        grid.addWidget(value5,4,0,1,2)

        # continue button
        label4 = QtGui.QLabel(translate("Arch","Con&tinue").decode("utf8"))
        value4 = QtGui.QCheckBox()
        value4.setObjectName("ContinueCmd")
        value4.setLayoutDirection(QtCore.Qt.RightToLeft)
        label4.setBuddy(value4)
        if hasattr(FreeCADGui,"draftToolBar"):
            value4.setChecked(FreeCADGui.draftToolBar.continueMode)
            self.continueCmd = FreeCADGui.draftToolBar.continueMode
        grid.addWidget(label4,5,0,1,1)
        grid.addWidget(value4,5,1,1,1)

        QtCore.QObject.connect(valuep,QtCore.SIGNAL("currentIndexChanged(QString)"),self.setPreset)
        QtCore.QObject.connect(self.vLength,QtCore.SIGNAL("valueChanged(double)"),self.setLength)
        QtCore.QObject.connect(self.vWidth,QtCore.SIGNAL("valueChanged(double)"),self.setWidth)
        QtCore.QObject.connect(self.vHeight,QtCore.SIGNAL("valueChanged(double)"),self.setHeight)
        QtCore.QObject.connect(value4,QtCore.SIGNAL("stateChanged(int)"),self.setContinue)
        QtCore.QObject.connect(value5,QtCore.SIGNAL("pressed()"),self.rotate)
        return w