def make_radial_th(params): L = params.L # overall height D = params.D # body diameter d = params.d # lead diameter F = params.F # lead separation (center to center) ll = params.ll # lead length la = params.la # extra lead length of the anode bs = params.bs # board separation if params.pin3: pin3_width = params.pin3[0] pin3_x = params.pin3[1] pin3_y = params.pin3[2] bt = 1. # flat part before belt if D > 4: bd = 0.2 # depth of the belt else: bd = 0.15 # depth of the belt bh = 1. # height of the belt bf = 0.3 # belt fillet tc = 0.2 # cut thickness for the bottom&top dc = D * 0.7 # diameter of the bottom&top cut ts = 0.1 # thickness of the slots at the top in the shape of (+) ws = 0.1 # width of the slots ef = 0.2 # top and bottom edges fillet rot = params.rotation dest_dir_pref = params.dest_dir_prefix bpt = 0.1 # bottom plastic thickness (not visual) tmt = ts * 2 # top metallic part thickness (not visual) # TODO: calculate width of the cathode marker bar from the body size ciba = 45. # angle of the cathode identification bar # TODO: calculate marker sizes according to the body size mmb_h = 2. # lenght of the (-) marker on the cathode bar mmb_w = 0.5 # rough width of the marker ef_s2 = ef / sqrt(2) ef_x = ef - ef / sqrt(2) def bodyp(): return cq.Workplane("XZ").move(0, bs).\ move(0, tc+bpt).\ line(dc/2., 0).\ line(0, -(tc+bpt)).\ line(D/2.-dc/2.-ef, 0).\ threePointArc((D/2.-(ef_x), bs+(ef_x)), (D/2., bs+ef)).\ line(0, bt).\ threePointArc((D/2.-bd, bs+bt+bh/2.), (D/2., bs+bt+bh)).\ lineTo(D/2., L+bs-ef).\ threePointArc((D/2.-(ef_x), L+bs-(ef_x)), (D/2.-ef, L+bs)).\ lineTo(dc/2., L+bs).\ line(0, -(tc+tmt)).\ line(-dc/2., 0).\ close() body = bodyp().revolve(360 - ciba, (0, 0, 0), (0, 1, 0)) bar = bodyp().revolve(ciba, (0, 0, 0), (0, 1, 0)) #show(body) #show(bar) # # fillet the belt edges BS = cq.selectors.BoxSelector # note that edges are selected from their centers b_r = D / 2. - bd # inner radius of the belt try: #body = body.edges(BS((-0.5,-0.5, bs+bt-0.01), (0.5, 0.5, bs+bt+bh+0.01))).\ # fillet(bf) pos = D / 10 body = body.edges(BS((-pos,-pos, bs+bt-0.2), (pos, pos, bs+bt+bh+0.01))).\ fillet(bf) except: #stop expVRML.sayerr("") expVRML.sayerr("not filleting") #show(body) #show(bar) #raise pass #b_r = D/2.-bd # inner radius of the belt bar = bar.edges(BS((b_r/sqrt(2), 0, bs+bt-0.01),(b_r, -b_r/sqrt(2), bs+bt+bh+0.01))).\ fillet(bf) body = body.rotate((0, 0, 0), (0, 0, 1), 180 - ciba / 2) bar = bar.rotate((0, 0, 0), (0, 0, 1), 180 + ciba / 2) # draw the plastic at the bottom bottom = cq.Workplane("XY").workplane(offset=bs+tc).\ circle(dc/2).extrude(bpt) body = body.union(bottom) # draw the metallic part at the top top = cq.Workplane("XY").workplane(offset=bs+L-tc-ts).\ circle(dc/2).extrude(tmt) # draw the slots on top in the shape of plus (+) top = top.faces(">Z").workplane().move(ws/2,ws/2).\ line(0,D).line(-ws,0).line(0,-D).\ line(-D,0).line(0,-ws).line(D,0).\ line(0,-D).line(ws,0).line(0,D).\ line(D,0).line(0,ws).close().cutBlind(-ts) # draw the (-) marks on the bar n = int(L / (2 * mmb_h)) # number of (-) marks to draw points = [] first_z = (L - (2 * n - 1) * mmb_h) / 2 for i in range(n): points.append((0, (i + 0.25) * 2 * mmb_h + first_z)) mmb = cq.Workplane("YZ", (-D/2,0,bs)).pushPoints(points).\ box(mmb_w, mmb_h, 2).\ edges("|X").fillet(mmb_w/2.-0.001) mmb = mmb.cut(mmb.translate((0, 0, 0)).cut(bar)) bar = bar.cut(mmb) # draw the leads leads = cq.Workplane("XY").workplane(offset=bs+tc).\ center(-F/2,0).circle(d/2).extrude(-(ll+tc)).\ center(F,0).circle(d/2).extrude(-(ll+tc+la+0.1)).translate((0,0,0.1)) #need overlap for fusion if params.pin3: leads = leads.union(cq.Workplane("XY").workplane(offset=bs+tc).\ circle(pin3_width/2).extrude(-(ll+tc+la+0.1)).translate((pin3_x,pin3_y,0.1))) #need overlap for fusion) #show(body) #show(mmb) #show(bar) #show(leads) #show(top) #stop return (body, mmb, bar, leads, top) #body, base, mark, pins, top
if len(sys.argv) < 3: FreeCAD.Console.PrintMessage( 'No variant name is given! building QFN-28-1EP_6x6mm_Pitch0.65mm') model_to_build = 'QFN-28-1EP_6x6mm_Pitch0.65mm' else: model_to_build = sys.argv[2] if len(sys.argv) == 4: FreeCAD.Console.PrintMessage(sys.argv[3] + '\r\n') if (sys.argv[3].find('no-pinmark-color') != -1): color_pin_mark = False else: color_pin_mark = True if model_to_build == "all": expVRML.sayerr( "'all' is not supported for this families\nuse 'allQFN' or allDiodes instead" ) elif model_to_build == "allQFN": variants = kicad_naming_params_qfn.keys() save_memory = True elif model_to_build == "allDiodes": variants = kicad_naming_params_diode.keys() footprints_dir = footprints_dir_diodes save_memory = True else: variants = [model_to_build] for variant in variants: excluded_pins_x = () ##no pin excluded excluded_pins_xmirror = () ##no pin excluded place_pinMark = True ##default =True used to exclude pin mark to build sot23-3; sot23-5; sc70 (asimmetrical pins, no pinmark)
color_pin_mark=True if len(sys.argv) < 3: FreeCAD.Console.PrintMessage('No variant name is given! building SOIC-8_3.9x4.9mm_Pitch1.27mm') model_to_build='SOIC-8_3.9x4.9mm_Pitch1.27mm' else: model_to_build=sys.argv[2] if len(sys.argv)==4: FreeCAD.Console.PrintMessage(sys.argv[3]+'\r\n') if (sys.argv[3].find('no-pinmark-color')!=-1): color_pin_mark=False else: color_pin_mark=True close_doc=False if model_to_build == "all": expVRML.sayerr("'all' is not supported for this families\nuse 'allSOIC' or 'allSSOP' or 'allSOT' or 'allQFP' or 'allTSSOP' instead") # variants = all_params.keys() #elif model_to_build == "SOIC": elif model_to_build == "allSOIC": variants = kicad_naming_params_soic.keys() elif model_to_build == "allQFP": variants = kicad_naming_params_qfp.keys() close_doc=True #QFP are too many ... closing doc is requied to avoid memory leak elif model_to_build == "allSSOP": variants = all_params_ssop.keys() elif model_to_build == "allTSSOP": variants = all_params_tssop.keys() elif model_to_build == "allSOT": variants = kicad_naming_params_sot.keys() else: variants = [model_to_build]
def make_radial_th(params): L = params.L # overall height D = params.D # body diameter d = params.d # lead diameter F = params.F # lead separation (center to center) ll = params.ll # lead length la = params.la # extra lead length of the anode bs = params.bs # board separation if params.pin3: pin3_width = params.pin3[0] pin3_x = params.pin3[1] pin3_y = params.pin3[2] pol = params.pol bt = 1. # flat part before belt if D > 4: bd = 0.2 # depth of the belt else: bd = 0.15 # depth of the belt bh = 1. # height of the belt bf = 0.3 # belt fillet tc = 0.2 # cut thickness for the bottom&top dc = D*0.7 # diameter of the bottom&top cut ts = 0.1 # thickness of the slots at the top in the shape of (+) ws = 0.1 # width of the slots ef = 0.2 # top and bottom edges fillet rot = params.rotation dest_dir_pref = params.dest_dir_prefix bpt = 0.1 # bottom plastic thickness (not visual) tmt = ts*2 # top metallic part thickness (not visual) # TODO: calculate width of the cathode marker bar from the body size ciba = 45. # angle of the cathode identification bar # TODO: calculate marker sizes according to the body size mmb_h = 2. # lenght of the (-) marker on the cathode bar mmb_w = 0.5 # rough width of the marker ef_s2 = ef/sqrt(2) ef_x = ef-ef/sqrt(2) def bodyp(): return cq.Workplane("XZ").move(0, bs).\ move(0, tc+bpt).\ line(dc/2., 0).\ line(0, -(tc+bpt)).\ line(D/2.-dc/2.-ef, 0).\ threePointArc((D/2.-(ef_x), bs+(ef_x)), (D/2., bs+ef)).\ line(0, bt).\ threePointArc((D/2.-bd, bs+bt+bh/2.), (D/2., bs+bt+bh)).\ lineTo(D/2., L+bs-ef).\ threePointArc((D/2.-(ef_x), L+bs-(ef_x)), (D/2.-ef, L+bs)).\ lineTo(dc/2., L+bs).\ line(0, -(tc+tmt)).\ line(-dc/2., 0).\ close() if pol: body = bodyp().revolve(360-ciba, (0,0,0), (0,1,0)) bar = bodyp().revolve(ciba, (0,0,0), (0,1,0)) else: body = bodyp().revolve(360, (0,0,0), (0,1,0)) # Hide bar inside the cap bar = cq.Workplane("XY").workplane(offset=bs + 1.0).moveTo(0.0, 0.0).rect(0.001, 0.001).extrude(0.001) #show(body) #show(bar) # # fillet the belt edges BS = cq.selectors.BoxSelector # note that edges are selected from their centers b_r = D/2.-bd # inner radius of the belt try: #body = body.edges(BS((-0.5,-0.5, bs+bt-0.01), (0.5, 0.5, bs+bt+bh+0.01))).\ # fillet(bf) pos=D/10 body = body.edges(BS((-pos,-pos, bs+bt-0.2), (pos, pos, bs+bt+bh+0.01))).\ fillet(bf) except: #stop expVRML.sayerr("") expVRML.sayerr("not filleting") #show(body) #show(bar) #raise pass # draw the plastic at the bottom bottom = cq.Workplane("XY").workplane(offset=bs+tc).\ circle(dc/2).extrude(bpt) body = body.union(bottom) # draw the metallic part at the top top = cq.Workplane("XY").workplane(offset=bs+L-tc-ts).\ circle(dc/2).extrude(tmt) # draw the slots on top in the shape of plus (+) top = top.faces(">Z").workplane().move(ws/2,ws/2).\ line(0,D).line(-ws,0).line(0,-D).\ line(-D,0).line(0,-ws).line(D,0).\ line(0,-D).line(ws,0).line(0,D).\ line(D,0).line(0,ws).close().cutBlind(-ts) if pol: #b_r = D/2.-bd # inner radius of the belt bar = bar.edges(BS((b_r/sqrt(2), 0, bs+bt-0.01),(b_r, -b_r/sqrt(2), bs+bt+bh+0.01))).\ fillet(bf) body = body.rotate((0,0,0), (0,0,1), 180-ciba/2) bar = bar.rotate((0,0,0), (0,0,1), 180+ciba/2) # draw the (-) marks on the bar n = int(L/(2*mmb_h)) # number of (-) marks to draw points = [] first_z = (L-(2*n-1)*mmb_h)/2 for i in range(n): points.append((0, (i+0.25)*2*mmb_h+first_z)) mmb = cq.Workplane("YZ", (-D/2,0,bs)).pushPoints(points).\ box(mmb_w, mmb_h, 2).\ edges("|X").fillet(mmb_w/2.-0.001) mmb = mmb.cut(mmb.translate((0,0,0)).cut(bar)) bar = bar.cut(mmb) else: body = body.rotate((0,0,0), (0,0,1), 180) # Hide mmb inside the cap mmb = cq.Workplane("XY").workplane(offset=bs + 1.0).moveTo(0.0, 0.0).rect(0.001, 0.001).extrude(0.001) # draw the leads leads = cq.Workplane("XY").workplane(offset=bs+tc).\ center(-F/2,0).circle(d/2).extrude(-(ll+tc)).\ center(F,0).circle(d/2).extrude(-(ll+tc+la+0.1)).translate((0,0,0.1)) #need overlap for fusion if params.pin3: leads = leads.union(cq.Workplane("XY").workplane(offset=bs+tc).\ circle(pin3_width/2).extrude(-(ll+tc+la+0.1)).translate((pin3_x,pin3_y,0.1))) #need overlap for fusion) #show(body) #show(mmb) #show(bar) #show(leads) #show(top) #stop return (body, mmb, bar, leads, top) #body, base, mark, pins, top
if len(sys.argv) < 3: FreeCAD.Console.PrintMessage( 'No variant name is given! building D_SOD-323') model_to_build = 'D_SOD-323F' else: model_to_build = sys.argv[2] if len(sys.argv) == 4: FreeCAD.Console.PrintMessage(sys.argv[3] + '\r\n') if (sys.argv[3].find('no-pinmark-color') != -1): color_pin_mark = False else: color_pin_mark = True save_memory = False #reducing memory consuming for all generation params if model_to_build == "all": expVRML.sayerr( "'all' is not supported for this families\nuse 'allSOT' or 'allDiodes' instead" ) # variants = all_params.keys() #elif model_to_build == "SOIC": elif model_to_build == "allSOT": variants = kicad_naming_params_sot.keys() save_memory = True elif model_to_build == "allDiodes": variants = kicad_naming_params_diode.keys() footprints_dir = footprints_dir_diodes save_memory = True else: variants = [model_to_build] for variant in variants: place_pinMark = True ##default =True used to exclude pin mark to build sot23-3; sot23-5; sc70 (asimmetrical pins, no pinmark)
color_pin_mark=True if len(sys.argv) < 3: FreeCAD.Console.PrintMessage('No variant name is given! building D_SOD-323') model_to_build='D_SOD-323F' else: model_to_build=sys.argv[2] if len(sys.argv)==4: FreeCAD.Console.PrintMessage(sys.argv[3]+'\r\n') if (sys.argv[3].find('no-pinmark-color')!=-1): color_pin_mark=False else: color_pin_mark=True save_memory=False #reducing memory consuming for all generation params if model_to_build == "all": expVRML.sayerr("'all' is not supported for this families\nuse 'allSOT' or 'allDiodes' instead") # variants = all_params.keys() #elif model_to_build == "SOIC": elif model_to_build == "allSOT": variants = kicad_naming_params_sot.keys() save_memory=True elif model_to_build == "allDiodes": variants = kicad_naming_params_diode.keys() footprints_dir=footprints_dir_diodes save_memory=True else: variants = [model_to_build] for variant in variants: place_pinMark=True ##default =True used to exclude pin mark to build sot23-3; sot23-5; sc70 (asimmetrical pins, no pinmark)