示例#1
0
    def item_selected(self, event):
        tracks = self.board.GetTracks()
        # get all tracks which we are interested in
        list_tracks = []
        for track in tracks:
            if track.GetNetname() in self.nets:
                list_tracks.append(track)

        # remove highlight on all tracks
        self.logger.info("Removing highlights for nets:\n" + repr(self.nets))
        for track in list_tracks:
            track.ClearBrightened()

        pcbnew.Refresh()
        # find selected tracks
        selected_items = []
        for index in range(self.net_list.GetItemCount()):
            if self.net_list.IsSelected(index):
                selected_items.append(self.nets[index])

        self.logger.info("Adding highlights for nets:\n" +
                         repr(selected_items))
        for track in list_tracks:
            if track.GetNetname() in selected_items:
                track.SetBrightened()

        pcbnew.Refresh()
        event.Skip()
示例#2
0
文件: test.py 项目: Pokour/kicad
def edge_cuts():
    layertable = get_layertable()
    board = pcbnew.GetBoard()
    #edge cuts
    edgecut = layertable['F.Mask']

    seg1 = pcbnew.DRAWSEGMENT(board)
    board.Add(seg1)
    seg1.SetStart(pcbnew.wxPoint(0, 0))
    seg1.SetEnd(pcbnew.wxPoint(100 * SCALE, 0))
    seg1.SetLayer(edgecut)

    seg1 = pcbnew.DRAWSEGMENT(board)
    board.Add(seg1)
    seg1.SetStart(pcbnew.wxPoint(100 * SCALE, 0))
    seg1.SetEnd(pcbnew.wxPoint(100 * SCALE, 100 * SCALE))
    seg1.SetLayer(edgecut)

    seg1 = pcbnew.DRAWSEGMENT(board)
    board.Add(seg1)
    seg1.SetStart(pcbnew.wxPoint(100 * SCALE, 100 * SCALE))
    seg1.SetEnd(pcbnew.wxPoint(0, 100 * SCALE))
    seg1.SetLayer(edgecut)

    seg1 = pcbnew.DRAWSEGMENT(board)
    board.Add(seg1)
    seg1.SetStart(pcbnew.wxPoint(0, 100 * SCALE))
    seg1.SetEnd(pcbnew.wxPoint(0, 0))
    seg1.SetLayer(edgecut)
    pcbnew.Refresh()
def place_component_value_to_silk_layer(component_name):
    layers = [
        pcb.GetLayerName(l) for l in pcb.GetLayerSet().AllLayersMask().Seq()
    ]
    c = get_component(component_name)
    c.Value().SetLayer(layers.index(c.GetLayerName().replace('.Cu', '.SilkS')))
    pcbnew.Refresh()
示例#4
0
def getAndRepeatBoard(targetWidthNm,
                      targetHeightNm,
                      numberX,
                      numberY,
                      filePathToSave=None):
    board = pcbnew.GetBoard()
    wh = getWidthHeightNmOfBoard(board)
    if wh is None:
        raise Exception('Cannot get size of board')
    widthNm = wh[0]
    heightNm = wh[1]
    if numberX is None:
        numberX = math.floor(targetWidthNm / widthNm)
        numberY = math.floor(targetHeightNm / heightNm)
    # print(numberX, numberY)
    targetBoard = None
    if filePathToSave is None:
        targetBoard = board
    else:
        # targetBoard = pcbnew.BOARD() # causes segmentation fault on saving
        board.Save(filePathToSave)
        targetBoard = pcbnew.LoadBoard(filePathToSave)
    repeat(targetBoard,
           targetBoard,
           lengthNmX=widthNm,
           lengthNmY=heightNm,
           numberX=numberX,
           numberY=numberY)
    if targetBoard != board:
        print("save as", filePathToSave)
        targetBoard.Save(filePathToSave)
        print("saved")
    else:
        print("clone on board")
    pcbnew.Refresh()
示例#5
0
    def ClearArea(self):
        '''Clear selected area.'''

        undo = self.m_chkClearOwn.IsChecked()
        drillsize = self.FromUserUnit(float(self.m_txtViaDrillSize.GetValue()))
        viasize = self.FromUserUnit(float(self.m_txtViaSize.GetValue()))
        netname = self.m_cbNet.GetStringSelection()
        netcode = self.board.GetNetcodeFromNetname(netname)
        #commit = pcbnew.COMMIT()
        viacount = 0

        for item in self.board.GetTracks():
            if type(item) is pcbnew.VIA:
                #If the user selected the Undo action only signed vias are removed, 
                #otherwise are removed vias matching values set in the dialog.
                if undo and (item.GetTimeStamp() == __timecode__):
                    self.board.Remove(item)
                    viacount+=1
                    #commit.Remove(item)
                elif (not undo) and self.area.HitTestInsideZone(item.GetPosition()) and (item.GetDrillValue() == drillsize) and (item.GetWidth() == viasize) and (item.GetNetname() == netname):
                    self.board.Remove(item)
                    viacount+=1
                    #commit.Remove(item)

        if viacount > 0:
            wx.MessageBox(_(u"Removed: %d vias!") % viacount)
            #commit.Push()
            pcbnew.Refresh()
示例#6
0
def PlaceHoleCorners(dim_cor=10):
    global g_startx
    global g_starty
    global g_width
    global g_height
    global hole_type
    x_coord = [0, 0]
    y_coord = [0, 0]
    x_coord[0] = dim_cor + g_startx
    x_coord[1] = g_startx + g_width - dim_cor
    y_coord[0] = g_starty + dim_cor
    y_coord[1] = g_starty + g_height - dim_cor
    board = pcbnew.GetBoard()
    global footprint_lib
    io = pcbnew.PCB_IO()
    point = pcbnew.wxPoint(0, 0)
    for xx in x_coord:
        for yy in y_coord:
            mod = io.FootprintLoad(footprint_lib, hole_type)
            point.x = GetCoordinates(xx)
            point.y = GetCoordinates(yy)
            mod.SetPosition(point)
            board.Add(mod)

    pcbnew.Refresh()
示例#7
0
def main():
    brd = pcbnew.GetBoard()
    m = brd.GetModules()

    while m is not None:
        print(m.GetReference())
        if m.GetReference()[0] == "D":
            print("D inner")
            _id = int(m.GetReference()[1:])
            theta = (360.0/32.0)*(_id - 1);
            thetar = math.radians(theta)
            x = xoff - 23.5 * math.sin(thetar)
            y = yoff - 23.5 * math.cos(thetar)
            m.SetPosition(pcbnew.wxPointMM(x, y))
            m.SetOrientation((theta+90.0)*10.0)
        if m.GetReference()[0] == "R":
            print("R inner")
            _id = int(m.GetReference()[1:])
            theta = (360.0/32.0)*(_id - 1);
            thetar = math.radians(theta)
            x = xoff - 21 * math.sin(thetar)
            y = yoff - 21 * math.cos(thetar)
            m.SetPosition(pcbnew.wxPointMM(x, y))
            m.SetOrientation((theta+180)*10.0)
        m = m.Next()

    pcbnew.Refresh()
示例#8
0
 def OnApply(self, e):
     size_ref_height = float(self.textRefHeight.GetValue())
     size_ref_width = float(self.textRefWidth.GetValue())
     size_ref_thickness = float(self.textRefThickness.GetValue())
     size_val_height = float(self.textValHeight.GetValue())
     size_val_width = float(self.textValWidth.GetValue())
     size_val_thickness = float(self.textValThickness.GetValue())
     for m in modules:
         ref = m.Reference()
         val = m.Value()
         if self.textRefMod.GetValue():
             ref.SetTextHeight(int(size_ref_height * 10**6))
             ref.SetTextWidth(int(size_ref_width * 10**6))
             ref.SetThickness(int(size_ref_thickness * 10**6))
         if self.textValMod.GetValue():
             val.SetTextHeight(int(size_val_height * 10**6))
             val.SetTextWidth(int(size_val_width * 10**6))
             val.SetThickness(int(size_val_thickness * 10**6))
         items = m.GraphicalItems()
         if self.textOtherMod.GetValue():
             for item in items:
                 if item != ref and item != val:
                     cl = item.GetClass()
                     if cl == 'MTEXT':
                         item.SetTextHeight(
                             int(size_other_height * 10**6))
                         item.SetTextWidth(
                             int(size_other_width * 10**6))
                         item.SetThickness(
                             int(size_other_thickness * 10**6))
     pcbnew.Refresh()
     e.Skip()
示例#9
0
def add_edge_cuts(tmpdir):
    pcb_path = "{}/keyboard-before.kicad_pcb".format(tmpdir)
    try:
        board = pcbnew.LoadBoard(pcb_path)
        positions = [
            module.GetPosition() for module in board.GetModules()
            if re.match(r"^SW\d+$", module.GetReference())
        ]
        xvals = [position.x for position in positions]
        yvals = [position.y for position in positions]
        xmin = min(xvals) - pcbnew.FromMM(12)
        xmax = max(xvals) + pcbnew.FromMM(12)
        ymin = min(yvals) - pcbnew.FromMM(12)
        ymax = max(yvals) + pcbnew.FromMM(12)
        corners = [
            pcbnew.wxPoint(xmin, ymin),
            pcbnew.wxPoint(xmax, ymin),
            pcbnew.wxPoint(xmax, ymax),
            pcbnew.wxPoint(xmin, ymax),
        ]
        for i in range(len(corners)):
            start = corners[i]
            end = corners[(i + 1) % len(corners)]
            segment = pcbnew.DRAWSEGMENT(board)
            segment.SetLayer(pcbnew.Edge_Cuts)
            segment.SetStart(start)
            segment.SetEnd(end)
            board.Add(segment)

        pcbnew.Refresh()
        pcbnew.SaveBoard(pcb_path, board)
    except Exception as err:
        raise Exception("Adding egde cuts failed") from err
示例#10
0
 def AddNet(self):
     netname = self.m_txtNetName.GetLineText(0)
     if netname == "":
         wx.MessageBox("Set a netname")
         return
     if self.SelectedModule == None or self.SelectedPad == None:
         wx.MessageBox("Select a module and a pad")
         return
     netcode = -1
     for mod in self.modules:
         pads = mod.Pads()
         for pad in pads:
             net = pad.GetNet()
             nc = net.GetNet()
             if nc > netcode:
                 netcode = nc
     netcode += 1
     newnet = pcbnew.NETINFO_ITEM(self.board, netname, netcode)
     self.board.Add(newnet)
     self.SelectedPad.SetNet(newnet)
     wx.MessageBox("Net %s assigned to: %s->%s" %
                   (netname, self.SelectedModule.GetReference(),
                    self.SelectedPad.GetName()))
     pcbnew.Refresh()
     self.Destroy()
示例#11
0
def place_component_reference_position(component_name,
                                       relative_x,
                                       relative_y,
                                       justification=None,
                                       suppress_refresh=False):
    if isinstance(component_name, list):
        for c in component_name:
            place_component_reference_position(c, relative_x, relative_y,
                                               justification, True)
    else:
        a = get_component(component_name)
        b = a.Reference()
        pos_a = a.GetPosition()
        b.SetPosition(
            pcbnew.wxPoint(pos_a[0] + mm_to_nm(relative_x),
                           pos_a[1] + mm_to_nm(relative_y)))
        if justification <> None:
            if justification.lower() == 'left':
                justification = pcbnew.GR_TEXT_HJUSTIFY_LEFT
            elif justification.lower() == 'right':
                justification = pcbnew.GR_TEXT_HJUSTIFY_RIGHT
            elif justification.lower() == 'center':
                justification = pcbnew.GR_TEXT_HJUSTIFY_CENTER
            b.SetHorizJustify(justification)
    if not suppress_refresh:
        pcbnew.Refresh()
示例#12
0
        def run_buzzard(dlg, p_buzzard): 

            if len(dlg.polys) == 0:
                dlg.EndModal(wx.ID_CANCEL)
                return

            if '5.1' in self.kicad_build_version or '5.0' in self.kicad_build_version:
                # Handle KiCad 5.1
                filepath = self.filepath

                with open(filepath, 'w+') as f:
                    f.write(p_buzzard.create_v5_footprint())

                print(os.path.dirname(filepath))

                board = pcbnew.GetBoard()
                footprint = pcbnew.FootprintLoad(os.path.dirname(filepath), 'label')

                footprint.SetPosition(pcbnew.wxPoint(0, 0))
                board.Add(footprint)
                pcbnew.Refresh()

                # Zoom doesn't seem to work.
                #b = footprint.GetBoundingBox()
                #pcbnew.WindowZoom(b.GetX(), b.GetY(), b.GetWidth(), b.GetHeight())

            elif '5.99' in self.kicad_build_version or '6.0' in self.kicad_build_version:
                footprint_string = p_buzzard.create_v6_footprint()


                if wx.TheClipboard.Open():
                    wx.TheClipboard.SetData(wx.TextDataObject(footprint_string))
                    wx.TheClipboard.Close()
                    
            dlg.EndModal(wx.ID_OK)
示例#13
0
def bom_value_legend(x, y, footprints_to_ignore=[], bottom_silk=False):
    all_names = get_all_component_names()
    l = []
    for f in footprints_to_ignore:
        l.extend([
            n for n in get_wildcard_component_names(f, all_names) if n not in l
        ])
    footprints_to_ignore = l

    all_names = [n for n in all_names if n not in footprints_to_ignore]
    all_names.sort()

    footprints_to_ignore.sort()
    for f in footprints_to_ignore:
        print 'Ignoring: %s' % f

    names = []
    values = []
    column_width = 0
    row_height = 0
    for n in all_names:
        te = create_text_element(n, 'right')
        if bottom_silk:
            te.SetLayer(pcbnew.B_SilkS)
            te.SetMirrored(True)
        else:
            te.SetLayer(pcbnew.F_SilkS)
        #print n
        names.append(te)
        column_width = max(column_width, te.GetBoundingBox().GetWidth())
        row_height = max(row_height, te.GetBoundingBox().GetHeight())

        v = get_component(n).Value().GetText()
        #print v
        te = create_text_element(v, 'left')
        if bottom_silk:
            te.SetLayer(pcbnew.B_SilkS)
            te.SetMirrored(True)
        values.append(te)
        column_width = max(column_width, te.GetBoundingBox().GetWidth())
        row_height = max(row_height, te.GetBoundingBox().GetHeight())

    offset = mm_to_nm(1)
    if bottom_silk:
        offset *= -1
    x, y = mm_to_nm(x), mm_to_nm(y)
    for i in range(len(names)):
        names[i].SetPosition(pcbnew.wxPoint(x, y + i * row_height))

        values[i].SetPosition(pcbnew.wxPoint(x + offset, y + i * row_height))

        pcb.Add(names[i])
        pcb.Add(values[i])

    #Doesn't work correctly. Requires you to select and then deselect to do anything
    #for n in names:
    #    n.SetSelected()
    #for v in values:
    #    v.SetSelected()
    pcbnew.Refresh()
示例#14
0
文件: test.py 项目: Pokour/kicad
def get_area():
    board = pcbnew.GetBoard()
    layertable = get_layertable()

    newarea = board.InsertArea(0, 0, layertable["F.Mask"], 0, 0,
                               pcbnew.CPolyLine.DIAGONAL_EDGE)

    newoutline = newarea.Outline()
    newoutline.Append(SCALE * 100, 0)
    newoutline.Append(SCALE * 100, SCALE * 100)
    newoutline.Append(0, SCALE * 100)
    #http://ci.kicad-pcb.org/job/kicad-doxygen/ws/build/pcbnew/doxygen-python/html/classpcbnew_1_1SHAPE__POLY__SET.html
    poly_set = pcbnew.SHAPE_POLY_SET()
    #http://ci.kicad-pcb.org/job/kicad-doxygen/ws/build/pcbnew/doxygen-python/html/classpcbnew_1_1CPolyLine.html
    poly_set.NewOutline()
    poly_set.Append(0, 0)
    poly_set.Append(SCALE * 100, 0)
    poly_set.Append(SCALE * 100, SCALE * 100)
    poly_set.Append(0, SCALE * 100)
    poly_set.Append(0, 0)
    newarea.AddFilledPolygon(poly_set)

    #newarea.AddFilledPolygon() # ?
    pcbnew.Refresh()
    return newarea
示例#15
0
def KLEPlace(kle_path, ref_prefix='SW_'):
    with open(kle_path, 'r') as kle_file:
        keys = deserialize(json.load(kle_file))

    board = pcbnew.GetBoard()
    offset = vec(OFFSET_X, OFFSET_Y)

    for key in keys:
        module = board.FindModuleByReference(ref_prefix + key.ref)
        pos = vec(key.x, key.y)
        sizeOffset = vec(
            (key.w - 1) / 2.0 +
            0.5,  # offset switch positions based on their size
            (key.h - 1) / 2.0 +
            0.5,  # and offset all by 0.5 since KLE uses top-left corner and KiCad uses center for positioning
        )
        if key.r:
            rot = rotmat(-key.r)
            new = transform(
                pos,
                matmul(transmat(key.rx, key.ry), rot,
                       transmat(-key.rx, -key.ry)))
            sizeOffset = transform(sizeOffset, rot)
            module.SetOrientation(-key.r * 10)

        pos = vecadd(pos, sizeOffset, offset)

        module.SetPosition(
            pcbnew.wxPoint(pos[0] * GRID * MM, pos[1] * GRID * MM))

    pcbnew.Refresh()
示例#16
0
 def on_btn_ok(self, event):
     self.logger.info("Removing highligting")
     for track in self.selected_tracks:
         track.ClearBrightened()
     pcbnew.Refresh()
     logging.shutdown()
     event.Skip()
 def highlight_tracks(self, event):
     for track in self.all_tracks:
         if track not in self.selected_tracks:
             track.ClearBrightened()
         else:
             track.SetBrightened()
     pcbnew.Refresh()
    def PolygonizeClicked(self):
        drawings = GetSelectedDrawings()
        if not self.ValidateSelectionPolygon(drawings):
            self.ui.l_Status.setText(
                "Polygons can only be made from lines. If you have arcs, discretize them first."
            )
            return
        try:
            self.SetButtonsEnabled(False)
            poly = LinesToPolygon(drawings)
        except Exception as ex:
            self.ui.l_Status.setText(str(ex))
            return
        finally:
            self.SetButtonsEnabled(True)

        # apply user selected properties, add it to the board, and close
        poly.SetParent(self._pcb)
        layerID = self._pcb.GetLayerID(self.ui.cb_Layer.currentText())
        poly.SetLayer(layerID)
        poly.SetShape(pcbnew.S_POLYGON)
        poly.SetWidth(pcbnew.FromMM(int(self.ui.dsb_Width.value())))
        self._pcb.Add(poly)

        if (self.ui.chb_DeleteAfter.checkState()):
            for line in drawings:
                self._pcb.Remove(line)

        pcbnew.Refresh()
        msgBox = QtWidgets.QMessageBox()
        msgBox.setText("Successfully generated polygon!")
        msgBox.exec()

        self.close()
示例#19
0
    def OnSetRef(self, evt):
        dlg = InputDialog(
            self,
            -1,
            "Reference Size",
            size=(350, 200),
            style=wx.DEFAULT_DIALOG_STYLE,
        )
        dlg.CenterOnScreen()

        # this does not return until the dialog is closed.
        val = dlg.ShowModal()

        if val == wx.ID_OK:
            value = dlg.GetValues()

            board = pcbnew.GetBoard()
            KC().setRefSize(board, value)
            pcbnew.Refresh()  #Show up newly added vias

            #print(value)
        else:
            pass

        dlg.Destroy()
示例#20
0
    def Run(self):
        pcb = pcbnew.GetBoard()
        pads = [p for p in pcb.GetPads() if p.IsSelected()]
        if len(pads) != 2:
            raise ValueError("Must select only 2 pads")

        mods = [p.GetParent() for p in pads]
        # flag of whether or not the refence was selected
        mods_ref_sel = [m.Reference().IsSelected() for m in mods]

        # ref indicates which index serves as the reference module (aka, the one that doesn't move)
        if mods_ref_sel[0] and not mods_ref_sel[1]:
            ref, mov = 0, 1

        elif mods_ref_sel[1] and not mods_ref_sel[0]:
            ref, mov = 1, 0
        else:
            raise ValueError(
                "Highlight the module reference of the module that you want to align to"
            )

        ref_pos = pads[ref].GetPosition()
        mov_pos = pads[mov].GetPosition()

        delta_x = ref_pos.x - mov_pos.x
        delta_y = ref_pos.y - mov_pos.y

        mods[mov].Move(pcbnew.wxPoint(0, delta_y))

        pcbnew.Refresh()
示例#21
0
def clearListTracks(pcb, tracks, refresh=None):
    wxLogDebug('deSelecting Tracks', debug)
    for trk in tracks:
        if trk.IsSelected():
            trk.ClearSelected()
    if refresh:
        pcbnew.Refresh()
示例#22
0
def lock_all_tracks(min_width_mm=0):
    signal_tracks = [
        t for t in pcb.GetTracks() if t.GetWidth() >= mm_to_nm(min_width_mm)
    ]
    for st in signal_tracks:
        st.SetLocked(True)
    pcbnew.Refresh()
示例#23
0
 def on_btn_ok(self, e):
     add_exits(
         self.board, {
             signal: self.flat_fp[signal]
             for signal in self.flat_fp if self.flat_fp[signal]["enabled"]
         })
     pcbnew.Refresh()
     print("Done")
示例#24
0
 def Run(self):
     modules = [m for m in pcbnew.GetBoard().GetModules()]
     selected_modules = [m for m in modules if m.IsSelected()]
     if (len(selected_modules) > 1):
         for m in selected_modules:
             place_instances(m.GetReference(), (0, 100))
         board.BuildConnectivity()
         pcbnew.Refresh()
示例#25
0
def unlock_tracks_with_signal_name(signal_names_list, min_width_mm=0):
    signal_tracks = [
        t for t in pcb.GetTracks() if t.GetNetname() in signal_names_list
        and t.GetWidth() >= mm_to_nm(min_width_mm)
    ]
    for st in signal_tracks:
        st.SetLocked(False)
    pcbnew.Refresh()
示例#26
0
def place_component_relative_mm(reference_component_name, component_to_move, relative_x, relative_y, suppress_refresh = False):
    a = get_component(reference_component_name)
    b = get_component(component_to_move)

    pos_a = a.GetPosition()
    b.SetPosition(pcbnew.wxPoint(pos_a[0] + mm_to_nm(relative_x), pos_a[1] + mm_to_nm(relative_y)))
    if not suppress_refresh:
        pcbnew.Refresh()
示例#27
0
    def Run(self):
        global delete_before_connect
        #self.pcb = GetBoard()
        # net_name = "GND"
        pcb = pcbnew.GetBoard()

        #from https://github.com/MitjaNemec/Kicad_action_plugins
        #hack wxFormBuilder py2/py3
        try:
            _pcbnew_frame = [
                x for x in wx.GetTopLevelWindows()
                if x.GetTitle().lower().startswith('pcbnew')
            ][0]
        except:
            _pcbnew_frame = [
                x for x in wx.GetTopLevelWindows()
                if 'pcbnew' in wx._windows.Frame.GetTitle(x).lower()
            ][0]
        #aParameters = RoundTrackDlg(None)
        aParameters = RoundTrack_Dlg(_pcbnew_frame)
        if hasattr(pcb, 'm_Uuid'):
            aParameters.m_buttonDelete.Disable()
            aParameters.m_checkBoxDelete.Disable()
        #aParameters = RoundTrack_DlgEx(_pcbnew_frame)
        aParameters.Show()
        #end hack
        aParameters.m_distanceMM.SetValue("5")
        aParameters.m_segments.SetValue("16")
        aParameters.m_bitmap1.SetBitmap(
            wx.Bitmap(
                os.path.join(os.path.dirname(os.path.realpath(__file__)),
                             "round_track_help.png")))
        modal_result = aParameters.ShowModal()
        segments = self.CheckSegmentsInput(aParameters.m_segments.GetValue(),
                                           "number of segments")
        distI = FromMM(
            self.CheckDistanceInput(aParameters.m_distanceMM.GetValue(),
                                    "distance from intersection"))
        if aParameters.m_checkBoxDelete.IsChecked():
            delete_before_connect = True
        else:
            delete_before_connect = False
        if segments is not None and distI is not None:
            if modal_result == wx.ID_OK:
                Round_Selection(pcb, distI, segments)
                pcbnew.Refresh()
            elif modal_result == wx.ID_DELETE:
                Delete_Segments(pcb)
                #wx.LogMessage('Round Segments on Track Net Deleted')
            elif modal_result == wx.ID_REVERT:
                wxLogDebug('Connecting Tracks', debug)
                Connect_Segments(pcb)
            else:
                None  # Cancel
            #pcbnew.Refresh()
        else:
            None  # Invalid input
        aParameters.Destroy()
示例#28
0
def MoveModules(x,y,refs, brd = None):
    if not brd:
        brd = pcbnew.GetBoard()
    for ref in MakeRefs(refs):
        m = brd.FindModuleByReference(ref)
        if m:
            m.SetPosition(pcbnew.wxPointMM(x,y))
            x = x + m.GetBoundingBox().GetWidth()/1000000
    pcbnew.Refresh()
    def OnCancel(self, event):
        # clear highlight on all modules on selected level
        for mod in self.src_modules:
            clear_highlight_on_module(mod)
        pcbnew.Refresh()

        self.logger.info("User canceled the dialog")
        logging.shutdown()
        event.Skip()
示例#30
0
def place_components_relative_mm(components_list,
                                 relative_x,
                                 relative_y,
                                 suppress_refresh=False):
    for i in range(len(components_list) - 1):
        place_component_relative_mm(components_list[i], components_list[i + 1],
                                    relative_x, relative_y, True)
    if not suppress_refresh:
        pcbnew.Refresh()