jsreynaud / kicad-action-scripts

Some KiCad plugins in Python
GNU General Public License v3.0
250 stars 50 forks source link

FR: Choose whether the generated vias should be covered by the solder mask or not. #78

Open boromyr opened 4 months ago

boromyr commented 4 months ago

If the generated vias are used for thermal dissipation, you may not want them covered by the solder mask when you have selected "Covered Vias" by default in the board settings

    def AddVia(self, position, x, y):
        if not self.parent_area:
            wxPrint("\nUnable to find a valid parent area (zone)")
            return None

        # Creazione della via
        m = PCB_VIA(self.parent_area)
        m.SetPosition(position)
        if self.target_net is None:
            self.target_net = self.pcb.FindNet(self.netname)
        m.SetNet(self.target_net)
        m.SetViaType(VIATYPE_THROUGH)
        m.SetDrill(int(self.drill))
        m.SetWidth(int(self.size))
        m.SetIsFree(True)
        self.pcb.Add(m)

        def create_circular_area(layer):
            area = PCB_SHAPE(self.pcb)
            area.SetShape(SHAPE_T_CIRCLE)
            area.SetCenter(position)
            area.SetRadius(max(1, int(self.size/2)))
            area.SetLayer(layer)
            area.SetFilled(True)
            area.SetWidth(0)
            self.pcb.Add(area)
            return area

        f_mask_area = create_circular_area(F_Mask)
        b_mask_area = create_circular_area(B_Mask)

        group = PCB_GROUP(self.pcb)
        group.AddItem(m)
        group.AddItem(f_mask_area)
        group.AddItem(b_mask_area)
        self.pcb.Add(group)

        # Aggiunta degli elementi al pcb_group esistente
        self.pcb_group.AddItem(group)

        return group

This could be a rough solution that adds an opening on the welding mask in the two layers F and B, a new checkbox could make the functionality selectable: image