kigadgets.board =============== .. py:module:: kigadgets.board Classes ------- .. autoapisummary:: kigadgets.board.Board Module Contents --------------- .. py:class:: Board(wrap=None) Bases: :py:obj:`object` .. py:property:: native_obj .. py:method:: wrap(instance) :staticmethod: Wraps a C++/old api `BOARD` object, and returns a `Board`. .. py:method:: add(obj) Adds an object to the Board. Tracks, Drawings, Modules, etc... .. py:property:: footprints Provides a list of the board Footprint objects. .. py:method:: footprint_by_ref(ref) Returns the footprint that has the reference `ref`. Returns `None` if there is no such footprint. .. py:property:: modules Alias footprint to module .. py:method:: module_by_ref(ref) Alias footprint to module .. py:property:: vias A list of via objects .. py:property:: tracks A list of track objects .. py:property:: rule_areas A list of both zone and keepout objects .. py:property:: zones .. py:property:: keepouts .. py:property:: drawings List of drawings, including all shapes and text .. py:property:: items Everything on the board .. py:method:: from_editor() :staticmethod: Provides the board object from the editor. .. py:method:: load(filename) :staticmethod: Loads a board file. .. py:method:: save(filename=None) Save the board to a file. The filename should have .kicad_pcb extention, but it is not enforced. If filename=None, the board's GetFileName value is used. .. py:method:: copy() .. py:property:: filename Name of the board file. .. py:method:: geohash() Geometric hash .. py:method:: add_footprint(ref, pos=(0, 0)) Create new module on the board .. py:method:: add_module(ref, pos=(0, 0)) Same as add_footprint .. py:property:: default_width .. py:method:: add_track_segment(start, end, layer='F.Cu', width=None) Create a track segment. .. py:method:: get_layer_id(name) .. py:method:: get_layer_name(layer_id) .. py:method:: add_track(coords, layer='F.Cu', width=None) Create a track polyline. Create track segments from each coordinate to the next. .. py:property:: default_via_size .. py:property:: default_via_drill .. py:method:: add_via(coord, size=None, drill=None, layer_pair=None) Create a via on the board. :param coord: Position of the via. :param layer_pair: Tuple of the connected layers (for example ('B.Cu', 'F.Cu')). :param size: size of via in mm, or None for current selection. :param drill: size of drill in mm, or None for current selection. :returns: the created Via .. py:method:: add_line(start, end, layer='F.SilkS', width=0.15) Create a graphic line on the board .. py:method:: add_polyline(coords, layer='F.SilkS', width=0.15) Create a graphic polyline on the board .. py:method:: add_circle(center, radius, layer='F.SilkS', width=0.15) Create a graphic circle on the board .. py:method:: add_arc(center, radius, start_angle, stop_angle, layer='F.SilkS', width=0.15) Create a graphic arc on the board .. py:method:: add_text(position, text, layer='F.SilkS', size=1.0, thickness=0.15, mirrored=False) .. py:method:: remove(element, permanent=False) Makes it so Ctrl-Z works. Keeps a reference to the element in the python pcb object, so it persists for the life of that object .. py:method:: restore_removed() .. py:method:: deselect_all() .. py:property:: selected_items This useful for duck typing in the interactive terminal Suppose you want to set some drill radii. Iterating everything would cause attribute errors, so it is easier to just select the vias you want, then use this method for convenience. To get one item that you selected, use >>> xx = pcb.selected_items[0] .. py:method:: fill_zones() fills all zones in this board