Browse Source

Merge branch 'master' of https://tree.clementinecomputing.com/clementinecomputing/popufare

clementinecomputing 6 years ago
parent
commit
a78baa99e9

+ 42 - 0
experiment/prototype/cleanup-all

@@ -0,0 +1,42 @@
+#!/bin/bash
+
+
+function ngc_position {
+  ifn="$1"
+
+  offsetx=10
+  offsety=10
+
+  if [[ "$ifn" == "" ]] ; then
+    echo "provide file"
+    exit 1
+  fi
+
+  dos2unix $ifn
+  sed -i 's/;.*//' $ifn
+  #sed -i 's/G0 *F[0-9]*//' $ifn
+  #sed -i 's/G1 F\(.*\)/G1 F\1\nG0 F8000/' $ifn
+
+  mx=`ngc_bounds $ifn | grep min_x | cut -f2 -d' '`
+  my=`ngc_bounds $ifn | grep min_y | cut -f2 -d' '`
+
+  shiftx=` echo "-($mx) + $offsetx" | bc -l`
+  shifty=` echo "-($my) + $offsety" | bc -l`
+
+  tfn=`mktemp`
+
+  grecode -shift "$shiftx" "$shifty" $ifn | \
+    grep -v '^(' > $tfn
+  mv $tfn $ifn
+
+  rm -f $tfn
+}
+
+
+./svg2ngc "back-plate.svg"
+./svg2ngc "top-plate.svg"
+
+
+ngc_position "back-plate.ngc"
+ngc_position "top-plate.ngc"
+

+ 115 - 0
experiment/prototype/prototype-plates.scad

@@ -0,0 +1,115 @@
+// License: CC0
+//
+
+FN=20;
+
+hole_width = 162.5;
+hole_height = 107.5;
+
+bottom_plate_width = 90;
+bottom_plate_height = 70;
+
+rpi_center_x = -22;
+rpi_center_y = -8;
+rpi_hole_x_length = 58;
+rpi_hole_y_length = 48;
+
+m2r=1;
+m3r=1.75;
+
+m6r=3;
+
+screen_width = 122;
+screen_height = 76;
+
+module rounded_rect(w,h,r) {
+  _w = w-2*r;
+  _h = h-2*r;
+  
+  x2 = _w/2;
+  y2 = _h/2;
+  
+  hull() {
+    translate([-x2, y2]) circle(r, $fn=FN);
+    translate([ x2, y2]) circle(r, $fn=FN);
+    translate([ x2,-y2]) circle(r, $fn=FN);
+    translate([-x2,-y2]) circle(r, $fn=FN);
+  }
+}
+
+module top_plate() {
+  _outr = 16;
+  _r = 3;
+  
+  w2 = hole_width/2;
+  h2 = hole_height/2;
+  difference() {
+    rounded_rect(hole_width+_outr, hole_height+_outr, _r);
+    
+
+    translate([-w2, h2]) circle(m3r, $fn=FN);
+    translate([ w2, h2]) circle(m3r, $fn=FN);
+    translate([ w2+0.5,-h2+2.5]) circle(m3r, $fn=FN);
+    translate([-w2+2.5,-h2+1.5]) circle(m3r, $fn=FN);
+    square([screen_width,screen_height], center=true);
+    
+    // notch
+    translate([-w2 + 30, h2+_outr/2]) rounded_rect(10,10,_r);
+  }
+}
+
+module back_plate() {
+  cx = rpi_center_x/2;
+  cy = rpi_center_y/2;
+  //x = bottom_plate_width;
+  //y = bottom_plate_height;
+
+  _outr = 16;
+  w2 = hole_width/2;
+  h2 = hole_height/2;
+  x = hole_width + _outr;
+  y = hole_height + _outr;
+  
+  first_hole_dx = 24.0;
+  first_hole_dy = 4.0;
+  
+  first_hole_x = -(screen_width/2 - first_hole_dx);
+  first_hole_y =  (screen_height/2 - first_hole_dy);
+  
+  _r = 3;
+  
+  sx2 = hole_width/2;
+  sy2 = hole_height/2;
+  difference() {
+    rounded_rect(x,y,_r);
+    
+    translate([55,0]) rounded_rect(50,90,2);
+    translate([-60,0]) rounded_rect(30,90,2);
+    //translate([-40,35]) rounded_rect(70,40,2);
+    //translate([ 40,35]) rounded_rect(70,40,2);
+    //translate([ 41,-25]) rounded_rect(68,60,2);
+
+    translate([first_hole_x, first_hole_y])
+      translate([0,0]) circle(m2r, $fn=FN);
+    
+    translate([first_hole_x, first_hole_y])
+      translate([rpi_hole_x_length,0]) circle(m2r, $fn=FN);
+    translate([first_hole_x, first_hole_y])
+      translate([rpi_hole_x_length,-rpi_hole_y_length]) circle(m2r, $fn=FN);
+    translate([first_hole_x, first_hole_y])
+      translate([0,-rpi_hole_y_length]) circle(m2r, $fn=FN);
+
+    
+    translate([sx2,sy2]) circle(m3r, $fn=FN);
+    translate([sx2+0.5,-sy2+2.5]) circle(m3r, $fn=FN);
+    translate([-sx2+2.5,-sy2+1.5]) circle(m3r, $fn=FN);
+    translate([-sx2,sy2]) circle(m3r, $fn=FN);
+    
+    // notch
+    translate([-w2 + 30, h2+_outr/2]) rounded_rect(10,10,_r);
+  }
+}
+
+//back_plate();
+//translate([0,150]) top_plate();
+top_plate();

+ 55 - 0
experiment/prototype/svg2ngc

@@ -0,0 +1,55 @@
+#!/bin/bash
+
+inpsvg="$1"
+#sf=`echo '72/25.4' | bc -l`
+#sf=`echo 1.0`
+#sf=`echo '72/254' | bc -l`
+sf='1'
+
+if [[ "$2" != "" ]] ; then
+  sf="$2"
+fi
+
+premul=`echo "1000000" | bc -l`
+invmul=`echo "( 1 / $premul ) * $sf" | bc -l`
+
+frapid="F8000"
+fslow="F400"
+S="1.0"
+
+if [[ "$inpsvg" == "" ]] ; then
+  echo "provide input svg"
+  exit 1
+fi
+
+rawtype=`file $inpsvg`
+checktype=`file -b $inpsvg | cut -f1 -d' '`
+if [[ "$checktype" != "SVG" ]] ; then
+  echo -e "file $inpsvg is of type:\n\n$rawtype\n\nNnot an SVG file? Exiting.\n"
+  exit 1
+fi
+
+bn=`basename $inpsvg .svg`
+
+# causes duplicate paths otherwise
+#
+sed -i 's/fill="[^"]*"/fill="none"/g' $inpsvg
+
+echo "creating $bn.ps"
+rsvg-convert -f ps -o $bn.ps $inpsvg
+
+pstoedit -f gnuplot $bn.ps $bn.gp
+
+echo "# premul: $premul" > ${bn}-ord.gp
+#clipcli -s $bn.gp -F -x $premul -T >> ${bn}-ord.gp
+clipcli -S evenodd -s $bn.gp -F -x $premul -T >> ${bn}-ord.gp
+
+sfx_slow="$fslow S$S"
+sfx_rapid="$frapid S0"
+
+#echo gp2ngc -i ${bn}-ord.gp -s "$invmul" --sfx-rapid "$sfx_rapid" --sfx-slow "$sfx_slow" -o ${bn}.ngc
+#gp2ngc -i ${bn}-ord.gp --sfx-rapid "$sfx_rapid" --sfx-slow "$sfx_slow" | ngc_scale -s "$invmul" > ${bn}.ngc
+
+echo gp2ngc --preset laser -i ${bn}-ord.gp --rapid "$sfx_rapid" --slow "$sfx_slow" "|" ngc_scale -s "$invmul" "> ${bn}.ngc"
+gp2ngc --preset laser -i ${bn}-ord.gp --rapid "$sfx_rapid" --slow "$sfx_slow" | ngc_scale -s "$invmul" > ${bn}.ngc
+