def __init__(self, parameter):
        PartBase.__init__(self, parameter)
        partParams.__init__(self, parameter)
        self.modelBody = buttonSwitchBody (parameter)

        # set params to 
        self.licAuthor = "Joerg Laukemper"
        self.licEmail = "https://github.com/MountyRox"
        if parameter.terminal_shape == ShapeOfTerminal.TH:
            self.destination_dir = "Button_Switch_THT.3dshapes"  
            self.footprints_dir = "Button_Switch_THT.pretty" 
        else:
            self.destination_dir = "Button_Switch_SMD.3dshapes"  
            self.footprints_dir = "Button_Switch_SMD.pretty" 

        # CheckedmodelName is the model name with following replacements: replace('.', '').replace('-', '_').replace('(', '').replace(')', '')
        # Necessary because FreeCAD does not like these character in a file name, but KiCAD often use these character in names of footprints
        self.CheckedmodelName = None

        # make_me = True is the default value (inherited from PartBase). Must only be overridden if it should be False
        # self.make_me = True


        # Append the existing list from PartBase = self.color_keys = ["black body", "metal grey pins"] ...
        #self.color_keys.append("white body")   # buttons
        #self.color_keys.append("white body")   # pin mark
        # or define a complete new list self.color_keys = ["black body", "metal grey pins", "white body", "white body"].
        # However, the order of materials must correspont to the calls of show (..) in self.make()

        #                   v plastik body  v turn inset  v metallic cover   v pins             v numer ring
        self.color_keys = ["black body",   "white body", "metal grey pins", "metal grey pins", "black body"]
    def __init__(self, params):
        PartBase.__init__(self, params)
        self.make_me = params.type == CaseType.THT and params.num_pins >= 2 and params.num_pins <= 24 and params.pin_rows_distance == 7.62
        #        if self.make_me:
        self.licAuthor = "Terje Io"
        self.licEmail = "https://github.com/terjeio"
        self.destination_dir = "Button_Switch_THT.3dshapes"
        self.footprints_dir = "Button_Switch_THT.pretty"
        self.rotation = 90

        self.pin_width = 0.6
        self.pin_thickness = 0.2
        self.pin_length = 3.2

        self.body_width = 9.9
        self.body_height = 5.85
        self.body_length = self.num_pins * 1.27 + 3.9 / 2.0
        self.body_board_distance = 0.0
        self.body_board_pad_height = 0.5

        self.button_width = 1.4
        self.button_length = 1.6
        self.button_base = 3.5
        self.button_heigth = 1.2

        self.color_keys[0] = "red body"  #body
        self.color_keys.append("white body")  #buttons
        self.color_keys.append("white body")  #buttons

        self.first_pin_pos = (self.pin_pitch * (self.num_pins / 4.0 - 0.5),
                              self.pin_rows_distance / 2.0)
        self.offsets = ((self.first_pin_pos[1], -self.first_pin_pos[0],
                         self.body_board_distance))
    def __init__(self, params):
        PartBase.__init__(self, params)
#        self.make_me = params.type == CaseType.THT and params.num_pins >= 2 and params.num_pins <= 24 and params.pin_rows_distance == 7.62
        self.make_me = self.num_pins / 2 in [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]
#        if self.make_me:
        self.licAuthor = "Terje Io"
        self.licEmail = "https://github.com/terjeio"
        self.destination_dir = "Button_Switch_THT.3dshapes"
        self.footprints_dir = "Button_Switch_THT.pretty"
        self.rotation = 180

        self.pin_rows_distance = 7.62
        self.pin_pitch = 2.54
        self.pin_width = 0.6
        self.pin_thickness = 0.2
        self.pin_length = 3.2

        self.body_width = 10.8
        self.body_height = 10.2
        self.body_length = ((self.num_pins * self.pin_pitch) / 2.0) + 1.56
        self.body_board_distance = 0
        self.body_board_pad_height = 0.5

        self.button_width = 1.3
        self.button_length = 0.9
        self.button_base = 3.5
        self.button_heigth = 4.0

        self.color_keys[0] = "blue body"      # body
        self.color_keys.append("white body")  # buttons
        self.color_keys.append("white body")  # pin mark

        self.first_pin_pos = (self.pin_pitch * (self.num_pins / 4.0 - 0.5), self.pin_rows_distance)
        self.offsets =  (((self.body_length / 2.0) - 1.40 - self.pin_width, self.pin_rows_distance / 2.0, self.body_board_distance))
    def __init__(self, params):
        PartBase.__init__(self, params)
        self.make_me = params.type == CaseType.THT and params.pin_style == PinStyle.STRAIGHT
        self.licAuthor = "Terje Io"
        self.licEmail = "https://github.com/terjeio"
        self.destination_dir = "Conn_PinSocket_{0:03.2f}mm.3dshapes".format(self.pin_pitch)
        self.footprints_dir = "Conn_PinSocket_{0:03.2f}mm.pretty".format(self.pin_pitch)
        self.rotation = 90
        self.pin_style = params.pin_style

        self.pin_width        = params.pin_width
        self.pin_thickness    = params.pin_thickness
        self.pin_length       = params.pin_length + self.pin_thickness
        self.pinsocket_offset = params.pins_offset
        self.body_height      = params.body_height
        self.body_overlength  = params.body_overlength
        self.body_width       = params.body_width
        self.body_offset      = params.body_offset
        self.pin_row_distance = (params.num_pin_rows - 1) * self.pin_pitch
        self.pin_socket_size  = self.pin_width

        self.body_length = self.num_pins * self.pin_pitch / self.num_pin_rows
        self.body_board_distance = self.pin_thickness

        self.color_keys[1] = "gold pins"
        self.first_pin_pos = (self.pin_pitch * (self.num_pins / 2.0 / self.num_pin_rows - 0.5), self.pin_row_distance / 2.0 - self.pinsocket_offset)

        self.offsets = (-self.first_pin_pos[1] - self.pinsocket_offset * 2.0, -self.first_pin_pos[0], 0)
示例#5
0
    def __init__(self, params):
        PartBase.__init__(self, params)
        self.make_me = params.type == CaseType.SMD and params.num_pins >= 2 and params.num_pins <= 24 and params.pin_rows_distance == 7.62
        self.licAuthor = "Terje Io"
        self.licEmail = "https://github.com/terjeio"
        self.destination_dir = "Button_Switch_SMD.3dshapes"
        self.footprints_dir = "Button_Switch_SMD.pretty"
        self.rotation = 180

        self.pin_length = 1.0
        self.pin_thickness = 0.2
        self.pin_width = 0.8
        self.pin_bottom_length = 0.6

        self.body_width = 6.7
        self.body_overall_width = 8.61
        self.body_height = 2.5
        self.body_length = self.num_pins * self.pin_pitch / 2.0 + 1.56
        self.pin_rows_distance = params.pin_rows_distance - 3.1

        self.body_board_distance = 0.1
        self.button_width = 1.2
        self.button_length = 1.5
        self.button_base = 3.0
        self.button_heigth = 0.6
        self.button_pocket_dept = 0.5

        self.color_keys.append("white body") # buttons
        self.color_keys.append("white body") # pin mark

        self.first_pin_pos = (self.pin_pitch * (self.num_pins / 4.0 - 0.5), self.body_width / 2.0)

        self.offsets = (0.0, 0.0, self.body_board_distance)
    def __init__(self, params):
        PartBase.__init__(self, params)
        self.make_me = self.num_pins >= 4
        self.licAuthor = "Terje Io"
        self.licEmail = "https://github.com/terjeio"
        self.destination_dir = "Package_DIP.3dshapes"
        self.footprints_dir = "Package_DIP.pretty"
        self.isTHT = self.type == CaseType.THT
        self.rotation = 270
        self.pin_socket_diameter = 1.524
        self.pin_socket_radius = self.pin_socket_diameter / 2.0
        self.pin_radius = 0.508 / 2.0

        self.body_width = self.pin_rows_distance + 2.54
        self.body_height = 2.667
        self.body_length = self.num_pins * 1.27
        self.body_board_distance = 1.3
        self.body_bottom_pockets =  0 if self.num_pins <= 4\
                                       else (1 if self.num_pins <= 10\
                                                else (3 if self.num_pins > 28 else 2))

        self.first_pin_pos = (self.pin_pitch * (self.num_pins / 4.0 - 0.5),
                              self.pin_rows_distance / 2.0)

        offsetX = (self.first_pin_pos[1] if self.isTHT else 0)
        offsetY = (-self.first_pin_pos[0] if self.isTHT else 0)
        self.offsets = (offsetX, offsetY, self.body_board_distance)
    def __init__(self, params):
        PartBase.__init__(self, params)
        self.make_me = self.num_pins >= 4
        self.licAuthor = "Terje Io"
        self.licEmail = "https://github.com/terjeio"
        self.destination_dir = "Package_DIP.3dshapes"
        self.footprints_dir = "Package_DIP.pretty"
        self.isTHT = self.type == CaseType.THT
        self.rotation = 270
        self.pin_socket_diameter = 1.524
        self.pin_socket_radius = self.pin_socket_diameter / 2.0
        self.pin_radius = 0.508 / 2.0

        self.body_width = self.pin_rows_distance + 2.54
        self.body_height = 2.667
        self.body_length = self.num_pins * 1.27
        self.body_board_distance = 1.3
        self.body_bottom_pockets =  0 if self.num_pins <= 4\
                                       else (1 if self.num_pins <= 10\
                                                else (3 if self.num_pins > 28 else 2))

        self.first_pin_pos = (self.pin_pitch * (self.num_pins / 4.0 - 0.5), self.pin_rows_distance / 2.0)

        offsetX = (self.first_pin_pos[1] if self.isTHT else 0)
        offsetY = (-self.first_pin_pos[0] if self.isTHT else 0)
        self.offsets = (offsetX, offsetY, self.body_board_distance)
示例#8
0
    def __init__(self, params):
        PartBase.__init__(self, params)
        self.make_me = self.num_pins / 2 in [
            1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12
        ]
        #        if self.make_me:
        self.licAuthor = "Terje Io"
        self.licEmail = "https://github.com/terjeio"
        self.destination_dir = "Button_Switch_THT.3dshapes"
        self.footprints_dir = "Button_Switch_THT.pretty"

        self.rotation = 180
        self.pin_rows_distance = 7.62
        self.pin_pitch = 2.54

        self.pin_width = 0.6
        self.pin_thickness = 0.2
        self.pin_length = 3.2

        self.body_width = 9.9
        self.body_height = 5.85
        self.body_length = ((self.num_pins * self.pin_pitch) / 2.0) + 2.18
        self.body_board_distance = 0.0
        self.body_board_pad_height = 0.5

        self.button_width = 1.4
        self.button_length = 1.6
        self.button_base = 3.62
        self.button_heigth = 1.2

        self.color_keys[0] = "blue body"  #body
        self.color_keys.append("white body")  #buttons
        self.color_keys.append("white body")  #buttons

        self.first_pin_pos = (self.pin_pitch * (self.num_pins / 4.0 - 0.5),
                              (self.pin_rows_distance / 2.0) -
                              self.pin_thickness)
        self.offsets = (((self.body_length / 2.0) - 1.8 - self.pin_width,
                         self.pin_rows_distance / 2.0,
                         self.body_board_distance))