Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

logo dxf is auto-generated from logo.svg, size is calculated from svg… #9

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions GenFixture.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,14 +83,16 @@ def __str__(self):
self.min_y)

def SetOptional(self, rev=None, washer_th=None, nut_f2f=None, nut_c2c=None, nut_th=None,
pivot_d=None, border=None):
pivot_d=None, border=None, logosize=(50,50)):
self.rev = rev
self.washer_th = washer_th
self.nut_f2f = nut_f2f
self.nut_c2c = nut_c2c
self.nut_th = nut_th
self.pivot_d = pivot_d
self.border = border
self.logosize = logosize


def SetParams(self, pcb_th, screw_len, screw_d):
if pcb_th is not None:
Expand Down Expand Up @@ -191,6 +193,8 @@ def Generate(self, path):
args += " -D\'pcb_outline=\"%s\"\'" % (path + "/" + self.prj_name + "-outline.dxf")
args += " -D\'screw_thr_len=%.02f\'" % self.screw_len
args += " -D\'screw_d=%.02f\'" % self.screw_d
args += " -D\'logo_w=%s\'" % self.logosize[0]
args += " -D\'logo_h=%s\'" % self.logosize[1]

# Set optional args
if self.rev != None:
Expand Down Expand Up @@ -335,6 +339,9 @@ def GetOriginDimensions(self):
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 ('--logo-w', help='Set logo width, mm', default=50)
parser.add_argument ('--logo-h', help='Set logo height, mm', default=50)


# Get args
args = parser.parse_args ()
Expand Down Expand Up @@ -377,7 +384,8 @@ def GetOriginDimensions(self):
nut_c2c=args.nut_c2c,
nut_th=args.nut_th,
pivot_d=args.pivot_d,
border=args.border)
border=args.border,
logosize=(args.logo_w, args.logo_h))

# Generate fixture
fixture.Generate (out_dir)
Expand Down
13 changes: 11 additions & 2 deletions genfixture.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ OUTPUT="fixture-v10"

# PCB thickness
PCB=0.8
LAYER='B.Cu'
LAYER='F.Cu'
REV='rev.10'

# Nearest opposite side component to border
Expand All @@ -24,6 +24,15 @@ NUT_TH=2.4
NUT_F2F=5.45
NUT_C2C=6.10

# convert logo
rm logo.dxf
inkscape logo.svg -E logo.eps
pstoedit -dt -f "dxf:-polyaslines -mm" logo.eps logo.dxf
rm logo.eps

LOGO_WIDTH=$(echo "scale = 4; $(inkscape logo.svg -W 2>/dev/null) / 90.0 * 25.4" | bc)
LOGO_HEIGHT=$(echo "scale = 4; $(inkscape logo.svg -H 2>/dev/null) / 90.0 * 25.4" | bc)

# 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
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 --logo-w $LOGO_WIDTH --logo-h $LOGO_HEIGHT

67 changes: 67 additions & 0 deletions logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
67 changes: 0 additions & 67 deletions ohw_logo.svg

This file was deleted.

14 changes: 8 additions & 6 deletions openfixture.scad
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ tp_min_y = 13.7;

// DXF outline of pcb
pcb_outline = "./rfid_fob-outline.dxf";
osh_logo = "./osh_logo.dxf";
logo = "./logo.dxf";

// PCB revision
rev = "rev.0";
Expand All @@ -41,6 +41,9 @@ pcb_x = 27.14;
pcb_y = 45;
pcb_support_border = 2;

logo_w = 50;
logo_h = 50;

// Work area of PCB
// Must be >= PCB size
// If you make this as big as any of the PCBs you work
Expand Down Expand Up @@ -385,11 +388,10 @@ module head_base ()
}
}

module osh_logo () {
module logo () {
linear_extrude (height = mat_th)
scale ([0.15, 0.15, 1])
translate ([-72, -66, 0])
import (osh_logo);
translate ([-logo_w / 2, -logo_h / 2, 0])
import (logo);
}

module head_top ()
Expand All @@ -414,7 +416,7 @@ module head_top ()

// Add osh logo
translate ([head_x / 2, head_y - 30, 0])
osh_logo ();
logo ();

// Remove cable relief holes
translate ([mat_th * 3 + screw_d, head_y - (5 * mat_th) - screw_r, 0])
Expand Down
Loading