コード例 #1
0
ファイル: dialogMAIN_FORM.py プロジェクト: marmni/FreeCAD-PCB
    def generateLayers(self, forbidden=[]):
        ''' '''
        for i, j in self.layersNames.items():
            layerName = j['name']
            ######################################
            if self.databaseType == "geda":  # gEDA
                layerID = j["type"]

                if "bottom" in layerName.lower():
                    layerID += "B"
                elif "top" in layerName.lower():
                    layerID += "T"
            elif self.databaseType in ["idf", "librepcb"]:
                layerID = i
            else:
                layerID = int(i)
            ######################################
            if layerID in forbidden:
                continue
            #
            if layerID in PCBconf.softLayers[self.databaseType]:
                if "name" in PCBconf.softLayers[
                        self.databaseType][layerID].keys():
                    layerName = PCBconf.softLayers[
                        self.databaseType][layerID]["name"]

                layerColor = PCBconf.softLayers[
                    self.databaseType][layerID]["color"]
                layerValue = PCBconf.softLayers[
                    self.databaseType][layerID]["value"]
                layerSide = [
                    PCBconf.softLayers[self.databaseType][layerID]["side"],
                    True
                ]  # [layer side, block drop down list TRUE/FALSE]
            else:
                if j['color']:
                    layerColor = j['color']
                else:
                    layerColor = getFromSettings_Color_1('', 4294967295)

                layerValue = ['double', u'μm', 34.6, 0, 350]
                #
                layerSide = [1, False
                             ]  # [layer side, block drop down list TRUE/FALSE]
                if "side" in j.keys() and j["side"] == "BOTTOM":
                    layerSide[0] = 0
            ######################################
            # gEDA
            if self.databaseType == "geda":
                layerID += "_" + str(j["number"])
            ######################################

            self.spisWarstwAddRow(layerID, layerColor, layerValue, layerName,
                                  layerSide)
コード例 #2
0
ファイル: PCBdrill.py プロジェクト: refaqtor/FreeCAD-PCB
 def __init__(self, parent=None):
     QtGui.QWidget.__init__(self, parent)
     
     self.form = self
     self.form.setWindowTitle(u"Create drill center")
     self.form.setWindowIcon(QtGui.QIcon(":/data/img/drill-icon.png"))
     #
     self.holeSize = QtGui.QDoubleSpinBox()
     self.holeSize.setValue(0.4)
     self.holeSize.setMinimum(0.1)
     self.holeSize.setSuffix('mm')
     self.holeSize.setSingleStep(0.1)
     #
     self.pcbColor = kolorWarstwy()
     self.pcbColor.setColor(getFromSettings_Color_1('CenterDrillColor', 4294967295))
     self.pcbColor.setToolTip(u"Click to change color")
     #
     lay = QtGui.QGridLayout(self)
     lay.addWidget(QtGui.QLabel('Hole size'), 0, 0, 1, 1)
     lay.addWidget(self.holeSize, 0, 1, 1, 1)
     lay.addWidget(QtGui.QLabel(u'Color:'), 1, 0, 1, 1)
     lay.addWidget(self.pcbColor, 1, 1, 1, 1)
コード例 #3
0
ファイル: PCBconf.py プロジェクト: geggio84/FreeCAD-PCB
    }
}

##
# pathToDAtabase = moved to PCBfunctions.py getFromSettings_databasePath()


#  PCBconstraintAreas = layerName: [layer nape for menu, [layerType], [Type, Surfix, Value, Min, Max], [R, G, B], layer description]
#
#  layerPosition
#   0: Bottom
#   1: Top
#   2: Both
#
PCBconstraintAreas = {
    "tPlaceKeepout": ['Place Keepout Top', ['tKeepout', 'topSide'], ['int', '%', 50, 0, 100], getFromSettings_Color_1('tPlaceKeepoutColor', 4278190335), "Restricted areas for components, top side"],
    "bPlaceKeepout": ['Place Keepout Bottom', ['bKeepout', 'bottomSide'],['int', '%', 50, 0, 100] , getFromSettings_Color_1('bPlaceKeepoutColor', 65535), "Restricted areas for components, bottom side"],
    "vPlaceOutline": ["Place Outline", ['vPlaceOutline', 'bothSide'], ['int', '%', 50, 0, 100], getFromSettings_Color_1('vPlaceOutlineColor', 255), ''],
    "tPlaceOutline": ["Place Outline Top", ['tPlaceOutline', 'topSide'], ['int', '%', 50, 0, 100], getFromSettings_Color_1('tPlaceOutlineColor', 4278190335), ''],
    "bPlaceOutline": ["Place Outline Bottom", ['bPlaceOutline', 'bottomSide'], ['int', '%', 50, 0, 100], getFromSettings_Color_1('bPlaceOutlineColor', 65535), ''],
    "vRouteOutline": ["Route Outline", ['vRouteOutline', 'bothSide'], ['int', '%', 50, 0, 100], getFromSettings_Color_1('vRouteOutlineColor', 255), ''],
    "tRouteOutline": ["Route Outline Top", ['tRestrict', 'tRouteOutline', 'topSide'], ['int', '%', 50, 0, 100], getFromSettings_Color_1('tRouteOutlineColor', 4278190335), ''],
    "bRouteOutline": ["Route Outline Bottom", ['bRestrict', 'bRouteOutline', 'bottomSide'], ['int', '%', 50, 0, 100], getFromSettings_Color_1('bRouteOutlineColor', 65535), ''],
    "tRouteKeepout": ["Route Keepout Top", ['tRestrict', 'topSide'], ['int', '%', 50, 0, 100], getFromSettings_Color_1('tRouteKeepoutColor', 4278190335), "Restricted areas for copper, top side"],
    "bRouteKeepout": ["Route Keepout Bottom", ['bRestrict', 'bottomSide'], ['int', '%', 50, 0, 100], getFromSettings_Color_1('bRouteKeepoutColor', 65535), "Restricted areas for copper, bottom side"],
    "vRouteKeepout": ["Via Keepout", ['vRestrict', 'bothSide'], ['int', '%', 50, 0, 100], getFromSettings_Color_1('vRouteKeepoutColor', 255), "Restricted areas for vias"]
}

PCBlayers = {
    "tPolygon" : [1, getFromSettings_Color_1('PathColor', 7012607), None, ['tPolygon'], "Polygons, top side"],
    "bPolygon" : [0, getFromSettings_Color_1('PathColor', 7012607), None, ['bPolygon'], "Polygons, bottom side"],
コード例 #4
0
    def __init__(self, searchPhrase=None, parent=None):
        QtGui.QWidget.__init__(self, parent)
        #partsManaging.__init__(self, parent)
        
        self.gruboscPlytki = getPCBheight()[1]
        self.root = None
        self.packageData = {}
        
        self.form = self
        self.form.setWindowTitle("Add annotation")
        self.form.setWindowIcon(QtGui.QIcon(":/data/img/addAnnotation.svg"))
        #
        self.text = QtGui.QTextEdit('')
        self.text.setFixedHeight(100)
        
        self.align = QtGui.QComboBox()
        self.align.addItems(alignParam)
        
        self.spin = QtGui.QComboBox()
        self.spin.addItems(['True', 'False'])
        self.spin.setCurrentIndex(1)
        
        self.fontSize = QtGui.QDoubleSpinBox()
        self.fontSize.setValue(1.27)
        self.fontSize.setSuffix(' mm')
        
        self.fontName = QtGui.QComboBox()
        self.fontName.addItems(fonts)
        self.fontName.setCurrentIndex(self.fontName.findText("Fixed"))
        
        self.tracking = QtGui.QDoubleSpinBox()
        self.tracking.setSingleStep(0.5)
        self.tracking.setRange(-1000, 1000)
        self.tracking.setSuffix(' mm')
        
        self.lineDistance = QtGui.QSpinBox()
        self.lineDistance.setValue(50)
        self.lineDistance.setSingleStep(1)
        self.lineDistance.setRange(-1000, 1000)
        self.lineDistance.setSuffix(' %')
        
        self.val_x = QtGui.QDoubleSpinBox()
        self.val_x.setSingleStep(0.5)
        self.val_x.setRange(-1000, 1000)
        self.val_x.setSuffix(' mm')
        
        self.val_y = QtGui.QDoubleSpinBox()
        self.val_y.setSingleStep(0.5)
        self.val_y.setRange(-1000, 1000)
        self.val_y.setSuffix(' mm')
        
        self.val_z = QtGui.QDoubleSpinBox()
        self.val_z.setSingleStep(0.5)
        self.val_z.setRange(-1000, 1000)
        self.val_z.setSuffix(' mm')
        
        self.rotation = QtGui.QDoubleSpinBox()
        self.rotation.setSingleStep(1)
        self.rotation.setSuffix(' deg')
        self.rotation.setRange(-360, 360)
        
        self.side = QtGui.QComboBox()
        self.side.addItems(objectSides)
        
        self.error = QtGui.QLabel(u'')
        
        self.continueCheckBox = QtGui.QCheckBox(u'Continue')
        
        self.fontColor = kolorWarstwy()
        self.fontColor.setColor(getFromSettings_Color_1('AnnotationsColor', 4294967295))
        self.fontColor.setToolTip(u"Click to change color")
        #
        lay = QtGui.QGridLayout()
        lay.addWidget(QtGui.QLabel(u'Text:'), 0, 0, 1, 1)
        lay.addWidget(self.text, 0, 1, 1, 2)
        
        lay.addWidget(QtGui.QLabel(u'Font:'), 1, 0, 1, 1)
        lay.addWidget(self.fontName, 1, 1, 1, 2)
        lay.addWidget(QtGui.QLabel(u'FontFile:'), 2, 0, 1, 1)
        
        lay.addWidget(QtGui.QLabel(u'Font size:'), 3, 0, 1, 1)
        lay.addWidget(self.fontSize, 3, 1, 1, 2)
        lay.addWidget(QtGui.QLabel(u'Tracking:'), 4, 0, 1, 1)
        lay.addWidget(self.tracking, 4, 1, 1, 2)
        lay.addWidget(QtGui.QLabel(u'Line Distance:'), 5, 0, 1, 1)
        lay.addWidget(self.lineDistance, 5, 1, 1, 2)
        
        lay.addWidget(QtGui.QLabel(u'Font color:'), 6, 0, 1, 1)
        lay.addWidget(self.fontColor, 6, 1, 1, 2)
        lay.addWidget(QtGui.QLabel(u'Align:'), 7, 0, 1, 1)
        lay.addWidget(self.align, 7, 1, 1, 2)
        lay.addWidget(QtGui.QLabel(u'Side:'), 8, 0, 1, 1)
        lay.addWidget(self.side, 8, 1, 1, 2)
        lay.addWidget(QtGui.QLabel(u'Spin:'), 9, 0, 1, 1)
        lay.addWidget(self.spin, 9, 1, 1, 2)
        
        lay.addWidget(QtGui.QLabel(u'X:'), 10, 0, 1, 1)
        lay.addWidget(self.val_x, 10, 1, 1, 2)
        lay.addWidget(QtGui.QLabel(u'Y:'), 11, 0, 1, 1)
        lay.addWidget(self.val_y, 11, 1, 1, 2)
        lay.addWidget(QtGui.QLabel(u'Z:'), 12, 0, 1, 1)
        lay.addWidget(self.val_z, 12, 1, 1, 2)
        lay.addWidget(QtGui.QLabel(u'Rotation:'), 13, 0, 1, 1)
        lay.addWidget(self.rotation, 13, 1, 1, 2)
        
        lay.addItem(QtGui.QSpacerItem(1, 10), 14, 0, 1, 3)
        lay.addWidget(self.continueCheckBox, 15, 0, 1, 3)
        lay.addItem(QtGui.QSpacerItem(1, 10), 16, 0, 1, 3)
        lay.addWidget(self.error, 17, 0, 1, 3)
        lay.setRowStretch(18, 10)
        self.setLayout(lay)
        #
        self.connect(self.val_x, QtCore.SIGNAL('valueChanged (double)'), self.addArrow)
        self.connect(self.val_y, QtCore.SIGNAL('valueChanged (double)'), self.addArrow)
        #self.connect(self.side, QtCore.SIGNAL('currentIndexChanged (int)'), self.addArrow)

        self.addArrow()
コード例 #5
0
        'exportComponent': False,
    },
}
#########################
#  PCBconstraintAreas = layerName: [layer nape for menu, [layerType], [Type, Surfix, Value, Min, Max], [R, G, B], layer description]
#
#  layerPosition
#   0: Bottom
#   1: Top
#   2: Both
#
PCBconstraintAreas = {
    "vPlaceKeepout": [
        "Place Keepout", ['vPlaceKeepout', 'bothSide'],
        ['int', '%', 50, 0, 100],
        getFromSettings_Color_1('vPlaceKeepoutColor', 255), ''
    ],
    "tPlaceKeepout": [
        'Place Keepout Top', ['tKeepout', 'topSide'], ['int', '%', 50, 0, 100],
        getFromSettings_Color_1('tPlaceKeepoutColor', 4278190335),
        "Restricted areas for components, top side"
    ],
    "bPlaceKeepout": [
        'Place Keepout Bottom', ['bKeepout', 'bottomSide'],
        ['int', '%', 50, 0, 100],
        getFromSettings_Color_1('bPlaceKeepoutColor', 65535),
        "Restricted areas for components, bottom side"
    ],
    "vPlaceOutline": [
        "Place Outline", ['vPlaceOutline', 'bothSide'],
        ['int', '%', 50, 0, 100],
コード例 #6
0
    def generate(self, doc):
        self.printInfo('\nInitializing')
        # BOARD
        self.generatePCB(doc)
        # HOLES
        self.generateHoles(doc)
        # PARTS
        if self.wersjaFormatu.dialogMAIN.partsBox.isChecked():
            self.importParts()
        # LAYERS
        grp = createGroup_Layers()
        grp_2 = createGroup_Areas()
        pathsLayers = []
        for i in range(self.wersjaFormatu.dialogMAIN.spisWarstw.rowCount()):
            if self.wersjaFormatu.dialogMAIN.spisWarstw.cellWidget(
                    i, 0).isChecked():
                ################
                if self.databaseType in [
                        "geda", "idf", "librepcb", "librepcb"
                ]:
                    layerNumber = self.wersjaFormatu.dialogMAIN.spisWarstw.item(
                        i, 1).text()
                else:
                    layerNumber = int(
                        self.wersjaFormatu.dialogMAIN.spisWarstw.item(
                            i, 1).text())
                #
                layerName = str(
                    self.wersjaFormatu.dialogMAIN.spisWarstw.item(i, 5).text())

                try:
                    layerSide = self.wersjaFormatu.dialogMAIN.spisWarstw.cellWidget(
                        i, 3).itemData(
                            self.wersjaFormatu.dialogMAIN.spisWarstw.
                            cellWidget(i, 3).currentIndex())
                except:
                    layerSide = None

                try:
                    layerColor = self.wersjaFormatu.dialogMAIN.spisWarstw.cellWidget(
                        i, 2).getColor()
                except:
                    layerColor = None
                try:
                    layerTransp = self.wersjaFormatu.dialogMAIN.spisWarstw.cellWidget(
                        i, 4).value()
                except:
                    layerTransp = None
                #
                layerFunction = self.wersjaFormatu.defineFunction(layerNumber)
                # ################
                # if self.databaseType == "geda":
                # layerNumber = int(layerNumber.split("_")[1])
                # ################
                self.printInfo("\nImporting layer '{0}': ".format(layerName))
                try:
                    if layerFunction in ["silk", "pads", "paths"]:
                        if layerFunction == "paths":
                            pathsLayers.append([
                                doc, layerNumber, grp, layerName, layerColor,
                                layerTransp, layerSide, layerFunction,
                                self.wersjaFormatu.dialogMAIN.
                                plytkaPCB_cutHolesThroughAllLayers.isChecked(),
                                self.wersjaFormatu.dialogMAIN.skipEmptyLayers.
                                isChecked()
                            ])
                            ########################
                            # tented Vias
                            ########################
                            try:
                                if layerSide == 1:
                                    if not self.tentedVias[0]:
                                        self.tentedVias[0] = layerColor
                                    else:
                                        self.tentedVias[
                                            0].ViewObject.ShapeColor = layerColor
                                elif layerSide == 0:
                                    if not self.tentedVias[1]:
                                        self.tentedVias[1] = layerColor
                                    else:
                                        self.tentedVias[
                                            1].ViewObject.ShapeColor = layerColor
                            except:
                                pass
                        #
                        self.generateSilkLayer(
                            doc, layerNumber, grp, layerName, layerColor,
                            layerTransp, layerSide, layerFunction,
                            self.wersjaFormatu.dialogMAIN.
                            plytkaPCB_cutHolesThroughAllLayers.isChecked(),
                            self.wersjaFormatu.dialogMAIN.skipEmptyLayers.
                            isChecked(),
                            self.wersjaFormatu.dialogMAIN.tentedViasLimit.
                            value(), False)
                        ########################
                        # tented Vias
                        ########################
                        if layerFunction == "pads" and self.wersjaFormatu.dialogMAIN.tentedViasLimit.value(
                        ) > 0:
                            color = getFromSettings_Color_1(
                                'PathColor', 7012607)
                            layerColor = (color[0] / 255., color[1] / 255.,
                                          color[2] / 255.)

                            try:
                                if layerSide == 1:
                                    if self.tentedVias[0]:
                                        layerColor = self.tentedVias[0]
                                elif layerSide == 0:
                                    if self.tentedVias[1]:
                                        layerColor = self.tentedVias[1]
                            except:
                                pass
                            #
                            obj = self.generateSilkLayer(
                                doc, layerNumber, grp,
                                layerName + "_tentedVias", layerColor,
                                layerTransp, layerSide, layerFunction,
                                self.wersjaFormatu.dialogMAIN.
                                plytkaPCB_cutHolesThroughAllLayers.isChecked(),
                                self.wersjaFormatu.dialogMAIN.skipEmptyLayers.
                                isChecked(),
                                self.wersjaFormatu.dialogMAIN.tentedViasLimit.
                                value(), True)
                            #
                            try:
                                if layerSide == 1:
                                    if not self.tentedVias[0]:
                                        self.tentedVias[0] = obj
                                elif layerSide == 0:
                                    if not self.tentedVias[1]:
                                        self.tentedVias[1] = obj
                            except:
                                pass
                    #
                    elif layerFunction == "measures":
                        self.generateDimensions(
                            doc, grp, layerName, layerColor,
                            self.wersjaFormatu.dialogMAIN.gruboscPlytki.value(
                            ))
                    elif layerFunction == "glue":
                        self.generateGlue(doc, grp, layerName, layerColor,
                                          layerNumber, layerSide)
                    elif layerFunction == "constraint":
                        self.generateConstraintAreas(doc, layerNumber, grp,
                                                     layerName, layerColor,
                                                     layerTransp)
                    elif layerFunction == "annotations":
                        self.addAnnotations(
                            self.wersjaFormatu.getNormalAnnotations(),
                            layerColor)
                except Exception as e:
                    self.printInfo('{0}'.format(e), 'error')
                else:
                    self.printInfo('\n\tdone')
        #
        if self.wersjaFormatu.dialogMAIN.copperImportPolygons.isChecked():
            self.generatePolygonsOnCopperLayer(pathsLayers)