From 86c9f747637394f9140a0742ed16bc5df322b522 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20H=C3=BCltl?= Date: Fri, 8 May 2020 21:20:56 +0200 Subject: [PATCH 1/6] updated files for usage with python3 and newer version of pcbnew --- GenFixture.py | 8 ++++---- genfixture.sh | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/GenFixture.py b/GenFixture.py index 670580c..69200be 100755 --- a/GenFixture.py +++ b/GenFixture.py @@ -149,7 +149,7 @@ def PlotDXF(self, path): popt.SetSubtractMaskFromSilk(False) # Do the BRD edges in black - popt.SetColor(BLACK) + popt.SetColor(COLOR4D(0,0,0,1.0)) # color4d = RED, GREEN, BLUE, OPACITY # Open file pctl.SetLayer(Edge_Cuts) @@ -214,7 +214,7 @@ def Generate(self, path): testout= path + "/" + self.prj_name + "-test.dxf" # This will take a while, print something - print "Generating Fixture..." + print ("Generating Fixture...") # Create test part os.system ("openscad %s -D\'mode=\"testcut\"\' -o %s openfixture.scad" % (args, testout)) @@ -226,7 +226,7 @@ def Generate(self, path): os.system ("openscad %s -D\'mode=\"lasercut\"\' -o %s openfixture.scad" % (args, dxfout)) # Print output - print "Fixture generated: %s" % dxfout + print ("Fixture generated: %s" % dxfout) def GetTestPointStr (self): tps = "[" @@ -252,7 +252,7 @@ def GetTestPoints (self): #else check ignore cases elif ((p.IsOnLayer (self.ignore_layer) == True) or (p.IsOnLayer (self.paste) == True) or - (p.GetAttribute () != PAD_SMD)): + (p.GetAttribute () != PAD_ATTRIB_SMD)): continue # Print position diff --git a/genfixture.sh b/genfixture.sh index de510b9..6dbc7cb 100755 --- a/genfixture.sh +++ b/genfixture.sh @@ -25,5 +25,5 @@ NUT_F2F=5.45 NUT_C2C=6.10 # Call python wrapper -python GenFixture.py --board $BOARD --layer $LAYER --rev $REV --mat_th $MAT --pcb_th $PCB --out $OUTPUT --screw_len $SCREW_LEN --screw_d $SCREW_D --washer_th $WASHER_TH --nut_th $NUT_TH --nut_f2f $NUT_F2F --nut_c2c $NUT_C2C --border $BORDER +python3 GenFixture.py --board $BOARD --layer $LAYER --rev $REV --mat_th $MAT --pcb_th $PCB --out $OUTPUT --screw_len $SCREW_LEN --screw_d $SCREW_D --washer_th $WASHER_TH --nut_th $NUT_TH --nut_f2f $NUT_F2F --nut_c2c $NUT_C2C --border $BORDER From a31938eb4753106752d914ee53e4a11d86ad852e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20H=C3=BCltl?= Date: Fri, 8 May 2020 23:07:37 +0200 Subject: [PATCH 2/6] added parameter for DXF plot export so it will be converted to mm --- GenFixture.py | 229 ++++++++++++++++++++++++++------------------------ 1 file changed, 117 insertions(+), 112 deletions(-) diff --git a/GenFixture.py b/GenFixture.py index 69200be..d31fd28 100755 --- a/GenFixture.py +++ b/GenFixture.py @@ -27,9 +27,9 @@ DEFAULT_SCREW_D = 3.0 DEFAULT_SCREW_LEN = 14 + # Generate fixture class class GenFixture: - # Layers layer = F_Cu paste = F_Paste @@ -54,24 +54,24 @@ class GenFixture: # Optional arguments rev = None - washer_th=None - nut_f2f=None - nut_c2c=None - nut_th=None - pivot_d=None - border=None + washer_th = None + nut_f2f = None + nut_c2c = None + nut_th = None + pivot_d = None + border = None # Board dimensions - min_y = float ("inf") - origin = [ float ("inf"), float ("inf") ] + min_y = float("inf") + origin = [float("inf"), float("inf")] dims = [0, 0] test_points = [] - + def __init__(self, prj_name, brd, mat_th): self.prj_name = prj_name self.brd = brd - self.mat_th = float (mat_th) - + self.mat_th = float(mat_th) + def __exit__(self, type, value, traceback): pass @@ -94,11 +94,11 @@ def SetOptional(self, rev=None, washer_th=None, nut_f2f=None, nut_c2c=None, nut_ def SetParams(self, pcb_th, screw_len, screw_d): if pcb_th is not None: - self.pcb_th = float (pcb_th) + self.pcb_th = float(pcb_th) if screw_len is not None: - self.screw_len = float (screw_len) + self.screw_len = float(screw_len) if screw_d is not None: - self.screw_d = float (screw_d) + self.screw_d = float(screw_d) def SetLayers(self, layer=-1, ilayer=-1, flayer=-1): if layer != -1: @@ -116,16 +116,16 @@ def SetLayers(self, layer=-1, ilayer=-1, flayer=-1): self.mirror = True def Round(self, x, base=0.01): - return round(base*round(x/base), 2) + return round(base * round(x / base), 2) def PlotDXF(self, path): # Save auxillary origin - aux_origin_save = self.brd.GetAuxOrigin () + aux_origin_save = self.brd.GetAuxOrigin() # Set new aux origin to upper left side of board - self.brd.SetAuxOrigin (wxPoint (FromMM(self.origin[0]), FromMM(self.origin[1]))) - + self.brd.SetAuxOrigin(wxPoint(FromMM(self.origin[0]), FromMM(self.origin[1]))) + # Get pointers to controllers pctl = PLOT_CONTROLLER(self.brd) popt = pctl.GetPlotOptions() @@ -134,22 +134,23 @@ def PlotDXF(self, path): popt.SetOutputDirectory(path) # Set some important plot options: + popt.SetDXFPlotUnits(DXF_PLOTTER.DXF_UNIT_MILLIMETERS) popt.SetPlotFrameRef(False) popt.SetLineWidth(FromMM(0.1)) popt.SetAutoScale(False) popt.SetScale(1) popt.SetMirror(self.mirror) popt.SetUseGerberAttributes(False) - popt.SetExcludeEdgeLayer(False); + popt.SetExcludeEdgeLayer(False) # Use auxillary origin - popt.SetUseAuxOrigin(True) + popt.SetUseAuxOrigin(False) # This by gerbers only (also the name is truly horrid!) popt.SetSubtractMaskFromSilk(False) # Do the BRD edges in black - popt.SetColor(COLOR4D(0,0,0,1.0)) # color4d = RED, GREEN, BLUE, OPACITY + popt.SetColor(COLOR4D(0, 0, 0, 1.0)) # color4d = RED, GREEN, BLUE, OPACITY # Open file pctl.SetLayer(Edge_Cuts) @@ -162,27 +163,27 @@ def PlotDXF(self, path): pctl.ClosePlot() # Restore origin - self.brd.SetAuxOrigin (aux_origin_save) + self.brd.SetAuxOrigin(aux_origin_save) def Generate(self, path): # Get origin and board dimensions - self.GetOriginDimensions () + self.GetOriginDimensions() # Get test points - self.GetTestPoints () + self.GetTestPoints() # Plot DXF - self.PlotDXF (path) + self.PlotDXF(path) # Get revision if self.rev is None: - self.rev = "rev.%s" % self.brd.GetTitleBlock().GetRevision () + self.rev = "rev.%s" % self.brd.GetTitleBlock().GetRevision() if self.rev == "": self.rev = "rev.0" # Call openscad to generate fixture - args = "-D\'test_points=%s\'" % self.GetTestPointStr () + args = "-D\'test_points=%s\'" % self.GetTestPointStr() args += " -D\'tp_min_y=%.02f\'" % self.min_y args += " -D\'mat_th=%.02f\'" % self.mat_th args += " -D\'pcb_th=%.02f\'" % self.pcb_th @@ -196,67 +197,70 @@ def Generate(self, path): if self.rev != None: args += " -D\'rev=\"%s\"\'" % self.rev if self.washer_th != None: - args += " -D\'washer_th=%.02f\'" % float (self.washer_th) + args += " -D\'washer_th=%.02f\'" % float(self.washer_th) if self.nut_f2f != None: - args += " -D\'nut_od_f2f=%.02f\'" % float (self.nut_f2f) + args += " -D\'nut_od_f2f=%.02f\'" % float(self.nut_f2f) if self.nut_c2c != None: - args += " -D\'nut_od_c2c=%.02f\'" % float (self.nut_c2c) + args += " -D\'nut_od_c2c=%.02f\'" % float(self.nut_c2c) if self.nut_th != None: - args += " -D\'nut_th=%.02f\'" % float (self.nut_th) + args += " -D\'nut_th=%.02f\'" % float(self.nut_th) if self.pivot_d != None: - args += " -D\'pivot_d=%.02f\'" % float (self.pivot_d) + args += " -D\'pivot_d=%.02f\'" % float(self.pivot_d) if self.border != None: - args += " -D\'border=%.02f\'" % float (self.border) + args += " -D\'border=%.02f\'" % float(self.border) # Create output file name dxfout = path + "/" + self.prj_name + "-fixture.dxf" pngout = path + "/" + self.prj_name + "-fixture.png" - testout= path + "/" + self.prj_name + "-test.dxf" + testout = path + "/" + self.prj_name + "-test.dxf" # This will take a while, print something - print ("Generating Fixture...") - + print("Generating Fixture...") + # Create test part - os.system ("openscad %s -D\'mode=\"testcut\"\' -o %s openfixture.scad" % (args, testout)) - + print("openscad {} -D\'mode=\"testcut\"\' -o {} openfixture.scad".format(args, testout)) + os.system("openscad %s -D\'mode=\"testcut\"\' -o %s openfixture.scad" % (args, testout)) + # Create rendering - os.system ("openscad %s -D\'mode=\"3dmodel\"\' --render -o %s openfixture.scad" % (args, pngout)) - + print("openscad {} -D\'mode=\"3dmodel\"\' --render -o {} openfixture.scad".format(args, pngout)) + os.system("openscad %s -D\'mode=\"3dmodel\"\' --render -o %s openfixture.scad" % (args, pngout)) + # Create laser cuttable fixture - os.system ("openscad %s -D\'mode=\"lasercut\"\' -o %s openfixture.scad" % (args, dxfout)) + print("openscad {} -D\'mode=\"lasercut\"\' -o {} openfixture.scad".format(args,dxfout)) + os.system("openscad %s -D\'mode=\"lasercut\"\' -o %s openfixture.scad" % (args, dxfout)) # Print output - print ("Fixture generated: %s" % dxfout) + print("Fixture generated: %s" % dxfout) - def GetTestPointStr (self): + def GetTestPointStr(self): tps = "[" for tp in self.test_points: tps += "[%.02f,%.02f]," % (tp[0], tp[1]) return (tps + "]") - def GetTestPoints (self): + def GetTestPoints(self): # Iterate over all pads - for m in self.brd.GetModules (): + for m in self.brd.GetModules(): # Iterate over all pads - for p in m.Pads (): + for p in m.Pads(): # Check that there is no paste and it's on front copper layer - if (p.IsOnLayer (self.layer) == True): + if (p.IsOnLayer(self.layer) == True): # Are we forcing this pad? - if (p.IsOnLayer (self.force_layer) == True): + if (p.IsOnLayer(self.force_layer) == True): pass - - #else check ignore cases - elif ((p.IsOnLayer (self.ignore_layer) == True) or - (p.IsOnLayer (self.paste) == True) or - (p.GetAttribute () != PAD_ATTRIB_SMD)): + + # else check ignore cases + elif ((p.IsOnLayer(self.ignore_layer) == True) or + (p.IsOnLayer(self.paste) == True) or + (p.GetAttribute() != PAD_ATTRIB_SMD)): continue - + # Print position - tp = ToMM (p.GetPosition ()) + tp = ToMM(p.GetPosition()) # Round x and y, invert x if mirrored if self.mirror is False: @@ -264,15 +268,15 @@ def GetTestPoints (self): else: x = self.dims[0] - (self.Round(tp[0] - self.origin[0])) y = self.Round(tp[1] - self.origin[1]) - #print "tp = (%f, %f)" % (x,y) - + # print "tp = (%f, %f)" % (x,y) + # Check if less than min if y < self.min_y: self.min_y = y - + # Save coordinates of pad - self.test_points.append ([x, y]) - + self.test_points.append([x, y]) + def GetOriginDimensions(self): if (self.brd is None): return None @@ -282,24 +286,24 @@ def GetOriginDimensions(self): max_y = 0 # Get all drawings - for line in self.brd.GetDrawings (): + for line in self.brd.GetDrawings(): # Check that it's in the outline layer - if line.GetLayerName () == 'Edge.Cuts': + if line.GetLayerName() == 'Edge.Cuts': # Get bounding box - bb = line.GetBoundingBox () - x = ToMM (bb.GetX ()) - y = ToMM (bb.GetY ()) + bb = line.GetBoundingBox() + x = ToMM(bb.GetX()) + y = ToMM(bb.GetY()) # Debug - #print "(%f, %f)" % (x, y) - + # print "(%f, %f)" % (x, y) + # Min x/y will be origin if x < self.origin[0]: - self.origin[0] = self.Round (x) + self.origin[0] = self.Round(x) if y < self.origin[1]: - self.origin[1] = self.Round (y) + self.origin[1] = self.Round(y) # Max x.y will be dimensions if x > max_x: @@ -308,77 +312,78 @@ def GetOriginDimensions(self): max_y = y # Calculate dimensions - self.dims[0] = self.Round (max_x - self.origin[0]) - self.dims[1] = self.Round (max_y - self.origin[1]) - + self.dims[0] = self.Round(max_x - self.origin[0]) + self.dims[1] = self.Round(max_y - self.origin[1]) + + if __name__ == '__main__': # Create parser - parser = argparse.ArgumentParser () + parser = argparse.ArgumentParser() # Add required arguments - parser.add_argument ('--board', help='', required=True) - parser.add_argument ('--mat_th', help='material thickness (mm)', required=True) - parser.add_argument ('--out', help='output directory', required=True) - + parser.add_argument('--board', help='', required=True) + parser.add_argument('--mat_th', help='material thickness (mm)', required=True) + parser.add_argument('--out', help='output directory', required=True) + # Add optional arguments - parser.add_argument ('--pcb_th', help='pcb thickness (mm)') - parser.add_argument ('--screw_len', help='Assembly screw thread length (default = 16mm)') - parser.add_argument ('--screw_d', help='Assembly screw diameter (default=3mm)') - parser.add_argument ('--layer', help='F.Cu | B.Cu') - parser.add_argument ('--flayer', help='Eco1.User | Eco2.User') - parser.add_argument ('--ilayer', help='Eco1.User | Eco2.User') - parser.add_argument ('--rev', help='Override revisiosn') - parser.add_argument ('--washer_th', help='Washer thickness for hinge') - parser.add_argument ('--nut_f2f', help='hex nut flat to flat (mm)') - parser.add_argument ('--nut_c2c', help='hex nut corner to corner (mm)') - parser.add_argument ('--nut_th', help='hex nut thickness (mm)') - parser.add_argument ('--pivot_d', help='Pivot diameter (mm)') - parser.add_argument ('--border', help='Board (ledge) under pcb (mm)') + parser.add_argument('--pcb_th', help='pcb thickness (mm)') + parser.add_argument('--screw_len', help='Assembly screw thread length (default = 16mm)') + parser.add_argument('--screw_d', help='Assembly screw diameter (default=3mm)') + parser.add_argument('--layer', help='F.Cu | B.Cu') + parser.add_argument('--flayer', help='Eco1.User | Eco2.User') + parser.add_argument('--ilayer', help='Eco1.User | Eco2.User') + parser.add_argument('--rev', help='Override revisiosn') + parser.add_argument('--washer_th', help='Washer thickness for hinge') + parser.add_argument('--nut_f2f', help='hex nut flat to flat (mm)') + parser.add_argument('--nut_c2c', help='hex nut corner to corner (mm)') + parser.add_argument('--nut_th', help='hex nut thickness (mm)') + parser.add_argument('--pivot_d', help='Pivot diameter (mm)') + parser.add_argument('--border', help='Board (ledge) under pcb (mm)') # Get args - args = parser.parse_args () + args = parser.parse_args() # Convert path to absolute - out_dir = os.path.abspath (args.out) + out_dir = os.path.abspath(args.out) # If output directory doesn't exist create it - if not os.path.exists (out_dir): - os.makedirs (out_dir) + if not os.path.exists(out_dir): + os.makedirs(out_dir) # Load up the board file - brd = LoadBoard (args.board) + brd = LoadBoard(args.board) # Extract project name - prj_name = os.path.splitext (os.path.basename (args.board))[0] - + prj_name = os.path.splitext(os.path.basename(args.board))[0] + # Save internal parameters - layer = brd.GetLayerID (args.layer) - flayer = brd.GetLayerID (args.flayer) - ilayer = brd.GetLayerID (args.ilayer) + layer = brd.GetLayerID(args.layer) + flayer = brd.GetLayerID(args.flayer) + ilayer = brd.GetLayerID(args.ilayer) # Check for pcb thickness if args.pcb_th is None: args.pcb_th = "1.6" # Create a fixture generator - fixture = GenFixture (prj_name, brd, args.mat_th) + fixture = GenFixture(prj_name, brd, args.mat_th) # Set parameters - fixture.SetParams (args.pcb_th, args.screw_len, args.screw_d); + fixture.SetParams(args.pcb_th, args.screw_len, args.screw_d); # Setup layers - fixture.SetLayers (layer=layer, flayer=flayer, ilayer=ilayer) + fixture.SetLayers(layer=layer, flayer=flayer, ilayer=ilayer) # Set optional arguments - fixture.SetOptional (rev=args.rev, - washer_th=args.washer_th, - nut_f2f=args.nut_f2f, - nut_c2c=args.nut_c2c, - nut_th=args.nut_th, - pivot_d=args.pivot_d, - border=args.border) + fixture.SetOptional(rev=args.rev, + washer_th=args.washer_th, + nut_f2f=args.nut_f2f, + nut_c2c=args.nut_c2c, + nut_th=args.nut_th, + pivot_d=args.pivot_d, + border=args.border) # Generate fixture - fixture.Generate (out_dir) + fixture.Generate(out_dir) # print fixture From b05fcd085891e5c4d2a4c1abdfe59f925774578a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20H=C3=BCltl?= Date: Fri, 8 May 2020 23:57:00 +0200 Subject: [PATCH 3/6] set 'SetUseAuxOrigin' to 'True' so the outline is inside of the fixture --- GenFixture.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/GenFixture.py b/GenFixture.py index d31fd28..6e1b4f4 100755 --- a/GenFixture.py +++ b/GenFixture.py @@ -135,6 +135,7 @@ def PlotDXF(self, path): # Set some important plot options: popt.SetDXFPlotUnits(DXF_PLOTTER.DXF_UNIT_MILLIMETERS) + popt.SetDXFPlotPolygonMode(True) popt.SetPlotFrameRef(False) popt.SetLineWidth(FromMM(0.1)) popt.SetAutoScale(False) @@ -144,7 +145,7 @@ def PlotDXF(self, path): popt.SetExcludeEdgeLayer(False) # Use auxillary origin - popt.SetUseAuxOrigin(False) + popt.SetUseAuxOrigin(True) # This by gerbers only (also the name is truly horrid!) popt.SetSubtractMaskFromSilk(False) @@ -218,7 +219,7 @@ def Generate(self, path): print("Generating Fixture...") # Create test part - print("openscad {} -D\'mode=\"testcut\"\' -o {} openfixture.scad".format(args, testout)) + # print("openscad {} -D\'mode=\"testcut\"\' -o {} openfixture.scad".format(args, testout)) os.system("openscad %s -D\'mode=\"testcut\"\' -o %s openfixture.scad" % (args, testout)) # Create rendering From 7a253f187fcfd0ee5ae117a85f9e3565692c9fcc Mon Sep 17 00:00:00 2001 From: "stephan.hueltl" Date: Mon, 11 May 2020 11:52:37 +0200 Subject: [PATCH 4/6] to calculate pcb size use the boundingbox of footprints as well --- GenFixture.py | 36 ++++++++++++++++++++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) diff --git a/GenFixture.py b/GenFixture.py index 6e1b4f4..8dd7aec 100755 --- a/GenFixture.py +++ b/GenFixture.py @@ -223,11 +223,11 @@ def Generate(self, path): os.system("openscad %s -D\'mode=\"testcut\"\' -o %s openfixture.scad" % (args, testout)) # Create rendering - print("openscad {} -D\'mode=\"3dmodel\"\' --render -o {} openfixture.scad".format(args, pngout)) + #print("openscad {} -D\'mode=\"3dmodel\"\' --render -o {} openfixture.scad".format(args, pngout)) os.system("openscad %s -D\'mode=\"3dmodel\"\' --render -o %s openfixture.scad" % (args, pngout)) # Create laser cuttable fixture - print("openscad {} -D\'mode=\"lasercut\"\' -o {} openfixture.scad".format(args,dxfout)) + #print("openscad {} -D\'mode=\"lasercut\"\' -o {} openfixture.scad".format(args,dxfout)) os.system("openscad %s -D\'mode=\"lasercut\"\' -o %s openfixture.scad" % (args, dxfout)) # Print output @@ -294,8 +294,12 @@ def GetOriginDimensions(self): # Get bounding box bb = line.GetBoundingBox() + x = ToMM(bb.GetX()) y = ToMM(bb.GetY()) + #w = ToMM(bb.GetWidth()) + #h = ToMM(bb.GetHeight()) + #print("x: {}; y: {}; w: {}; h: {} ".format(x,y,w,h)) # Debug # print "(%f, %f)" % (x, y) @@ -303,18 +307,46 @@ def GetOriginDimensions(self): # Min x/y will be origin if x < self.origin[0]: self.origin[0] = self.Round(x) + # self.origin[0] = x if y < self.origin[1]: self.origin[1] = self.Round(y) + # self.origin[1] = y # Max x.y will be dimensions if x > max_x: max_x = x if y > max_y: max_y = y + + # Get all modules for bounding boxes + for modu in self.brd.GetModules(): + #bb = modu.GetBoundingBox() + bb = modu.GetFootprintRect() + + x = ToMM(bb.GetX()) + y = ToMM(bb.GetY()) + w = ToMM(bb.GetWidth()) + h = ToMM(bb.GetHeight()) + #print("x: {}; y: {}; w: {}; h: {} ; ".format(x, y, w, h)) + + # Min x/y will be origin + if x < self.origin[0]: + # self.origin[0] = self.Round(x) + self.origin[0] = x + if y < self.origin[1]: + #self.origin[1] = self.Round(y) + self.origin[1] = y + + # Max x.y will be dimensions + if x + w > max_x: + max_x = x + w + if y + h > max_y: + max_y = y + h # Calculate dimensions self.dims[0] = self.Round(max_x - self.origin[0]) self.dims[1] = self.Round(max_y - self.origin[1]) + print("dims0x: {} dims1y: {}".format(self.dims[0],self.dims[1])) if __name__ == '__main__': From 4d113350f6b2160ca5933fbb053d9bd7c4021b95 Mon Sep 17 00:00:00 2001 From: "stephan.hueltl" Date: Fri, 15 May 2020 16:49:08 +0200 Subject: [PATCH 5/6] dxf outline as line and not as polygon, improvement of dxf import in scad --- GenFixture.py | 2 +- genfixture.sh | 10 +++++----- openfixture.scad | 24 +++++++++++++----------- 3 files changed, 19 insertions(+), 17 deletions(-) diff --git a/GenFixture.py b/GenFixture.py index 8dd7aec..e8cef91 100755 --- a/GenFixture.py +++ b/GenFixture.py @@ -135,7 +135,7 @@ def PlotDXF(self, path): # Set some important plot options: popt.SetDXFPlotUnits(DXF_PLOTTER.DXF_UNIT_MILLIMETERS) - popt.SetDXFPlotPolygonMode(True) + popt.SetDXFPlotPolygonMode(False) popt.SetPlotFrameRef(False) popt.SetLineWidth(FromMM(0.1)) popt.SetAutoScale(False) diff --git a/genfixture.sh b/genfixture.sh index 6dbc7cb..d1b4904 100755 --- a/genfixture.sh +++ b/genfixture.sh @@ -5,22 +5,22 @@ # BOARD=$1 -OUTPUT="fixture-v10" +OUTPUT="fixture-can-filter-v2.2" # PCB thickness -PCB=0.8 +PCB=1.6 LAYER='B.Cu' -REV='rev.10' +REV='rev.2.2' # Nearest opposite side component to border BORDER=0.8 # Material dimensions -MAT=2.45 +MAT=3.0 SCREW_LEN=16.0 SCREW_D=3.0 WASHER_TH=1.0 -NUT_TH=2.4 +NUT_TH=3.85 NUT_F2F=5.45 NUT_C2C=6.10 diff --git a/openfixture.scad b/openfixture.scad index a5d53ec..23ada6c 100644 --- a/openfixture.scad +++ b/openfixture.scad @@ -30,16 +30,17 @@ test_points = [[23.22,25.85],[19.72,22.28],[3.95,25.77],[7.52,22.27],[13.60,13.7 tp_min_y = 13.7; // DXF outline of pcb -pcb_outline = "./rfid_fob-outline.dxf"; +//pcb_outline = "./rfid_fob-outline.dxf"; +pcb_outline = "./digiWorker-outline.dxf"; osh_logo = "./osh_logo.dxf"; // PCB revision rev = "rev.0"; // Should be close to actual pcb dimensions... Used for support structure only so not critical -pcb_x = 27.14; -pcb_y = 45; -pcb_support_border = 2; +pcb_x = 54; +pcb_y = 117.45; +pcb_support_border = 1; // Work area of PCB // Must be >= PCB size @@ -125,7 +126,7 @@ washer_th = 0; // pin breaks. Undersized so they can be carefully drilled out using #50 // drill bit for better precision. If you have access to a nicer laser you // can size these exactly -pogo_r = 1.5 / 2; +pogo_r = 1.22 / 2; // Uncompressed length from receptacle pogo_uncompressed_length = 8; @@ -470,7 +471,7 @@ module head_base_common () // Drop pins for test points translate ([origin_x + test_points[i][0], origin_y - test_points[i][1], 0]) - cylinder (r = pogo_r, h = mat_th); + cylinder (r = pogo_r, h = mat_th, $fn=100); } } } @@ -687,11 +688,12 @@ module carrier (dxf_filename, pcb_x, pcb_y, border) translate ([mat_th + active_x_offset + tp_correction_offset_x, work_area_y + active_y_offset + tp_correction_offset_y, 0]) translate ([sx_offset, -sy_offset, 0]) - hull () { - linear_extrude (height = mat_th) - scale ([scale_x, scale_y, 1]) - import (dxf_filename); - } + + + linear_extrude (height = mat_th) + scale ([scale_x, scale_y, 1]) + import (dxf_filename); + // Remove slots translate ([0, y/2, 0]) From 65165437971a97e78db39a77caf7ab7fa60efba6 Mon Sep 17 00:00:00 2001 From: "stephan.hueltl" Date: Fri, 15 May 2020 16:51:14 +0200 Subject: [PATCH 6/6] fixed scad for typo --- openfixture.scad | 3 +++ 1 file changed, 3 insertions(+) diff --git a/openfixture.scad b/openfixture.scad index 23ada6c..8166712 100644 --- a/openfixture.scad +++ b/openfixture.scad @@ -42,6 +42,8 @@ pcb_x = 54; pcb_y = 117.45; pcb_support_border = 1; +pcb_max_height_component = 17; + // Work area of PCB // Must be >= PCB size // If you make this as big as any of the PCBs you work @@ -165,6 +167,7 @@ head_z = screw_thr_len - nut_th; base_x = head_x + 2 * mat_th; base_y = head_y + pivot_support_d; base_z = screw_thr_len + 3 * mat_th; +//base_z = screw_thr_len + 3 * mat_th + (pcb_max_height_component - 12.5); base_pivot_offset = pivot_support_r + (pogo_uncompressed_length - pogo_compression) - (mat_th - pcb_th);