Quintar by Hans Bezemer

Quintar by Hans Bezemer

Postby Hans Bezemer » Sat May 10, 2014 10:49 am

So let's try something different.

I want to build two prototypes (#1 and #2) of what I call a "Quintar". Basically it's a 7 string instrument tuned in perfect fifths.
The name "Quintar" is a synthesis of "guitar" and "quinque" which is the latin word for five, refering to the all fifths tuning.
The all fifths tuning gives the instrument an enormous range, from a low C (one step above a low B-string of a bassguitar) to a f# (two steps above a high e string of a guitar).
The second prototype will be identical to the first only fretless.

I've been playing on prototype #0, which I build during the last challenge.

There are several things I want to do different, which I will discuss briefly below.

First I want to cut most of the parts of the Quintar with a waterjetcutter. The fretboards I want to cut with a lasercutter / engraver. One of the advantages is that the lasercutter also can engrave the fretslots.
Further I want to use a 3D-Printer to print the single string bridges and the pickup.
To get the right drawings for the different machines I'm using a 3D-CAD program to draw the quintar.

Second I want to use my strings as a pickup. This hopefully will result in a polyphonic pickup without crosstalk. The common name for this concept is "moving coil pickup".
I will also make a single output pickup so that I can plug in a regular amp as well.

Thirth there will be some unothodox features to the instrument.
It will have:
fanned frets (777 - 653 mm / 30.6 - 25.7")
a compound stringspacing: 10.5 mm between the two highest strings and 15 mm between the two lowest strings. The stringspacing will increase eponential
tuners mounted in / on the body

Maybe I want to use stainless steel strips as frets, but I'm not sure if I will do that.

I think it will be the midst of june when I'll I have all the drawings ready.

a screenshot of what I have so far:
overview.jpg

And a close up of the single string bridge:
close up single string bridge.jpg



Hans



References:
Prototype #0
https://www.youtube.com/watch?v=U2WRQ8oFxQI

Moving Coil Pickup
http://music-electronics-forum.com/t14952-4/
User avatar
Hans Bezemer
 
Posts: 372
Joined: Sat May 26, 2012 1:01 am
Location: The Netherlands

Re: Quintar by Hans Bezemer

Postby Jason Rodgers » Sat May 10, 2014 11:23 am

This is really interesting, and very ambitious, Hans. I'm excited to see what you do here.

I've gotta say, though - and don't take this the wrong way - but I'm a little surprised at the "normal" body shape you are proposing. After seeing some of your other ergonomic designs, I would have expected something more along those lines.
-Ruining perfectly good wood, one day at a time.
Jason Rodgers
 
Posts: 1542
Joined: Fri Jan 06, 2012 4:05 pm
Location: Portland, OR

Re: Quintar by Hans Bezemer

Postby Hans Bezemer » Sat May 10, 2014 2:15 pm

Jason your right.

For a long period of time I'm trying to make a script to draw a Quintar in a CAD-program. A script is a set of instructions which the program uses to draw the instrument. A big advantage is that when I would like to change the thickness of the strings or the string spacing or stringlength, the script can be altered easily and the "new" instrument will be drawn. This gives the opportunity to "see" several different alternatives without having to build a prototype.
One of the difficulties is that you have to make all the parameters interdependent. I have come a long way but I'm not there yet.

While wrestling with the script, I got reinterested in the Golden Ratio and wanted to use this in my design.
As a kind of experiment I tried to use the Golden Ratio as much as I could. For instance the bodylength is the bassstringlength/Goldenratio and the arcs of the side of the body all have diameters which are related to the stringlength by dividing them multiple times by the golden ratio. And by doing so the result is a "classic" guitar design.
One of the advantages of the Les Paul style body is that there is a lot of room for the electronics. As stated earlier I want to make a polyphonic pickup and one single output pickup. All the outputs will be balanced, due to the design of the pickup. A disadvantage is that this prototype needs 8 xlr connectors, hence the big cavity.
For now this is the way to go...

BTW although the ergonomic design plays great, I like the look of a Les Paul type body more.

Hans
User avatar
Hans Bezemer
 
Posts: 372
Joined: Sat May 26, 2012 1:01 am
Location: The Netherlands

Re: Quintar by Hans Bezemer

Postby Jason Rodgers » Sat May 10, 2014 11:56 pm

You go do that, then. I certainly don't want to pigeon-hole you!

I looked in on that MEF discussion about the pickup system you propose. Didn't understand a single word of it, which of course makes me even more interested in the outcome of this project.
-Ruining perfectly good wood, one day at a time.
Jason Rodgers
 
Posts: 1542
Joined: Fri Jan 06, 2012 4:05 pm
Location: Portland, OR

Re: Quintar by Hans Bezemer

Postby Hans Bezemer » Sun May 11, 2014 11:28 am

Regarding body shapes: My ultimate goal is to have a script or a plugin where I can choose what body type I want to use and that the program draws the instrument.
Wouldn't that be great? The question: How would my guitar / quintar look like with a fenderisch / les paul -type of body?" answered with just few clicks of the mouse?
There is a 2D designing tool which does that already to some point for acoustic instruments.

Using the strings as a pickup is a rather simple concept.
in a nutshell: When the two ends of a guitar string are connected with each other with a wire then a loop is created.
When the string is moved with a magnet nearby a small voltage is created in the string.
Basically that's it.
This is offcourse a very small voltage, but with a transformer it can be transformed up to microphone level.
There is a company who offers this concept as a high-end pickup solution for violins and cello.

I've made a test setup a while a go and I got some pretty good results.
User avatar
Hans Bezemer
 
Posts: 372
Joined: Sat May 26, 2012 1:01 am
Location: The Netherlands

Re: Quintar by Hans Bezemer

Postby Hans Bezemer » Sat May 17, 2014 3:02 am

The date is set!

I have an apointment on 20th of june. Then the parts will be cut on the watercutter.
That makes for the following to do list:
- Finishing the 3D drawing
- Creating 2D drawings from the 3D drawing for all the different parts
- Creating a file for the watercutter with instructions what to cut in which order

One of the things I think is funny / weird is that I've already spend many hours on the project without touching one tool.
User avatar
Hans Bezemer
 
Posts: 372
Joined: Sat May 26, 2012 1:01 am
Location: The Netherlands

Re: Quintar by Hans Bezemer

Postby Hans Bezemer » Sun Jun 01, 2014 1:36 pm

I'm done make the script and made a first 3D-drawing of prototype #1.
Screenshot 3.jpg

I've copied some parts out of the drawing to make it easier to select them when needed.
From this 3d-file I'll make 2D-files for every part and the parts will be put together in one drawing, which will be used to calculate the cutting sequence of the cutter.
I want to cut out my frets from stainless steel.

The second prototype will be similar only fretless.

Because I have some material left, I also want to make a third prototype. This prototype will have a microtonal fretboard with 31 equal tempered divisions instead of the regular 12 divisions.
Because of the smaller intervals, it is possible to make a distinction between an A-flat and a G-sharp, which isn't possible on a regular fretted instrument (apart from making a bend).
Downside is that you get a lot of frets.
When playing only in the 12 regular keys, not all the notes are necessary and therefore some frets are not needed then, see this example (comments are in Dutch). I've made a quick scetch and it is possible to leave some frets out and make some only for a couple of strings. I have to alter my script slightly but it is easily done.


Hans

For those interested I'm using the opensource software program FreeCAD.
And have included my script. This can be inserted in the program by copy and pasting it in the Python-console (After opening FreeCAD, click view-->views-->Python console)


Code: Select all

App.newDocument("Quintar")

from FreeCAD import Base
import Part, math, datetime, os, copy

# Variables

## Golden ratio
goldenratio = 2.0/(math.sqrt(5.0)-1.0)

## Frets

octavedivider = 12.
numberfrets = 25
widthfret = 1.
heightfret = 3.
depthfret = 1.
offsetfret = 3.

## stringlengths

slbass = 777.0                     # stringlength on bassside
sltreble = slbass/2**(3./octavedivider)         # stringlength on trebleside
compensation = 3.                  # string compensation at the bridge

offsetbridge = (slbass-sltreble)/goldenratio         # Offset off the trebleside
offsetnut = (slbass-sltreble)-offsetbridge

## single string bridge

bridgelength = 40.0
rbridgercylinder = 4./2.*0.8
bridgewidth = 8.0

rlowerhole = 2.0
rhigherhole = 4.0
rsaddle = 3*0.8
offset1 = 1.0
offset2 = offset1+rhigherhole-rlowerhole

## Body
thicknessbodyplate = 18.
fretwherebodymeetsneck = 16
lengthbody = slbass/goldenratio
distancesboltofbridge = 10.
radiusbridgebolt = 2*0.8            # 4mm bolts are used
offsetfrombridge = 30.                # offset of cut for tuners
offsettuners = 40.               # offset for tuners
totdisttreble = 150.               # distance of the line where the tuners are located at trebleside
totdistbass = 120.               # distance of the line where the tuners are located at bassside
offsetxlr = 10
offsetxlrplate = 5
widthxlr = 80
lengthxlr = totdisttreble
transxlr = 10
Alignmenthole = 8.
rneckbolts = 4.                  # radius of holes to fasten the neck

## diameter strings
diastr = []
diastr.append(0.145*25.4)
diastr.append(0.090*25.4)
diastr.append(0.055*25.4)
diastr.append(0.034*25.4)
diastr.append(0.021*25.4)
diastr.append(0.013*25.4)
diastr.append(0.010*25.4)

## stringdistance
sdbridgetreble = 10.5
sdbridgebass = 15.0
factorsd = (sdbridgebass/sdbridgetreble)**(1./(len(diastr)-2.))
sdnuttreble = sdbridgetreble/goldenratio
sdside = 3.0

## Tuner mounting pieces
tmountingpiecelength = 35.
tmountingpiecewidth = 17.5
tmountingpieceholefortuner = 12.5          # (measured from the rightside)

## Trussrod
Trussrodwidth = 10.
numbertrusrod = 2.

###

# width nut and bridge
sdnut = []
sdbridge = []
sdnut.append(0)
sdbridge.append(0)
for i in range(0,(len(diastr)-1)):
  sdnut.append(sdnuttreble*factorsd**(len(diastr)-2-i))
  sdbridge.append(sdbridgetreble*factorsd**(len(diastr)-2-i))

widthnut = 2.*sdside+sum(sdnut)+sum(diastr)
widthbridge = 2.*sdside+sum(sdbridge)+sum(diastr)
thicknessneck = 18.0
thfretboard = 6.0
thendpiece = 1

xneckbass = slbass-slbass/2**(numberfrets/octavedivider)
yneckbass = -(widthnut/2.0+(widthbridge-widthnut)/2.0*xneckbass/slbass)
xbridgebass = slbass
ybridgebass = -0.5*widthbridge
xnecktreble = slbass-slbass/2**(numberfrets/octavedivider)
ynecktreble = (widthnut/2.0+(widthbridge-widthnut)/2.0*xnecktreble/slbass)


###

# Calculating total quintar length.
xend = slbass-slbass/2**(fretwherebodymeetsneck/octavedivider)+lengthbody
yend = (widthnut/2.0+(widthbridge-widthnut)/2.0*xend/slbass)

yverschil = yend-widthnut/2.0
angleneck = math.atan2(yverschil,xend)   # angle neck in radians
cosangleneck = math.cos(angleneck)
sinangleneck = math.sin(angleneck)
tanangleneck = math.tan(angleneck)

###

# Frets drawing
doc=App.activeDocument()
grp=doc.addObject("App::DocumentObjectGroup", "Frets")

## Calculating the lines of the sides, the lines from the thickness of the frets and the offset of the fretslot from the side)
rcsideneckbass = (-0.5*widthbridge+0.5*widthnut)/(slbass)
rcsidenecktreble = (0.5*widthbridge-0.5*widthnut)/(slbass)

dybsideneckbassfretdist = math.sqrt(((0.5*widthfret)**2)/((rcsideneckbass**2.)+1.))
ybsideneckbassfretdist = -0.5*widthnut+dybsideneckbassfretdist
dxbsideneckbassfretdist = math.sqrt(((0.5*widthfret)**2)/(1/(rcsideneckbass**2.)+1.))
xbsideneckbassfretdist = 0+dxbsideneckbassfretdist
bsideneckbassfretdist = ybsideneckbassfretdist-rcsideneckbass*xbsideneckbassfretdist

dybsideneckbassfretoffset = math.sqrt(((offsetfret)**2)/((rcsideneckbass**2.)+1.))
ybsideneckbassfretoffset = -0.5*widthnut+dybsideneckbassfretoffset
dxbsideneckbassfretoffset = math.sqrt(((offsetfret)**2)/(1/(rcsideneckbass**2.)+1.))
xbsideneckbassfretoffset = 0+dxbsideneckbassfretoffset
bsideneckbassfretoffset = ybsideneckbassfretoffset-rcsideneckbass*xbsideneckbassfretoffset

dybsidenecktreblefretdist = math.sqrt(((0.5*widthfret)**2)/((rcsidenecktreble**2.)+1.))
ybsidenecktreblefretdist = 0.5*widthnut-dybsidenecktreblefretdist
dxbsidenecktreblefretdist = math.sqrt(((0.5*widthfret)**2)/(1/(rcsidenecktreble**2.)+1.))
xbsidenecktreblefretdist = 0+dxbsidenecktreblefretdist
bsidenecktreblefretdist = ybsidenecktreblefretdist-rcsidenecktreble*xbsidenecktreblefretdist

dybsidenecktreblefretoffset = math.sqrt(((offsetfret)**2)/((rcsidenecktreble**2.)+1.))
ybsidenecktreblefretoffset = 0.5*widthnut-dybsidenecktreblefretoffset
dxbsidenecktreblefretoffset = math.sqrt(((offsetfret)**2)/(1/(rcsidenecktreble**2.)+1.))
xbsidenecktreblefretoffset = 0+dxbsidenecktreblefretoffset
bsidenecktreblefretoffset = ybsidenecktreblefretoffset-rcsidenecktreble*xbsidenecktreblefretoffset

xbass = []
ybass = []
xtreble = []
ytreble = []
rcfret = []
bfret = []
Pfret = []
Pcut = []

def xintersectline(rc1,b1,rc2,b2):
  x = (b2-b1)/(rc1-rc2)
  return x

def yintersectline(rc1,b1,rc2,b2):
  y = (b2-rc2*b1/rc1)/(1-rc2/rc1)
  return y

def distbtwopoints(x0,x1,y0,y1):
  dist = math.sqrt((y1-y0)**2+(x1-x0)**2)
  return dist


for i in range(0,numberfrets+1):
  xbass.append(slbass-slbass/2**(i/octavedivider))
  ybass.append(-(widthnut/2.0+(widthbridge-widthnut)/2.0*xbass[i]/slbass))
  xtreble.append(offsetnut+sltreble-sltreble/2.0**(i/octavedivider))
  ytreble.append((widthnut/2.0+(widthbridge-widthnut)/2.0*xtreble[i]/slbass))
  rcfret.append((ytreble[i]-ybass[i])/(xtreble[i]-xbass[i]))
  bfret.append(ybass[i]-rcfret[i]*xbass[i])
   
  # length fret
  xfretdistbass = xintersectline(rcfret[i],bfret[i],rcsideneckbass,bsideneckbassfretdist)
  yfretdistbass = yintersectline(rcfret[i],bfret[i],rcsideneckbass,bsideneckbassfretdist)
  xfretoffsetbass = xintersectline(rcfret[i],bfret[i],rcsideneckbass,bsideneckbassfretoffset)
  yfretoffsetbass = yintersectline(rcfret[i],bfret[i],rcsideneckbass,bsideneckbassfretoffset)
  dist1 = distbtwopoints(xfretdistbass, xfretoffsetbass, yfretdistbass, yfretoffsetbass)
   
  xfretdisttreble = xintersectline(rcfret[i],bfret[i],rcsidenecktreble,bsidenecktreblefretdist)
  yfretdisttreble = yintersectline(rcfret[i],bfret[i],rcsidenecktreble,bsidenecktreblefretdist)
  xfretoffsettreble = xintersectline(rcfret[i],bfret[i],rcsidenecktreble,bsidenecktreblefretoffset)
  yfretoffsettreble = yintersectline(rcfret[i],bfret[i],rcsidenecktreble,bsidenecktreblefretoffset)
  dist2 = distbtwopoints(xfretoffsettreble, xfretdisttreble, yfretoffsettreble, yfretdisttreble)
 
  distfretbasstreble = distbtwopoints(xfretdistbass,xfretdisttreble,yfretdistbass,yfretdisttreble)
  distbetwnoffsets = distbtwopoints(xfretoffsetbass,xfretoffsettreble,yfretoffsetbass,yfretoffsettreble)
   
  V1temp = Base.Vector(0,0,0)
  V2temp = Base.Vector(dist1,0,0)
  V3temp = Base.Vector(dist1,0,-thfretboard+depthfret)
  V4temp = Base.Vector(distfretbasstreble-dist2,0,-thfretboard+depthfret)
  V5temp = Base.Vector(distfretbasstreble-dist2,0,0)
  V6temp = Base.Vector(distfretbasstreble,0,0)
  V7temp = Base.Vector(distfretbasstreble,0,heightfret-1)
  V8temp = Base.Vector(distfretbasstreble-1,0,heightfret)
  V9temp = Base.Vector(1,0,heightfret)
  V10temp = Base.Vector(0,0,heightfret-1)
   
  L1temp = Part.Line(V1temp,V2temp)
  L2temp = Part.Line(V2temp,V3temp)
  L3temp = Part.Line(V3temp,V4temp)
  L4temp = Part.Line(V4temp,V5temp)
  L5temp = Part.Line(V5temp,V6temp)
  L6temp = Part.Line(V6temp,V7temp)
  L7temp = Part.Line(V7temp,V8temp)
  L8temp = Part.Line(V8temp,V9temp)
  L9temp = Part.Line(V9temp,V10temp)
  L10temp = Part.Line(V10temp,V1temp)
 
  Sfrettemp = Part.Shape([L1temp,L2temp,L3temp,L4temp,L5temp,L6temp,L7temp,L8temp,L9temp,L10temp])
  Wfrettemp = Part.Wire(Sfrettemp.Edges)
  Ffrettemp = Part.Face(Wfrettemp)
  Pfrettemp = Ffrettemp.extrude(Base.Vector(0,widthfret,0))
  Pfrettemp.translate(Base.Vector(0,-0.5*widthfret,0))
  Pfrettemp1 = Pfrettemp.copy()
  Pfret.append(Pfrettemp1)
  afrettemp = math.atan2(yfretdisttreble-yfretdistbass,xfretdisttreble-xfretdistbass)
  Pfrettemp.rotate((0,0,0),(0,0,1),afrettemp*180./math.pi)
  Pfrettemp.translate(Base.Vector(xfretdistbass,yfretdistbass,thicknessneck+thfretboard))
  Fretnr = "Fret"+str(i)
  Fret = FreeCAD.ActiveDocument.addObject("Part::Feature",Fretnr)
  Fret.Shape = Pfrettemp
  grp.addObject(Fret)

  L1cuttemp = Part.Line(Base.Vector(0,0,0),Base.Vector(0,0,-thfretboard))
  L2cuttemp = Part.Line(Base.Vector(0,0,-thfretboard),Base.Vector(distfretbasstreble-dist1-dist2,0,-thfretboard))
  L3cuttemp = Part.Line(Base.Vector(distfretbasstreble-dist1-dist2,0,-thfretboard),Base.Vector(distfretbasstreble-dist1-dist2,0,0))
  L4cuttemp = Part.Line(Base.Vector(distfretbasstreble-dist1-dist2,0,-0),Base.Vector(0,0,0))
 
  Scuttemp = Part.Shape([L1cuttemp,L2cuttemp,L3cuttemp,L4cuttemp])
  Wcuttemp = Part.Wire(Scuttemp.Edges)
  Fcuttemp = Part.Face(Wcuttemp)
  Pcuttemp = Fcuttemp.extrude(Base.Vector(0,widthfret,0))
  Pcuttemp.translate(Base.Vector(0,-0.5*widthfret,0))
  Pcuttemp.rotate((0,0,0),(0,0,1),afrettemp*180./math.pi)
  Pcuttemp.translate(Base.Vector(xfretoffsetbass,yfretoffsetbass,thicknessneck+thfretboard))
  Pcut.append(Pcuttemp)

### 

# drawing outline

## points
xoffset = 30
yoffset = (widthnut/2.0-(widthbridge-widthnut)/2.0*xoffset/slbass)
V1 = Base.Vector(-xoffset,-yoffset)

V2 = Base.Vector(xneckbass,yneckbass)

V3 = Base.Vector(xnecktreble,ynecktreble,0)

V4 = Base.Vector(-xoffset,yoffset)

## lines
L1 = Part.Line(V1,V2)
L2 = Part.Line(V2,V3)
L3 = Part.Line(V3,V4)
L4 = Part.Line(V4,V1)

## make a part and wire of it
S1 = Part.Shape([L1,L2,L3,L4])
W1 = Part.Wire(S1.Edges)
F1 = Part.Face(W1)
P1 = F1.extrude(Base.Vector(0,0,thicknessneck))
P2 = F1.extrude(Base.Vector(0,0,thfretboard))
P2.translate(Base.Vector(0,0,thicknessneck))

## Cutout for trussrod
diffbetweentrussrods = (widthnut-numbertrusrod*Trussrodwidth)/(numbertrusrod+1)
cutouttrussrod1 = Part.makeBox(2,Trussrodwidth,thicknessneck)
cutouttrussrod2 = cutouttrussrod1.copy()
cutouttrussrod1.translate(Base.Vector(xneckbass-2., -0.5*widthnut+diffbetweentrussrods,0))
cutouttrussrod2.translate(Base.Vector(xneckbass-2., 0.5*widthnut-diffbetweentrussrods-Trussrodwidth,0))
P1 = P1.cut(cutouttrussrod1)
P1 = P1.cut(cutouttrussrod2)
Pcutjigrouter = P1.copy()

## cutout for strings

sdoffsettreble = (sdnuttreble-(sdbridgetreble-sdnuttreble)*xoffset/slbass)
sdoffset = []
sdoffset.append(0)
for i in range(0,(len(diastr)-1)):
  sdoffset.append(sdoffsettreble*factorsd**(len(diastr)-2.-i))

for i in range(len(diastr)):   # Note: cutout is 20% wider at the end then with 0 fret
  diastrtemp = diastr[0:i+1]
  sdnuttemp = sdnut[0:i+1]
  sdbridgetemp = sdbridge[0:i+1]
  sdoffsettemp = sdoffset[0:i+1]
  ynut = -widthnut/2 + sdside + sum(diastrtemp) - diastr[i] + sum(sdnuttemp)
  ybridge = -widthbridge/2.0 + sdside + sum(diastrtemp) - diastr[i] + sum(sdbridgetemp)
  xtemp1 = -xoffset
  ytemp1 = -yoffset + sdside + sum(diastrtemp) - diastr[i] - 0.1*diastr[i] + sum(sdoffsettemp)
  xtemp2 = xbass[0]+(xtreble[0]-xbass[0])*(ynut+widthnut/2.0)/widthnut - 5.0
  ytemp2 = ynut + (ybridge-ynut)*xtemp2/slbass
  xtemp3 = xtemp2
  ytemp3 = ytemp2 + diastr[i]
  xtemp4 = -xoffset
  ytemp4 = ytemp1 + 1.2*diastr[i]
  Vtemp1 = Base.Vector(xtemp1,ytemp1)
  Vtemp2 = Base.Vector(xtemp2,ytemp2)
  Vtemp3 = Base.Vector(xtemp3,ytemp3)
  Vtemp4 = Base.Vector(xtemp4,ytemp4)
  Ltemp1 = Part.Line(Vtemp1,Vtemp2)
  Ltemp2 = Part.Line(Vtemp2,Vtemp3)
  Ltemp3 = Part.Line(Vtemp3,Vtemp4)
  Ltemp4 = Part.Line(Vtemp4,Vtemp1)
  Stemp = Part.Shape([Ltemp1,Ltemp2,Ltemp3,Ltemp4])
  Wtemp = Part.Wire(Stemp.Edges)
  Ftemp = Part.Face(Wtemp)
  Ptemp = Ftemp.extrude(Base.Vector(0,0,thfretboard))
  Ptemp.translate(Base.Vector(0,0,thicknessneck))
  P2 = P2.cut(Ptemp)

## Cutting fretslots
for i in range(0,numberfrets+1):
  P2 = P2.cut(Pcut[i])

## Drawing mounting holes

cylindermountingneck = Part.makeCylinder(rneckbolts*0.8,thicknessbodyplate)
cylmneck1 = cylindermountingneck.copy()
cylmneck2 = cylindermountingneck.copy()
cylmneck3 = cylindermountingneck.copy()
cylmneck4 = cylindermountingneck.copy()
cylmneck1.translate(Base.Vector(slbass-slbass/2**(fretwherebodymeetsneck/octavedivider)+20.0,0.4*widthnut,0))
cylmneck2.translate(Base.Vector(slbass-slbass/2**(numberfrets/octavedivider)-20.0,0.4*widthnut,0))
cylmneck3.translate(Base.Vector(slbass-slbass/2**(fretwherebodymeetsneck/octavedivider)+20.0,-0.4*widthnut,0))
cylmneck4.translate(Base.Vector(slbass-slbass/2**(numberfrets/octavedivider)-20.0,-0.4*widthnut,0))

P1 = P1.cut(cylmneck1)
P1 = P1.cut(cylmneck2)
P1 = P1.cut(cylmneck3)
P1 = P1.cut(cylmneck4)
 
Neck = FreeCAD.ActiveDocument.addObject("Part::Feature","Neck")
Neck.Shape = P1

Fretboard = FreeCAD.ActiveDocument.addObject("Part::Feature","Fretboard")
Fretboard.Shape = P2

###

# Drawing the body

werkelijkeafstand = math.hypot(xend,yverschil)            # de werkelijke afstand van het begin van de hals langs de schuine zijde tot helemaal naar achteren
werkelijkelengthbody = lengthbody*werkelijkeafstand/xend      # de lengte van de lijn waar ik de cirkeldelen op ga berekenen is langer, dit wordt hier berekend

# berekenen vectoren waar de cirkeldelen uitgemaakt worden.

rgroteboog = (werkelijkelengthbody/goldenratio)/2.0
xcentregroteboog = werkelijkelengthbody-rgroteboog

rkleineboog = (werkelijkelengthbody/math.pow(goldenratio,2))/2.0
xcentrekleineboog = rkleineboog

rcutaway = (werkelijkelengthbody/math.pow(goldenratio,3))/2.0
rcutaway2 = (werkelijkelengthbody/math.pow(goldenratio,4))/2.0

d = rgroteboog+rkleineboog   # uitrekenen van snijpunt grote en kleine boog en straal van midden cirkeldeel
xcentremidden = (d**2.0-(rgroteboog+rcutaway)**2.0+(rgroteboog)**2.0)/(2.0*d)
ycentremidden = ((4*d**2.0*(rgroteboog)**2.0-(d**2.0-(rgroteboog+rcutaway)**2.0+(rgroteboog)**2.0)**2)/(4*d**2))**0.5
angle1centremidden = math.atan2(ycentremidden,xcentremidden)
angle2centremidden = math.atan2(ycentremidden,xcentremidden)

d2 = rkleineboog

xVb0 = werkelijkelengthbody
yVb0 = 0

xVb1 = werkelijkelengthbody-rgroteboog
yVb1 = rgroteboog

xVb2 = math.cos(angle2centremidden)*rgroteboog+rgroteboog
yVb2 = math.sin(angle2centremidden)*rgroteboog

xVb3 = rkleineboog + xcentremidden
yVb3 = ycentremidden-rcutaway

xVb4 = rkleineboog + math.cos(angle1centremidden)*rkleineboog
yVb4 = math.sin(angle1centremidden)*rkleineboog

xVb5 = rkleineboog
yVb5 = rkleineboog

xVb6 = rcutaway2
yVb6 = 2*rcutaway2

xVb7 = 2*rcutaway2
yVb7 = rcutaway2

xVb8 = rcutaway2
yVb8 = 0

xVb9 = 0
yVb9 = 0

xVb10 = xbass[numberfrets]+20+lengthbody-xend
yVb10 = 0

xVb = [xVb0,xVb1,xVb2,xVb3,xVb4,xVb5,xVb6,xVb7,xVb8,xVb9,xVb10]
yVb = [yVb0,yVb1,yVb2,yVb3,yVb4,yVb5,yVb6,yVb7,yVb8,yVb9,yVb10]

# Transleren van coördinaten en maken van vectoren

xVbtrans = []
yVbtrans = []
Vpos = []
Vneg = []

for i in range(len(xVb)):
  xtemp = xVb[i]+werkelijkeafstand-werkelijkelengthbody
  print xtemp
  angleofcoord = math.atan2(yVb[i],xtemp)
  rcoord = math.hypot(xtemp,yVb[i])
  xVbtrans.append(math.cos(angleofcoord+angleneck)*rcoord)
  yVbtrans.append(math.sin(angleofcoord+angleneck)*rcoord+widthnut/2.0)
  Vpos.append(Base.Vector(xVbtrans[i],yVbtrans[i],0))
  Vneg.append(Base.Vector(xVbtrans[i],-yVbtrans[i],0))

# Maken van lijnstukken
Apos1 = Part.Arc(Vpos[0],Vpos[1],Vpos[2])
Apos2 = Part.Arc(Vpos[2],Vpos[3],Vpos[4])
Apos3 = Part.Arc(Vpos[4],Vpos[5],Vpos[6])
Apos4 = Part.Arc(Vpos[6],Vpos[7],Vpos[8])
Lpos1 = Part.Line(Vpos[8],Vpos[10])
Lpos2 = Part.Line(Vpos[10],Base.Vector(xVbtrans[10],0))
Lpos3 = Part.Line(Vpos[8],Vpos[9])
Lpos4 = Part.Line(Vpos[9],Base.Vector(xVbtrans[9],0))

Aneg1 = Part.Arc(Vneg[0],Vneg[1],Vneg[2])
Aneg2 = Part.Arc(Vneg[2],Vneg[3],Vneg[4])
Aneg3 = Part.Arc(Vneg[4],Vneg[5],Vneg[9])
Lneg1 = Part.Line(Vneg[8],Vneg[10])
Lneg2 = Part.Line(Vneg[10],Base.Vector(xVbtrans[10],0))
Lneg3 = Part.Line(Vneg[8],Vneg[9])
Lneg4 = Part.Line(Vneg[9],Base.Vector(xVbtrans[9],0))

back = Part.Line(Base.Vector(xend,-yend,0),Base.Vector(xend,yend,0))

# Tekenen van bovenplaat body
Bodybvnplaat = Part.Shape([Apos1,Apos2,Apos3,Apos4,Lpos1,Lpos2,Lneg2,Lneg1,Lneg3,Aneg3,Aneg2,Aneg1,back])
WBodybvnplaat = Part.Wire(Bodybvnplaat.Edges)
FBodybvnplaat = Part.Face(WBodybvnplaat)
PBodybvnplaat = FBodybvnplaat.extrude(Base.Vector(0,0,thicknessbodyplate))

## uitsparing stemmechanieken

xVbtuner1 = slbass + compensation + offsetfrombridge
yVbtuner1 = -0.5*widthbridge

xVbtuner2 = sltreble + offsetnut + compensation + offsetfrombridge
yVbtuner2 = 0.5*widthbridge

xVbtuner3 = xVbtuner2
yVbtuner3 = 0.5*widthbridge + offsettuners

xVbtuner4temp = math.sqrt(totdisttreble**2-(0.5*widthbridge)**2)
xVbtuner4 = xVbtuner2 + xVbtuner4temp
yVbtuner4 = offsettuners

xVbtuner5temp = math.sqrt(totdistbass**2-(0.5*widthbridge)**2)
xVbtuner5 = xVbtuner1 + xVbtuner5temp
yVbtuner5 = 0

xVbtuner6 = xVbtuner5
yVbtuner6 = -offsettuners

xVbtuner7 = xVbtuner1
yVbtuner7 = -0.5*widthbridge-offsettuners

xVbtuner = [xVbtuner1,xVbtuner2,xVbtuner3,xVbtuner4,xVbtuner5,xVbtuner6,xVbtuner7]
yVbtuner = [yVbtuner1,yVbtuner2,yVbtuner3,yVbtuner4,yVbtuner5,yVbtuner6,yVbtuner7]
Vbtuner = []

for i in range(len(xVbtuner)):
  Vbtuner.append(Base.Vector(xVbtuner[i],yVbtuner[i],0))


Lbtuner1 = Part.Line(Vbtuner[0],Vbtuner[1])
Lbtuner2 = Part.Line(Vbtuner[1],Vbtuner[2])
Lbtuner3 = Part.Line(Vbtuner[2],Vbtuner[3])
Lbtuner4 = Part.Line(Vbtuner[3],Vbtuner[4])
Lbtuner5 = Part.Line(Vbtuner[4],Vbtuner[5])
Lbtuner6 = Part.Line(Vbtuner[5],Vbtuner[6])
Lbtuner7 = Part.Line(Vbtuner[6],Vbtuner[0])

Bodybvnplaatcut = Part.Shape([Lbtuner1,Lbtuner2,Lbtuner3,Lbtuner4,Lbtuner5,Lbtuner6,Lbtuner7])
WBodybvnplaatcut = Part.Wire(Bodybvnplaatcut.Edges)
FBodybvnplaatcut = Part.Face(WBodybvnplaatcut)
PBodybvnplaatcut = FBodybvnplaatcut.extrude(Base.Vector(0,0,thicknessbodyplate))

PBodybvnplaat = PBodybvnplaat.cut(PBodybvnplaatcut)

## XLR input cut

rc1 = (yVbtuner4-yVbtuner3)/(xVbtuner4-xVbtuner3)
rc2 = -1/rc1

xVbxlr1 = xVbtuner3 + math.sqrt(offsetxlr**2/(rc2**2+1))
yVbxlr1 = yVbtuner3 + math.sqrt(offsetxlr**2/((1/rc2**2)+1))

xVbxlr2 = xVbxlr1 + math.sqrt(widthxlr**2/(rc2**2+1))
yVbxlr2 = yVbxlr1 + math.sqrt(widthxlr**2/((1/rc2**2)+1))

xVbxlr3 = xVbxlr2 + math.sqrt(lengthxlr**2/(rc1**2+1))
yVbxlr3 = yVbxlr2 - math.sqrt(lengthxlr**2/((1/rc1**2)+1))

xVbxlr4 = xVbxlr1 + math.sqrt(lengthxlr**2/(rc1**2+1))
yVbxlr4 = yVbxlr1 - math.sqrt(lengthxlr**2/((1/rc1**2)+1))

xVbxlr = [xVbxlr1,xVbxlr2,xVbxlr3,xVbxlr4]
yVbxlr = [yVbxlr1,yVbxlr2,yVbxlr3,yVbxlr4]
Vbxlr = []

for i in range(len(xVbxlr)):
  Vbxlr.append(Base.Vector(xVbxlr[i],yVbxlr[i],0))

Lbxlr1 = Part.Line(Vbxlr[0],Vbxlr[1])
Lbxlr2 = Part.Line(Vbxlr[1],Vbxlr[2])
Lbxlr3 = Part.Line(Vbxlr[2],Vbxlr[3])
Lbxlr4 = Part.Line(Vbxlr[3],Vbxlr[0])

Bodybvnplaatxlrcut = Part.Shape([Lbxlr1,Lbxlr2,Lbxlr3,Lbxlr4])
WBodybvnplaatxlrcut = Part.Wire(Bodybvnplaatxlrcut.Edges)
FBodybvnplaatxlrcut = Part.Face(WBodybvnplaatxlrcut)
PBodybvnplaatxlrcut = FBodybvnplaatxlrcut.extrude(Base.Vector(0,0,thicknessbodyplate))

xtrans = -math.sqrt(transxlr**2/(rc1**2+1))
ytrans = math.sqrt(transxlr**2/((1/rc1**2)+1))
PBodybvnplaatxlrcut.translate(Base.Vector(xtrans,ytrans,0))

PBodybvnplaat = PBodybvnplaat.cut(PBodybvnplaatxlrcut)

## Alignment cutout and bolts

cylinderalignment = Part.makeCylinder(0.5*Alignmenthole,2.*thicknessbodyplate)
cylalig1 = cylinderalignment.copy()
cylalig2 = cylinderalignment.copy()
cylalig1.translate(Base.Vector(slbass-slbass/2**(numberfrets/octavedivider)+40.,-0.5*widthnut,-thicknessbodyplate))
cylalig2.translate(Base.Vector(slbass-slbass/2**(numberfrets/octavedivider)+40.,0.5*widthnut,-thicknessbodyplate))

PBodybvnplaat = PBodybvnplaat.cut(cylalig1)
PBodybvnplaat = PBodybvnplaat.cut(cylalig2)

# Maken van onderplaat body
Bodyndrplaat = Part.Shape([Apos1,Apos2,Apos3,Apos4,Lpos3,Lpos4,Lneg4,Aneg3,Aneg2,Aneg1,back])
WBodyndrplaat = Part.Wire(Bodyndrplaat.Edges)
FBodyndrplaat = Part.Face(WBodyndrplaat)
PBodyndrplaat = FBodyndrplaat.extrude(Base.Vector(0,0,-thicknessbodyplate))

PBodyndrplaatxlrcut = PBodybvnplaatxlrcut.copy()
PBodyndrplaatxlrcut.translate(Base.Vector(0,0,-thicknessbodyplate))
PBodyndrplaat = PBodyndrplaat.cut(PBodyndrplaatxlrcut)
PBodyndrplaat = PBodyndrplaat.cut(cylalig1)
PBodyndrplaat = PBodyndrplaat.cut(cylalig2)

cylindermountingbody = Part.makeCylinder(rneckbolts,thicknessbodyplate)
cylmbody1 = cylindermountingbody.copy()
cylmbody2 = cylindermountingbody.copy()
cylmbody3 = cylindermountingbody.copy()
cylmbody4 = cylindermountingbody.copy()
cylmbody1.translate(Base.Vector(slbass-slbass/2**(fretwherebodymeetsneck/octavedivider)+20.,0.4*widthnut,-thicknessbodyplate))
cylmbody2.translate(Base.Vector(slbass-slbass/2**(numberfrets/octavedivider)-20.,0.4*widthnut,-thicknessbodyplate))
cylmbody3.translate(Base.Vector(slbass-slbass/2**(fretwherebodymeetsneck/octavedivider)+20.,-0.4*widthnut,-thicknessbodyplate))
cylmbody4.translate(Base.Vector(slbass-slbass/2**(numberfrets/octavedivider)-20.,-0.4*widthnut,-thicknessbodyplate))
PBodyndrplaat = PBodyndrplaat.cut(cylmbody1)
PBodyndrplaat = PBodyndrplaat.cut(cylmbody2)
PBodyndrplaat = PBodyndrplaat.cut(cylmbody3)
PBodyndrplaat = PBodyndrplaat.cut(cylmbody4)

###

# single string bridge tekenen
doc=App.activeDocument()
grp=doc.addObject("App::DocumentObjectGroup", "SingleStringBridge")

xbridgetreble = sltreble + offsetnut
ybridgetreble = 0.5*widthnut + (widthbridge-widthnut)/2*((sltreble+offsetnut)/slbass)
rcbridge = (-0.5*widthbridge-ybridgetreble)/(slbass-xbridgetreble)
bbridge = ybridgetreble - rcbridge*(xbridgetreble-0)
lyintersect = []
lxintersect = []
Lbridge = []

for i in range(len(diastr)):
  diastrtemp = diastr[0:i+1]
  sdnuttemp = sdnut[0:i+1]
  sdbridgetemp = sdbridge[0:i+1] 
  ynut = -widthnut/2.0 + sdside + sum(diastrtemp) - 0.5*diastr[i] + sum(sdnuttemp)
  ybridge = -widthbridge/2.0 + sdside + sum(diastrtemp) - 0.5*diastr[i] + sum(sdbridgetemp)
  rcstring = (ybridge-ynut)/(slbass-0.)
  xintersect = (ynut - bbridge)/(rcbridge-rcstring)
  yintersect = ynut + rcstring*xintersect
  lyintersect.append(yintersect)
  lxintersect.append(xintersect)
 
  bridge = Part.makeBox(bridgelength-bridgewidth, bridgewidth, thicknessbodyplate)
  bridgecyl1 = Part.makeCylinder(0.5*bridgewidth, thicknessbodyplate)
  bridgecyl2 = Part.makeCylinder(0.5*bridgewidth, thicknessbodyplate)
  bridgecyl3 = Part.makeCylinder(rbridgercylinder, thicknessbodyplate)
  bridgecyl1.translate(Base.Vector(0, 0.5*bridgewidth, 0))
  bridgecyl2.translate(Base.Vector(bridgelength-bridgewidth, 0.5*bridgewidth, 0))
  bridgecyl3.translate(Base.Vector(0.5*(bridgelength-bridgewidth), 0.5*bridgewidth, 0))
  bridge = bridge.fuse(bridgecyl1)
  bridge = bridge.fuse(bridgecyl2)
  bridge = bridge.cut(bridgecyl3)
 
  bridgemountinghole1 = Part.makeBox(10-2.*rbridgercylinder/0.8, 2.*rbridgercylinder/0.8, thicknessbodyplate)
  bridgecyl4 = Part.makeCylinder(rbridgercylinder/0.8,thicknessbodyplate)
  bridgecyl5 = Part.makeCylinder(rbridgercylinder/0.8,thicknessbodyplate)
  bridgecyl4.translate(Base.Vector(0,rbridgercylinder/0.8,0))
  bridgecyl5.translate(Base.Vector((10-2.*rbridgercylinder/0.8),rbridgercylinder/0.8,0))
  bridgemountinghole1 = bridgemountinghole1.fuse(bridgecyl4)
  bridgemountinghole1 = bridgemountinghole1.fuse(bridgecyl5)
  bridgemountinghole2 = bridgemountinghole1.copy()
  bridgemountinghole1.translate(Base.Vector(-0.5*(10-2.*rbridgercylinder/0.8),-rbridgercylinder/0.8,0))
  bridgemountinghole1.translate(Base.Vector(0.5*(bridgelength-bridgewidth)-10,0.5*bridgewidth,0))
  bridgemountinghole2.translate(Base.Vector(-0.5*(10-2.*rbridgercylinder/0.8),-rbridgercylinder/0.8,0))
  bridgemountinghole2.translate(Base.Vector(0.5*(bridgelength-bridgewidth)+10,0.5*bridgewidth,0))
  bridge = bridge.cut(bridgemountinghole1)
  bridge = bridge.cut(bridgemountinghole2)
 
  bridgefcutter = bridge.copy()
  Lbridge.append(bridgefcutter)
 
  bridge.translate(Base.Vector(-0.5*(bridgelength-bridgewidth),-0.5*bridgewidth,0))
  bridge.translate(Base.Vector(xintersect+compensation,yintersect,0))
 
  # displaying the bridge
  SingleStringBridge = FreeCAD.ActiveDocument.addObject("Part::Feature","SingleStringBridge")
  SingleStringBridge.Shape = bridge
  grp.addObject(SingleStringBridge)
 
  # drawing the cut from the bodyplate
  bridgecut = Part.makeBox(bridgelength+10-bridgewidth, bridgewidth, thicknessbodyplate)
  bridgecutcyl1 = Part.makeCylinder(0.5*bridgewidth, thicknessbodyplate)
  bridgecutcyl2 = Part.makeCylinder(0.5*bridgewidth, thicknessbodyplate)
  bridgecutcyl1.translate(Base.Vector(0, 0.5*bridgewidth, 0))
  bridgecutcyl2.translate(Base.Vector(bridgelength+10-bridgewidth, 0.5*bridgewidth, 0))
  bridgecut = bridgecut.fuse(bridgecutcyl1)
  bridgecut = bridgecut.fuse(bridgecutcyl2)
  bridgecut.translate(Base.Vector(-0.5*(bridgelength+10.-bridgewidth),-0.5*bridgewidth,0))
  bridgecut.translate(Base.Vector(xintersect+compensation,yintersect,0))
  PBodybvnplaat = PBodybvnplaat.cut(bridgecut)
 
  # cutting the holes for the SingleStringBridge
  bridgebodymountinghole1 = Part.makeCylinder(rbridgercylinder,thicknessbodyplate)
  bridgebodymountinghole2 = Part.makeCylinder(rbridgercylinder,thicknessbodyplate)
  bridgebodymountinghole1.translate(Base.Vector(xintersect+compensation-10,yintersect,-thicknessbodyplate))
  bridgebodymountinghole2.translate(Base.Vector(xintersect+compensation+10,yintersect,-thicknessbodyplate))
  PBodyndrplaat = PBodyndrplaat.cut(bridgebodymountinghole1)
  PBodyndrplaat = PBodyndrplaat.cut(bridgebodymountinghole2)


###

# drawing tuner mounting pieces and mounting holes

doc=App.activeDocument()
grp=doc.addObject("App::DocumentObjectGroup", "TunerMountingPiece")

tmountingpiecebass = Part.makeBox(tmountingpiecelength,tmountingpiecewidth,thicknessbodyplate)    # these measurements are based on this specific tuners
tmountingpiecebasscyl1 = Part.makeCylinder(rbridgercylinder/0.8,thicknessbodyplate)
tmountingpiecebasscyl2 = tmountingpiecebasscyl1.copy()
tmountingpiecebasscyl1.translate(Base.Vector(3+rbridgercylinder/0.8,0.5*tmountingpiecewidth,0))
tmountingpiecebasscyl2.translate(Base.Vector(tmountingpiecelength-(3+rbridgercylinder/0.8),0.5*tmountingpiecewidth,0))
tmountingpiecebass = tmountingpiecebass.cut(tmountingpiecebasscyl1)
tmountingpiecebass = tmountingpiecebass.cut(tmountingpiecebasscyl2)

tmountingpiecetreble = tmountingpiecebass.copy()

tmountingpiecebasscyl3 = Part.makeCylinder(1, thicknessbodyplate)
tmountingpiecebasscyl3.translate(Base.Vector(tmountingpiecelength-tmountingpieceholefortuner,0,0))
tmountingpiecebass = tmountingpiecebass.cut(tmountingpiecebasscyl3)

tmountingpiecetreblecyl1 = Part.makeCylinder(1, thicknessbodyplate)
tmountingpiecetreblecyl1.translate(Base.Vector(tmountingpiecelength-tmountingpieceholefortuner,tmountingpiecewidth,0))
tmountingpiecetreble = tmountingpiecetreble.cut(tmountingpiecetreblecyl1)

## Drawing the mounting piece of the bassside

tmountingpiecebass1 = tmountingpiecebass.copy()
tmountingpiecebass1.translate(Base.Vector(lxintersect[0]+2.*offsetfrombridge-(tmountingpiecelength-tmountingpieceholefortuner),lyintersect[0]-24, 0))
TunerMountingPiece = FreeCAD.ActiveDocument.addObject("Part::Feature","TunerMountingPiece")
TunerMountingPiece.Shape = tmountingpiecebass1
grp.addObject(TunerMountingPiece)

tmountingpiecebass2 = tmountingpiecebass.copy()
tmountingpiecebass2.translate(Base.Vector(lxintersect[0]+2.*offsetfrombridge-(tmountingpiecelength-tmountingpieceholefortuner)+tmountingpiecelength,lyintersect[1]-24, 0))
TunerMountingPiece = FreeCAD.ActiveDocument.addObject("Part::Feature","TunerMountingPiece")
TunerMountingPiece.Shape = tmountingpiecebass2
grp.addObject(TunerMountingPiece)

tmountingpiecebass3 = tmountingpiecebass.copy()
tmountingpiecebass3.translate(Base.Vector(lxintersect[0]+2.*offsetfrombridge-(tmountingpiecelength-tmountingpieceholefortuner)+2*tmountingpiecelength,lyintersect[2]-24, 0))
TunerMountingPiece = FreeCAD.ActiveDocument.addObject("Part::Feature","TunerMountingPiece")
TunerMountingPiece.Shape = tmountingpiecebass3
grp.addObject(TunerMountingPiece)

## Drawing the mounting piece of the trebleside

tmountingpiecetreble1 = tmountingpiecetreble.copy()
tmountingpiecetreble1.translate(Base.Vector(lxintersect[6]+2.*offsetfrombridge-(tmountingpiecelength-tmountingpieceholefortuner),lyintersect[6]+24-tmountingpiecewidth, 0))
TunerMountingPiece = FreeCAD.ActiveDocument.addObject("Part::Feature","TunerMountingPiece")
TunerMountingPiece.Shape = tmountingpiecetreble1
grp.addObject(TunerMountingPiece)

tmountingpiecetreble2 = tmountingpiecetreble.copy()
tmountingpiecetreble2.translate(Base.Vector(lxintersect[6]+2.*offsetfrombridge-(tmountingpiecelength-tmountingpieceholefortuner)+tmountingpiecelength,lyintersect[5]+24-tmountingpiecewidth, 0))
TunerMountingPiece = FreeCAD.ActiveDocument.addObject("Part::Feature","TunerMountingPiece")
TunerMountingPiece.Shape = tmountingpiecetreble2
grp.addObject(TunerMountingPiece)

tmountingpiecetreble3 = tmountingpiecetreble.copy()
tmountingpiecetreble3.translate(Base.Vector(lxintersect[6]+2.*offsetfrombridge-(tmountingpiecelength-tmountingpieceholefortuner)+2*tmountingpiecelength,lyintersect[4]+24-tmountingpiecewidth, 0))
TunerMountingPiece = FreeCAD.ActiveDocument.addObject("Part::Feature","TunerMountingPiece")
TunerMountingPiece.Shape = tmountingpiecetreble3
grp.addObject(TunerMountingPiece)

tmountingpiecetreble4 = tmountingpiecetreble.copy()
tmountingpiecetreble4.translate(Base.Vector(lxintersect[6]+2.*offsetfrombridge-(tmountingpiecelength-tmountingpieceholefortuner)+3*tmountingpiecelength,lyintersect[3]+24-tmountingpiecewidth, 0))
TunerMountingPiece = FreeCAD.ActiveDocument.addObject("Part::Feature","TunerMountingPiece")
TunerMountingPiece.Shape = tmountingpiecetreble4
grp.addObject(TunerMountingPiece)


## Drawing cut for underplate
cuttmountingpiecebasscyl1 = Part.makeCylinder(rbridgercylinder,thicknessbodyplate)
cuttmountingpiecebasscyl2 = cuttmountingpiecebasscyl1.copy()
cuttmountingpiecebasscyl1.translate(Base.Vector(3+rbridgercylinder/0.8,0.5*tmountingpiecewidth,0))
cuttmountingpiecebasscyl2.translate(Base.Vector(tmountingpiecelength-(3+rbridgercylinder/0.8),0.5*tmountingpiecewidth,0))

cuttmountingpiecebass1cyl1 = cuttmountingpiecebasscyl1.copy()
cuttmountingpiecebass1cyl1.translate(Base.Vector(lxintersect[0]+2.*offsetfrombridge-(tmountingpiecelength-tmountingpieceholefortuner),lyintersect[0]-24, -thicknessneck))
PBodyndrplaat = PBodyndrplaat.cut(cuttmountingpiecebass1cyl1)
cuttmountingpiecebass1cyl2 = cuttmountingpiecebasscyl2.copy()
cuttmountingpiecebass1cyl2.translate(Base.Vector(lxintersect[0]+2.*offsetfrombridge-(tmountingpiecelength-tmountingpieceholefortuner),lyintersect[0]-24, -thicknessneck))
PBodyndrplaat = PBodyndrplaat.cut(cuttmountingpiecebass1cyl2)

cuttmountingpiecebass2cyl1 = cuttmountingpiecebasscyl1.copy()
cuttmountingpiecebass2cyl1.translate(Base.Vector(lxintersect[0]+2.*offsetfrombridge-(tmountingpiecelength-tmountingpieceholefortuner)+tmountingpiecelength,lyintersect[1]-24, -thicknessneck))
PBodyndrplaat = PBodyndrplaat.cut(cuttmountingpiecebass2cyl1)
cuttmountingpiecebass2cyl2 = cuttmountingpiecebasscyl2.copy()
cuttmountingpiecebass2cyl2.translate(Base.Vector(lxintersect[0]+2.*offsetfrombridge-(tmountingpiecelength-tmountingpieceholefortuner)+tmountingpiecelength,lyintersect[1]-24, -thicknessneck))
PBodyndrplaat = PBodyndrplaat.cut(cuttmountingpiecebass2cyl2)

cuttmountingpiecebass3cyl1 = cuttmountingpiecebasscyl1.copy()
cuttmountingpiecebass3cyl1.translate(Base.Vector(lxintersect[0]+2.*offsetfrombridge-(tmountingpiecelength-tmountingpieceholefortuner)+2*tmountingpiecelength,lyintersect[2]-24, -thicknessneck))
PBodyndrplaat = PBodyndrplaat.cut(cuttmountingpiecebass3cyl1)
cuttmountingpiecebass3cyl2 = cuttmountingpiecebasscyl2.copy()
cuttmountingpiecebass3cyl2.translate(Base.Vector(lxintersect[0]+2.*offsetfrombridge-(tmountingpiecelength-tmountingpieceholefortuner)+2*tmountingpiecelength,lyintersect[2]-24, -thicknessneck))
PBodyndrplaat = PBodyndrplaat.cut(cuttmountingpiecebass3cyl2)

cuttmountingpiecetreble1cyl1 = cuttmountingpiecebasscyl1.copy()
cuttmountingpiecetreble1cyl1.translate(Base.Vector(lxintersect[6]+2.*offsetfrombridge-(tmountingpiecelength-tmountingpieceholefortuner),lyintersect[6]+24-tmountingpiecewidth, -thicknessbodyplate))
PBodyndrplaat = PBodyndrplaat.cut(cuttmountingpiecetreble1cyl1)
cuttmountingpiecetreble1cyl2 = cuttmountingpiecebasscyl2.copy()
cuttmountingpiecetreble1cyl2.translate(Base.Vector(lxintersect[6]+2.*offsetfrombridge-(tmountingpiecelength-tmountingpieceholefortuner),lyintersect[6]+24-tmountingpiecewidth, -thicknessbodyplate))
PBodyndrplaat = PBodyndrplaat.cut(cuttmountingpiecetreble1cyl2)

cuttmountingpiecetreble2cyl1 = cuttmountingpiecebasscyl1.copy()
cuttmountingpiecetreble2cyl1.translate(Base.Vector(lxintersect[6]+2.*offsetfrombridge-(tmountingpiecelength-tmountingpieceholefortuner)+tmountingpiecelength,lyintersect[5]+24-tmountingpiecewidth, -thicknessbodyplate))
PBodyndrplaat = PBodyndrplaat.cut(cuttmountingpiecetreble2cyl1)
cuttmountingpiecetreble2cyl2 = cuttmountingpiecebasscyl2.copy()
cuttmountingpiecetreble2cyl2.translate(Base.Vector(lxintersect[6]+2.*offsetfrombridge-(tmountingpiecelength-tmountingpieceholefortuner)+tmountingpiecelength,lyintersect[5]+24-tmountingpiecewidth, -thicknessbodyplate))
PBodyndrplaat = PBodyndrplaat.cut(cuttmountingpiecetreble2cyl2)

cuttmountingpiecetreble3cyl1 = cuttmountingpiecebasscyl1.copy()
cuttmountingpiecetreble3cyl1.translate(Base.Vector(lxintersect[6]+2.*offsetfrombridge-(tmountingpiecelength-tmountingpieceholefortuner)+2.*tmountingpiecelength,lyintersect[4]+24-tmountingpiecewidth, -thicknessbodyplate))
PBodyndrplaat = PBodyndrplaat.cut(cuttmountingpiecetreble3cyl1)
cuttmountingpiecetreble3cyl2 = cuttmountingpiecebasscyl2.copy()
cuttmountingpiecetreble3cyl2.translate(Base.Vector(lxintersect[6]+2.*offsetfrombridge-(tmountingpiecelength-tmountingpieceholefortuner)+2.*tmountingpiecelength,lyintersect[4]+24-tmountingpiecewidth, -thicknessbodyplate))
PBodyndrplaat = PBodyndrplaat.cut(cuttmountingpiecetreble3cyl2)

cuttmountingpiecetreble4cyl1 = cuttmountingpiecebasscyl1.copy()
cuttmountingpiecetreble4cyl1.translate(Base.Vector(lxintersect[6]+2.*offsetfrombridge-(tmountingpiecelength-tmountingpieceholefortuner)+3.*tmountingpiecelength,lyintersect[3]+24-tmountingpiecewidth, -thicknessbodyplate))
PBodyndrplaat = PBodyndrplaat.cut(cuttmountingpiecetreble4cyl1)
cuttmountingpiecetreble4cyl2 = cuttmountingpiecebasscyl2.copy()
cuttmountingpiecetreble4cyl2.translate(Base.Vector(lxintersect[6]+2.*offsetfrombridge-(tmountingpiecelength-tmountingpieceholefortuner)+3.*tmountingpiecelength,lyintersect[3]+24-tmountingpiecewidth, -thicknessbodyplate))
PBodyndrplaat = PBodyndrplaat.cut(cuttmountingpiecetreble4cyl2)

###

# Drawing nut extension
endpieceV1 = Base.Vector(-xoffset,-yoffset,thfretboard)
endpieceV2 = Base.Vector(-xoffset,-yoffset,0)
endpieceV3 = Base.Vector(-xoffset,-yoffset+thicknessneck-thicknessneck/2**0.5,-thicknessneck/2**0.5)
endpieceV4 = Base.Vector(-xoffset,-yoffset+thicknessneck,-thicknessneck)
endpieceV5 = Base.Vector(-xoffset,yoffset-thicknessneck,-thicknessneck)
endpieceV6 = Base.Vector(-xoffset,yoffset-thicknessneck+thicknessneck/2**0.5,-thicknessneck/2**0.5)
endpieceV7 = Base.Vector(-xoffset,yoffset,0)
endpieceV8 = Base.Vector(-xoffset,yoffset,thfretboard)

endpieceL1 = Part.Line(endpieceV1,endpieceV2)
endpieceA1 = Part.Arc(endpieceV2,endpieceV3,endpieceV4)
endpieceL2 = Part.Line(endpieceV4,endpieceV5)
endpieceA2 = Part.Arc(endpieceV5,endpieceV6,endpieceV7)
endpieceL3 = Part.Line(endpieceV7,endpieceV8)
endpieceL4 = Part.Line(endpieceV8,endpieceV1)

endpiece = Part.Shape([endpieceL1,endpieceA1,endpieceL2,endpieceA2,endpieceL3,endpieceL4])
Wendpiece = Part.Wire(endpiece.Edges)
Fendpiece = Part.Face(Wendpiece)
Pendpiece = Fendpiece.extrude(Base.Vector(-thendpiece,0,0))
Pendpiece.translate(Base.Vector(0,0,thicknessneck))

## Drawing string holes
for i in range(len(diastr)):   
  diastrtemp = diastr[0:i+1]
  sdoffsettemp = sdoffset[0:i+1]
  rholetemp =diastr[i]/2.+0.8
  holetemp = Part.makeCylinder(rholetemp,thendpiece)
  holetemp.rotate((0,0,0),(0,1,0),90)
  holetemp.translate(Base.Vector(-xoffset-thendpiece,-yoffset+sdside+sum(diastrtemp)+sum(sdoffsettemp)-0.5*diastr[i],thicknessneck+rholetemp))
  Pendpiece = Pendpiece.cut(holetemp)

## Drawing holes for mounting endpiece and trussrods
###
rtrussrodhole = 3.5
holetemp = Part.makeCylinder(rtrussrodhole,thendpiece)
holetemp.rotate((0,0,0),(0,1,0),90)
holetemp1 = holetemp.copy()
holetemp.translate(Base.Vector(-xoffset-thendpiece,-yoffset+diffbetweentrussrods+rtrussrodhole,thicknessneck-rtrussrodhole-2.))
holetemp1.translate(Base.Vector(-xoffset-thendpiece,yoffset-diffbetweentrussrods-rtrussrodhole,thicknessneck-rtrussrodhole-2.))
Pendpiece = Pendpiece.cut(holetemp)
Pendpiece = Pendpiece.cut(holetemp1)
holetemp =  Part.makeCylinder(2,thendpiece)
holetemp.rotate((0,0,0),(0,1,0),90)
holetemp.translate(Base.Vector(-xoffset-thendpiece,0,0.5*thicknessneck))
Pendpiece = Pendpiece.cut(holetemp)

## Drawing XLR plates

Pxlrplate = Part.makeBox(lengthxlr+20,widthxlr+20,widthfret)
Pxlrplate = Pxlrplate.makeFillet(0.4,Pxlrplate.Edges)

rxlrmountinghole = 2
xlrmountinghole1 = Part.makeCylinder(rxlrmountinghole,widthfret)
xlrmountinghole2 = xlrmountinghole1.copy()
xlrmountinghole3 = xlrmountinghole1.copy()
xlrmountinghole4 = xlrmountinghole1.copy()
xlrmountinghole1.translate(Base.Vector(5,5,0))
xlrmountinghole2.translate(Base.Vector(5,widthxlr+20-5,0))
xlrmountinghole3.translate(Base.Vector(lengthxlr+20-5,widthxlr+20-5,0))
xlrmountinghole4.translate(Base.Vector(lengthxlr+20-5,5,0))
Pxlrplate = Pxlrplate.cut(xlrmountinghole1)
Pxlrplate = Pxlrplate.cut(xlrmountinghole2)
Pxlrplate = Pxlrplate.cut(xlrmountinghole3)
Pxlrplate = Pxlrplate.cut(xlrmountinghole4)

Pxlrplate1 = Pxlrplate.copy()

rxlrinput = 10
nrrowxlr = 2
nrcolumnxlr = 4
difrowxlr = (widthxlr-nrrowxlr*2*rxlrinput)/(nrrowxlr+1)
difcolumnxlr = (lengthxlr-nrcolumnxlr*2*rxlrinput)/(nrcolumnxlr+1)
cutxlrplate = Part.makeCylinder(rxlrinput,widthfret)
cutxlrcyl1 = Part.makeCylinder(2,widthfret)
cutxlrcyl2 = cutxlrcyl1.copy()
cutxlrcyl1.translate(Base.Vector(0,-13,0))
cutxlrcyl2.translate(Base.Vector(0,13,0))
cutxlrplate = cutxlrplate.fuse(cutxlrcyl1)
cutxlrplate = cutxlrplate.fuse(cutxlrcyl2)

cutxlrplate.translate(Base.Vector(10+difcolumnxlr+rxlrinput,10+difrowxlr+rxlrinput,0))
Pxlrplate= Pxlrplate.cut(cutxlrplate)

cutxlrplate.translate(Base.Vector(difcolumnxlr+2*rxlrinput,0,0))
Pxlrplate= Pxlrplate.cut(cutxlrplate)

cutxlrplate.translate(Base.Vector(difcolumnxlr+2*rxlrinput,0,0))
Pxlrplate= Pxlrplate.cut(cutxlrplate)

cutxlrplate.translate(Base.Vector(difcolumnxlr+2*rxlrinput,0,0))
Pxlrplate= Pxlrplate.cut(cutxlrplate)

cutxlrplate.translate(Base.Vector(0,difrowxlr+2*rxlrinput,0))
Pxlrplate= Pxlrplate.cut(cutxlrplate)

cutxlrplate.translate(Base.Vector(-(difcolumnxlr+2*rxlrinput),0,0))
Pxlrplate= Pxlrplate.cut(cutxlrplate)

cutxlrplate.translate(Base.Vector(-(difcolumnxlr+2*rxlrinput),0,0))
Pxlrplate= Pxlrplate.cut(cutxlrplate)

cutxlrplate.translate(Base.Vector(-(difcolumnxlr+2*rxlrinput),0,0))
Pxlrplate= Pxlrplate.cut(cutxlrplate)

Pxlrplate.translate(Base.Vector(0,-200,0))

xlrplate = FreeCAD.ActiveDocument.addObject("Part::Feature","xlrplate")
xlrplate.Shape = Pxlrplate

Pxlrplate1.translate(Base.Vector(lengthxlr+20+10,-200,0))

xlrplate1 = FreeCAD.ActiveDocument.addObject("Part::Feature","xlrplate1")
xlrplate1.Shape = Pxlrplate1

# Drawing of body, neck and endpiece:
 
Bodyupperplate = FreeCAD.ActiveDocument.addObject("Part::Feature","Body - Upper plate")
Bodyupperplate.Shape = PBodybvnplaat

Bodyunderplate = FreeCAD.ActiveDocument.addObject("Part::Feature","Body under plate")
Bodyunderplate.Shape = PBodyndrplaat

Endpiece = FreeCAD.ActiveDocument.addObject("Part::Feature","Endpiece")
Endpiece.Shape = Pendpiece

### Frets on a row
doc=App.activeDocument()
grp=doc.addObject("App::DocumentObjectGroup", "Frets for cutter")

for i in range(0,numberfrets+1):
  Fretdisplay = Pfret[i]
  Fretdisplay.rotate((0,0,0),(0,0,1),90)
  Fretdisplay.rotate((0,0,0),(0,1,0),-90)
  Fretdisplay.translate(Base.Vector(i*(thfretboard+heightfret+3),100,0))
  Fretnr = "Fret"+str(i)
  Fretfcutter = FreeCAD.ActiveDocument.addObject("Part::Feature",Fretnr)
  Fretfcutter.Shape = Fretdisplay
  grp.addObject(Fretfcutter)

### jig for router
PJigrouter = Part.makeBox(800,120,thicknessneck)
PJigrouter.translate(Base.Vector(-100,-60,0))
PJigrouter = PJigrouter.cut(Pcutjigrouter)
PJigrouter.translate(Base.Vector(0,-300,0))
Jigrouter = FreeCAD.ActiveDocument.addObject("Part::Feature","Jigrouter")
Jigrouter.Shape = PJigrouter

### TunerMountingPiece + SingleStringBridge

for i in range(0,len(diastr)+1):
  Ptmountingpiecetreblefcutter = tmountingpiecetreble.copy()
  Ptmountingpiecetreblefcutter.translate(Base.Vector(i*(tmountingpiecelength+5.),250,0))
  tmountingpiecefcutter = FreeCAD.ActiveDocument.addObject("Part::Feature","TunerMountingPiece")
  tmountingpiecefcutter.Shape = Ptmountingpiecetreblefcutter
  Pbridgefcutter = Lbridge[0].copy()
  Pbridgefcutter.translate(Base.Vector(i*(bridgelength+5.),300,0))
  bridgefcutter = FreeCAD.ActiveDocument.addObject("Part::Feature","SingleStringBridge")
  bridgefcutter.Shape = Pbridgefcutter

Gui.SendMsgToActiveView("ViewFit")

###
User avatar
Hans Bezemer
 
Posts: 372
Joined: Sat May 26, 2012 1:01 am
Location: The Netherlands

Re: Quintar by Hans Bezemer

Postby Peter Wilcox » Sun Jun 01, 2014 9:44 pm

Hans - all this is completely new to me and way over my head, but I'll be following with interest.
Maybe I can't fix it, but I can fix it so no one can fix it
User avatar
Peter Wilcox
 
Posts: 873
Joined: Sun Jan 08, 2012 1:31 am
Location: Northeastern California

Re: Quintar by Hans Bezemer

Postby Jason Rodgers » Mon Jun 02, 2014 3:59 pm

Hang on, man! This looks a lot like computer programming! :o

I got a 'D' in Computer Science I, so I'm going to smile and nod for a while. :lol:
-Ruining perfectly good wood, one day at a time.
Jason Rodgers
 
Posts: 1542
Joined: Fri Jan 06, 2012 4:05 pm
Location: Portland, OR

Re: Quintar by Hans Bezemer

Postby Hans Bezemer » Mon Jun 02, 2014 4:13 pm

Well actually it is... I'm not at all an computer expert, but google is my friend here... So step by step I'm getting there... only my eyes are becoming rectangle from watching my computer screen ...:geek:
User avatar
Hans Bezemer
 
Posts: 372
Joined: Sat May 26, 2012 1:01 am
Location: The Netherlands

Re: Quintar by Hans Bezemer

Postby Hans Bezemer » Tue Jun 03, 2014 1:20 pm

I've been fooling around with the script and this is how the fretboard will look like, kinda weird eh.
Screenshot 4.jpg
Screenshot 4.jpg (8.11 KiB) Viewed 7908 times
Screenshot 5.jpg

But I want to give it a try.

Hans

Code: Select all
# To do:
# Pickup

App.newDocument("Quintar")

from FreeCAD import Base
import Part, math, datetime, os, copy

# Variables

## Golden ratio
goldenratio = 2.0/(math.sqrt(5.0)-1.0)

## Frets

typefretboard = 2         # unfretted = 0 / fretted = 1 /  using fretdatabase = 2
octavedivider = 31.
numberfrets = 62
widthfret = 1.
heightfret = 3.
depthfret = 1.
offsetfret = 2.4
fretmatrix = [[1,7],[7,7],[1,4],[1,7],[0,0],[1,7],[5,7],[1,2],[1,7],[0,0],[1,7],[3,7],[0,0],[1,7],[0,0],[1,5],[1,7],
[0,0],[1,7],[6,7],[1,3],[1,7],[0,0],[1,7],[4,7],[1,1],[1,7],[0,0],[1,6],[2,7],[0,0],
[1,7],[7,7],[1,4],[1,7],[0,0],[1,7],[5,7],[1,2],[1,7],[0,0],[1,7],[3,7],[0,0],[1,7],[0,0],[1,5],[1,7],
[0,0],[1,7],[6,7],[1,3],[1,7],[0,0],[1,7],[4,7],[1,1],[1,7],[0,0],[1,6],[2,7],[0,0]]

## stringlengths

slbass = 777.0                     # stringlength on bassside
sltreble = slbass/7*6         # stringlength on trebleside
compensation = 3.                  # string compensation at the bridge

offsetbridge = (slbass-sltreble)/goldenratio         # Offset off the trebleside
offsetnut = (slbass-sltreble)-offsetbridge

## single string bridge

bridgelength = 40.0
rbridgercylinder = 4./2.*0.8
bridgewidth = 8.0

rlowerhole = 2.0
rhigherhole = 4.0
rsaddle = 3*0.8
offset1 = 1.0
offset2 = offset1+rhigherhole-rlowerhole

## Body
thicknessbodyplate = 18.
fretwherebodymeetsneck = int(numberfrets*2/3)
lengthbody = slbass/goldenratio
distancesboltofbridge = 10.
radiusbridgebolt = 2*0.8            # 4mm bolts are used
offsetfrombridge = 30.                # offset of cut for tuners
offsettuners = 40.               # offset for tuners
totdisttreble = 150.               # distance of the line where the tuners are located at trebleside
totdistbass = 120.               # distance of the line where the tuners are located at bassside
offsetxlr = 10
offsetxlrplate = 5
widthxlr = 80
lengthxlr = totdisttreble
transxlr = 10
Alignmenthole = 8.
rneckbolts = 4.                  # radius of holes to fasten the neck

## diameter strings
diastr = []
diastr.append(0.145*25.4)
diastr.append(0.090*25.4)
diastr.append(0.055*25.4)
diastr.append(0.034*25.4)
diastr.append(0.021*25.4)
diastr.append(0.013*25.4)
diastr.append(0.010*25.4)

## stringdistance
sdbridgetreble = 10.5
sdbridgebass = 15.0
factorsd = (sdbridgebass/sdbridgetreble)**(1./(len(diastr)-2.))
sdnuttreble = sdbridgetreble/goldenratio
sdside = 3.0

## Tuner mounting pieces
tmountingpiecelength = 35.
tmountingpiecewidth = 17.5
tmountingpieceholefortuner = 12.5          # (measured from the rightside)

## Trussrod
Trussrodwidth = 10.
numbertrusrod = 2.

###

# width nut and bridge
sdnut = []
sdbridge = []
sdnut.append(0)
sdbridge.append(0)
for i in range(0,(len(diastr)-1)):
  sdnut.append(sdnuttreble*factorsd**(len(diastr)-2-i))
  sdbridge.append(sdbridgetreble*factorsd**(len(diastr)-2-i))

widthnut = 2.*sdside+sum(sdnut)+sum(diastr)
widthbridge = 2.*sdside+sum(sdbridge)+sum(diastr)
thicknessneck = 18.0
thfretboard = 6.0
thendpiece = 1

xneckbass = slbass-slbass/2**(numberfrets/octavedivider)
yneckbass = -(widthnut/2.0+(widthbridge-widthnut)/2.0*xneckbass/slbass)
xbridgebass = slbass
ybridgebass = -0.5*widthbridge
xnecktreble = slbass-slbass/2**(numberfrets/octavedivider)
ynecktreble = (widthnut/2.0+(widthbridge-widthnut)/2.0*xnecktreble/slbass)


###

# Calculating total quintar length.
xend = slbass-slbass/2**(fretwherebodymeetsneck/octavedivider)+lengthbody
yend = (widthnut/2.0+(widthbridge-widthnut)/2.0*xend/slbass)

yverschil = yend-widthnut/2.0
angleneck = math.atan2(yverschil,xend)   # angle neck in radians
cosangleneck = math.cos(angleneck)
sinangleneck = math.sin(angleneck)
tanangleneck = math.tan(angleneck)

###

# Frets drawing
doc=App.activeDocument()
grp=doc.addObject("App::DocumentObjectGroup", "Frets")

## Calculating the lines of the sides, the lines from the thickness of the frets and the offset of the fretslot from the side)
rcsideneckbass = (-0.5*widthbridge+0.5*widthnut)/(slbass)
rcsidenecktreble = (0.5*widthbridge-0.5*widthnut)/(slbass)

dybsideneckbassfretdist = math.sqrt(((0.5*widthfret)**2)/((rcsideneckbass**2.)+1.))
ybsideneckbassfretdist = -0.5*widthnut+dybsideneckbassfretdist
dxbsideneckbassfretdist = math.sqrt(((0.5*widthfret)**2)/(1/(rcsideneckbass**2.)+1.))
xbsideneckbassfretdist = 0+dxbsideneckbassfretdist
bsideneckbassfretdist = ybsideneckbassfretdist-rcsideneckbass*xbsideneckbassfretdist

dybsideneckbassfretoffset = math.sqrt(((offsetfret)**2)/((rcsideneckbass**2.)+1.))
ybsideneckbassfretoffset = -0.5*widthnut+dybsideneckbassfretoffset
dxbsideneckbassfretoffset = math.sqrt(((offsetfret)**2)/(1/(rcsideneckbass**2.)+1.))
xbsideneckbassfretoffset = 0+dxbsideneckbassfretoffset
bsideneckbassfretoffset = ybsideneckbassfretoffset-rcsideneckbass*xbsideneckbassfretoffset

dybsidenecktreblefretdist = math.sqrt(((0.5*widthfret)**2)/((rcsidenecktreble**2.)+1.))
ybsidenecktreblefretdist = 0.5*widthnut-dybsidenecktreblefretdist
dxbsidenecktreblefretdist = math.sqrt(((0.5*widthfret)**2)/(1/(rcsidenecktreble**2.)+1.))
xbsidenecktreblefretdist = 0+dxbsidenecktreblefretdist
bsidenecktreblefretdist = ybsidenecktreblefretdist-rcsidenecktreble*xbsidenecktreblefretdist

dybsidenecktreblefretoffset = math.sqrt(((offsetfret)**2)/((rcsidenecktreble**2.)+1.))
ybsidenecktreblefretoffset = 0.5*widthnut-dybsidenecktreblefretoffset
dxbsidenecktreblefretoffset = math.sqrt(((offsetfret)**2)/(1/(rcsidenecktreble**2.)+1.))
xbsidenecktreblefretoffset = 0+dxbsidenecktreblefretoffset
bsidenecktreblefretoffset = ybsidenecktreblefretoffset-rcsidenecktreble*xbsidenecktreblefretoffset

xbass = []
ybass = []
xtreble = []
ytreble = []
rcfret = []
bfret = []
Pfret = []
Pcut = []

def xintersectline(rc1,b1,rc2,b2):
  x = (b2-b1)/(rc1-rc2)
  return x

def yintersectline(rc1,b1,rc2,b2):
  y = (b2-rc2*b1/rc1)/(1-rc2/rc1)
  return y

def distbtwopoints(x0,x1,y0,y1):
  dist = math.sqrt((y1-y0)**2+(x1-x0)**2)
  return dist

if typefretboard == 0:
  for i in range(0,numberfrets+1):
    xbass.append(slbass-slbass/2**(i/octavedivider))
    ybass.append(-(widthnut/2.0+(widthbridge-widthnut)/2.0*xbass[i]/slbass))
    xtreble.append(offsetnut+sltreble-sltreble/2.0**(i/octavedivider))
    ytreble.append((widthnut/2.0+(widthbridge-widthnut)/2.0*xtreble[i]/slbass))
    rcfret.append((ytreble[i]-ybass[i])/(xtreble[i]-xbass[i]))
    bfret.append(ybass[i]-rcfret[i]*xbass[i])
   
    xfretdistbass = xintersectline(rcfret[i],bfret[i],rcsideneckbass,bsideneckbassfretdist)
    yfretdistbass = yintersectline(rcfret[i],bfret[i],rcsideneckbass,bsideneckbassfretdist)
    xfretoffsetbass = xintersectline(rcfret[i],bfret[i],rcsideneckbass,bsideneckbassfretoffset)
    yfretoffsetbass = yintersectline(rcfret[i],bfret[i],rcsideneckbass,bsideneckbassfretoffset)
    dist1 = distbtwopoints(xfretdistbass, xfretoffsetbass, yfretdistbass, yfretoffsetbass)
     
    xfretdisttreble = xintersectline(rcfret[i],bfret[i],rcsidenecktreble,bsidenecktreblefretdist)
    yfretdisttreble = yintersectline(rcfret[i],bfret[i],rcsidenecktreble,bsidenecktreblefretdist)
    xfretoffsettreble = xintersectline(rcfret[i],bfret[i],rcsidenecktreble,bsidenecktreblefretoffset)
    yfretoffsettreble = yintersectline(rcfret[i],bfret[i],rcsidenecktreble,bsidenecktreblefretoffset)
    dist2 = distbtwopoints(xfretoffsettreble, xfretdisttreble, yfretoffsettreble, yfretdisttreble)
   
    distfretbasstreble = distbtwopoints(xfretdistbass,xfretdisttreble,yfretdistbass,yfretdisttreble)
    distbetwnoffsets = distbtwopoints(xfretoffsetbass,xfretoffsettreble,yfretoffsetbass,yfretoffsettreble)
     
    V1temp = Base.Vector(0,0,0)
    V2temp = Base.Vector(dist1,0,0)
    V3temp = Base.Vector(dist1,0,-thfretboard+depthfret)
    V4temp = Base.Vector(distfretbasstreble-dist2,0,-thfretboard+depthfret)
    V5temp = Base.Vector(distfretbasstreble-dist2,0,0)
    V6temp = Base.Vector(distfretbasstreble,0,0)
    V7temp = Base.Vector(distfretbasstreble,0,heightfret-1)
    V8temp = Base.Vector(distfretbasstreble-1,0,heightfret)
    V9temp = Base.Vector(1,0,heightfret)
    V10temp = Base.Vector(0,0,heightfret-1)
     
    L1temp = Part.Line(V1temp,V2temp)
    L2temp = Part.Line(V2temp,V3temp)
    L3temp = Part.Line(V3temp,V4temp)
    L4temp = Part.Line(V4temp,V5temp)
    L5temp = Part.Line(V5temp,V6temp)
    L6temp = Part.Line(V6temp,V7temp)
    L7temp = Part.Line(V7temp,V8temp)
    L8temp = Part.Line(V8temp,V9temp)
    L9temp = Part.Line(V9temp,V10temp)
    L10temp = Part.Line(V10temp,V1temp)
   
    Sfrettemp = Part.Shape([L1temp,L2temp,L3temp,L4temp,L5temp,L6temp,L7temp,L8temp,L9temp,L10temp])
    Wfrettemp = Part.Wire(Sfrettemp.Edges)
    Ffrettemp = Part.Face(Wfrettemp)
    Pfrettemp = Ffrettemp.extrude(Base.Vector(0,widthfret,0))
    Pfrettemp.translate(Base.Vector(0,-0.5*widthfret,0))
    Pfrettemp1 = Pfrettemp.copy()
    Pfret.append(Pfrettemp1)
    afrettemp = math.atan2(yfretdisttreble-yfretdistbass,xfretdisttreble-xfretdistbass)
    Pfrettemp.rotate((0,0,0),(0,0,1),afrettemp*180./math.pi)
    Pfrettemp.translate(Base.Vector(xfretdistbass,yfretdistbass,thicknessneck+thfretboard))
    if i == 0:
      Fretnr = "Fret"+str(i)
      Fret = FreeCAD.ActiveDocument.addObject("Part::Feature",Fretnr)
      Fret.Shape = Pfrettemp
      grp.addObject(Fret)
   
      L1cuttemp = Part.Line(Base.Vector(0,0,0),Base.Vector(0,0,-thfretboard))
      L2cuttemp = Part.Line(Base.Vector(0,0,-thfretboard),Base.Vector(distfretbasstreble-dist1-dist2,0,-thfretboard))
      L3cuttemp = Part.Line(Base.Vector(distfretbasstreble-dist1-dist2,0,-thfretboard),Base.Vector(distfretbasstreble-dist1-dist2,0,0))
      L4cuttemp = Part.Line(Base.Vector(distfretbasstreble-dist1-dist2,0,-0),Base.Vector(0,0,0))
 
      Scuttemp = Part.Shape([L1cuttemp,L2cuttemp,L3cuttemp,L4cuttemp])
      Wcuttemp = Part.Wire(Scuttemp.Edges)
      Fcuttemp = Part.Face(Wcuttemp)
      Pcuttemp = Fcuttemp.extrude(Base.Vector(0,widthfret,0))
      Pcuttemp.translate(Base.Vector(0,-0.5*widthfret,0))
      Pcuttemp.rotate((0,0,0),(0,0,1),afrettemp*180./math.pi)
      Pcuttemp.translate(Base.Vector(xfretoffsetbass,yfretoffsetbass,thicknessneck+thfretboard))
      Pcut.append(Pcuttemp)
      Vfretboardtemp1 = Base.Vector(xbass[0],ybass[0],0)
      Vfretboardtemp2 = Base.Vector(xneckbass,yneckbass,0)
      Vfretboardtemp3 = Base.Vector(xnecktreble,ynecktreble,0)
      Vfretboardtemp4 = Base.Vector(xtreble[0],ytreble[0],0)
     
      Lfretboardtemp1 = Part.Line(Vfretboardtemp1,Vfretboardtemp2)
      Lfretboardtemp2 = Part.Line(Vfretboardtemp2,Vfretboardtemp3)
      Lfretboardtemp3 = Part.Line(Vfretboardtemp3,Vfretboardtemp4)
      Lfretboardtemp4 = Part.Line(Vfretboardtemp4,Vfretboardtemp1)
     
      Sfretboardtemp = Part.Shape([Lfretboardtemp1,Lfretboardtemp2,Lfretboardtemp3,Lfretboardtemp4])
      Wfretboardtemp = Part.Wire(Sfretboardtemp.Edges)
      Ffretboardtemp = Part.Face(Wfretboardtemp)
      Pfretboardtemp = Ffretboardtemp.extrude(Base.Vector(0,0,widthfret))
      Pfretboardtemp.translate(Base.Vector(0,0,thicknessneck+thfretboard))
      Pfretboardtemp = Pfretboardtemp.cut(Pfrettemp)
      FFretboard = FreeCAD.ActiveDocument.addObject("Part::Feature","fretlessfretboard")
      FFretboard.Shape = Pfretboardtemp
      grp.addObject(Fret)
    else:
      print ' '
elif typefretboard == 1:
  for i in range(0,numberfrets+1):
    xbass.append(slbass-slbass/2**(i/octavedivider))
    ybass.append(-(widthnut/2.0+(widthbridge-widthnut)/2.0*xbass[i]/slbass))
    xtreble.append(offsetnut+sltreble-sltreble/2.0**(i/octavedivider))
    ytreble.append((widthnut/2.0+(widthbridge-widthnut)/2.0*xtreble[i]/slbass))
    rcfret.append((ytreble[i]-ybass[i])/(xtreble[i]-xbass[i]))
    bfret.append(ybass[i]-rcfret[i]*xbass[i])
     
    # length fret
    xfretdistbass = xintersectline(rcfret[i],bfret[i],rcsideneckbass,bsideneckbassfretdist)
    yfretdistbass = yintersectline(rcfret[i],bfret[i],rcsideneckbass,bsideneckbassfretdist)
    xfretoffsetbass = xintersectline(rcfret[i],bfret[i],rcsideneckbass,bsideneckbassfretoffset)
    yfretoffsetbass = yintersectline(rcfret[i],bfret[i],rcsideneckbass,bsideneckbassfretoffset)
    dist1 = distbtwopoints(xfretdistbass, xfretoffsetbass, yfretdistbass, yfretoffsetbass)
     
    xfretdisttreble = xintersectline(rcfret[i],bfret[i],rcsidenecktreble,bsidenecktreblefretdist)
    yfretdisttreble = yintersectline(rcfret[i],bfret[i],rcsidenecktreble,bsidenecktreblefretdist)
    xfretoffsettreble = xintersectline(rcfret[i],bfret[i],rcsidenecktreble,bsidenecktreblefretoffset)
    yfretoffsettreble = yintersectline(rcfret[i],bfret[i],rcsidenecktreble,bsidenecktreblefretoffset)
    dist2 = distbtwopoints(xfretoffsettreble, xfretdisttreble, yfretoffsettreble, yfretdisttreble)
   
    distfretbasstreble = distbtwopoints(xfretdistbass,xfretdisttreble,yfretdistbass,yfretdisttreble)
    distbetwnoffsets = distbtwopoints(xfretoffsetbass,xfretoffsettreble,yfretoffsetbass,yfretoffsettreble)
     
    V1temp = Base.Vector(0,0,0)
    V2temp = Base.Vector(dist1,0,0)
    V3temp = Base.Vector(dist1,0,-thfretboard+depthfret)
    V4temp = Base.Vector(distfretbasstreble-dist2,0,-thfretboard+depthfret)
    V5temp = Base.Vector(distfretbasstreble-dist2,0,0)
    V6temp = Base.Vector(distfretbasstreble,0,0)
    V7temp = Base.Vector(distfretbasstreble,0,heightfret-1)
    V8temp = Base.Vector(distfretbasstreble-1,0,heightfret)
    V9temp = Base.Vector(1,0,heightfret)
    V10temp = Base.Vector(0,0,heightfret-1)
     
    L1temp = Part.Line(V1temp,V2temp)
    L2temp = Part.Line(V2temp,V3temp)
    L3temp = Part.Line(V3temp,V4temp)
    L4temp = Part.Line(V4temp,V5temp)
    L5temp = Part.Line(V5temp,V6temp)
    L6temp = Part.Line(V6temp,V7temp)
    L7temp = Part.Line(V7temp,V8temp)
    L8temp = Part.Line(V8temp,V9temp)
    L9temp = Part.Line(V9temp,V10temp)
    L10temp = Part.Line(V10temp,V1temp)
   
    Sfrettemp = Part.Shape([L1temp,L2temp,L3temp,L4temp,L5temp,L6temp,L7temp,L8temp,L9temp,L10temp])
    Wfrettemp = Part.Wire(Sfrettemp.Edges)
    Ffrettemp = Part.Face(Wfrettemp)
    Pfrettemp = Ffrettemp.extrude(Base.Vector(0,widthfret,0))
    Pfrettemp.translate(Base.Vector(0,-0.5*widthfret,0))
    Pfrettemp1 = Pfrettemp.copy()
    Pfret.append(Pfrettemp1)
    afrettemp = math.atan2(yfretdisttreble-yfretdistbass,xfretdisttreble-xfretdistbass)
    Pfrettemp.rotate((0,0,0),(0,0,1),afrettemp*180./math.pi)
    Pfrettemp.translate(Base.Vector(xfretdistbass,yfretdistbass,thicknessneck+thfretboard))
    Fretnr = "Fret"+str(i)
    Fret = FreeCAD.ActiveDocument.addObject("Part::Feature",Fretnr)
    Fret.Shape = Pfrettemp
    grp.addObject(Fret)

    L1cuttemp = Part.Line(Base.Vector(0,0,0),Base.Vector(0,0,-thfretboard))
    L2cuttemp = Part.Line(Base.Vector(0,0,-thfretboard),Base.Vector(distfretbasstreble-dist1-dist2,0,-thfretboard))
    L3cuttemp = Part.Line(Base.Vector(distfretbasstreble-dist1-dist2,0,-thfretboard),Base.Vector(distfretbasstreble-dist1-dist2,0,0))
    L4cuttemp = Part.Line(Base.Vector(distfretbasstreble-dist1-dist2,0,-0),Base.Vector(0,0,0))
   
    Scuttemp = Part.Shape([L1cuttemp,L2cuttemp,L3cuttemp,L4cuttemp])
    Wcuttemp = Part.Wire(Scuttemp.Edges)
    Fcuttemp = Part.Face(Wcuttemp)
    Pcuttemp = Fcuttemp.extrude(Base.Vector(0,widthfret,0))
    Pcuttemp.translate(Base.Vector(0,-0.5*widthfret,0))
    Pcuttemp.rotate((0,0,0),(0,0,1),afrettemp*180./math.pi)
    Pcuttemp.translate(Base.Vector(xfretoffsetbass,yfretoffsetbass,thicknessneck+thfretboard))
    Pcut.append(Pcuttemp)
elif typefretboard == 2:
  for i in range(0,numberfrets+1):
    if fretmatrix[i] == [0,0]:
      print i
    else:
      q = fretmatrix[i][0]
      diastrtempbass = diastr[0:q-1]
      sdnuttempbass = sdnut[0:q]
      sdbridgetempbass = sdbridge[0:q]
      ynuttempbass = -widthnut/2 + sum(diastrtempbass) + sum(sdnuttempbass)       #+ 0.5*sdnut[q-1]
      ybridgetempbass = -widthbridge/2.0 + sum(diastrtempbass) + sum(sdbridgetempbass)    #+ 0.5*sdbridge[q-1]
     
      r = fretmatrix[i][1]
      diastrtemptreble = diastr[0:r]
      sdnuttemptreble = sdnut[0:r]
      sdbridgetemptreble = sdbridge[0:r]
      ynuttemptreble = -widthnut/2 + 2*sdside + sum(diastrtemptreble) + sum(sdnuttemptreble)
      ybridgetemptreble = -widthbridge/2.0 + 2*sdside + sum(diastrtemptreble) + sum(sdbridgetemptreble)
     
      rcsideneckbass = (ybridgetempbass-ynuttempbass)/(slbass)
      rcsidenecktreble = (ybridgetemptreble-ynuttemptreble)/(slbass)

      dybsideneckbassfretdist = math.sqrt(((0.5*widthfret)**2)/((rcsideneckbass**2.)+1.))
      ybsideneckbassfretdist = ynuttempbass+dybsideneckbassfretdist
      dxbsideneckbassfretdist = math.sqrt(((0.5*widthfret)**2)/(1/(rcsideneckbass**2.)+1.))
      xbsideneckbassfretdist = 0+dxbsideneckbassfretdist
      bsideneckbassfretdist = ybsideneckbassfretdist-rcsideneckbass*xbsideneckbassfretdist

      dybsideneckbassfretoffset = math.sqrt(((offsetfret)**2)/((rcsideneckbass**2.)+1.))
      ybsideneckbassfretoffset = ynuttempbass+dybsideneckbassfretoffset
      dxbsideneckbassfretoffset = math.sqrt(((offsetfret)**2)/(1/(rcsideneckbass**2.)+1.))
      xbsideneckbassfretoffset = 0+dxbsideneckbassfretoffset
      bsideneckbassfretoffset = ybsideneckbassfretoffset-rcsideneckbass*xbsideneckbassfretoffset

      dybsidenecktreblefretdist = math.sqrt(((0.5*widthfret)**2)/((rcsidenecktreble**2.)+1.))
      ybsidenecktreblefretdist = ynuttemptreble-dybsidenecktreblefretdist
      dxbsidenecktreblefretdist = math.sqrt(((0.5*widthfret)**2)/(1/(rcsidenecktreble**2.)+1.))
      xbsidenecktreblefretdist = 0+dxbsidenecktreblefretdist
      bsidenecktreblefretdist = ybsidenecktreblefretdist-rcsidenecktreble*xbsidenecktreblefretdist

      dybsidenecktreblefretoffset = math.sqrt(((offsetfret)**2)/((rcsidenecktreble**2.)+1.))
      ybsidenecktreblefretoffset = ynuttemptreble-dybsidenecktreblefretoffset
      dxbsidenecktreblefretoffset = math.sqrt(((offsetfret)**2)/(1/(rcsidenecktreble**2.)+1.))
      xbsidenecktreblefretoffset = 0+dxbsidenecktreblefretoffset
      bsidenecktreblefretoffset = ybsidenecktreblefretoffset-rcsidenecktreble*xbsidenecktreblefretoffset
     
      xbass.append(slbass-slbass/2**(i/octavedivider))
      ybass.append(-(widthnut/2.0+(widthbridge-widthnut)/2.0*xbass[len(xbass)-1]/slbass))
      xtreble.append(offsetnut+sltreble-sltreble/2.0**(i/octavedivider))
      ytreble.append((widthnut/2.0+(widthbridge-widthnut)/2.0*xtreble[len(xtreble)-1]/slbass))
      rcfret.append((ytreble[len(ytreble)-1]-ybass[len(ybass)-1])/(xtreble[len(xtreble)-1]-xbass[len(xbass)-1]))
      bfret.append(ybass[len(ybass)-1]-rcfret[len(rcfret)-1]*xbass[len(xbass)-1])
   
      # length fret
      xfretdistbass = xintersectline(rcfret[len(rcfret)-1],bfret[len(bfret)-1],rcsideneckbass,bsideneckbassfretdist)
      yfretdistbass = yintersectline(rcfret[len(rcfret)-1],bfret[len(bfret)-1],rcsideneckbass,bsideneckbassfretdist)
      xfretoffsetbass = xintersectline(rcfret[len(rcfret)-1],bfret[len(bfret)-1],rcsideneckbass,bsideneckbassfretoffset)
      yfretoffsetbass = yintersectline(rcfret[len(rcfret)-1],bfret[len(bfret)-1],rcsideneckbass,bsideneckbassfretoffset)
      dist1 = distbtwopoints(xfretdistbass, xfretoffsetbass, yfretdistbass, yfretoffsetbass)
   
      xfretdisttreble = xintersectline(rcfret[len(rcfret)-1],bfret[len(bfret)-1],rcsidenecktreble,bsidenecktreblefretdist)
      yfretdisttreble = yintersectline(rcfret[len(rcfret)-1],bfret[len(bfret)-1],rcsidenecktreble,bsidenecktreblefretdist)
      xfretoffsettreble = xintersectline(rcfret[len(rcfret)-1],bfret[len(bfret)-1],rcsidenecktreble,bsidenecktreblefretoffset)
      yfretoffsettreble = yintersectline(rcfret[len(rcfret)-1],bfret[len(bfret)-1],rcsidenecktreble,bsidenecktreblefretoffset)
      dist2 = distbtwopoints(xfretoffsettreble, xfretdisttreble, yfretoffsettreble, yfretdisttreble)
     
      distfretbasstreble = distbtwopoints(xfretdistbass,xfretdisttreble,yfretdistbass,yfretdisttreble)
      distbetwnoffsets = distbtwopoints(xfretoffsetbass,xfretoffsettreble,yfretoffsetbass,yfretoffsettreble)
   
      V1temp = Base.Vector(0,0,0)
      V2temp = Base.Vector(dist1,0,0)
      V3temp = Base.Vector(dist1,0,-thfretboard+depthfret)
      V4temp = Base.Vector(distfretbasstreble-dist2,0,-thfretboard+depthfret)
      V5temp = Base.Vector(distfretbasstreble-dist2,0,0)
      V6temp = Base.Vector(distfretbasstreble,0,0)
      V7temp = Base.Vector(distfretbasstreble,0,heightfret-1)
      V8temp = Base.Vector(distfretbasstreble-1,0,heightfret)
      V9temp = Base.Vector(1,0,heightfret)
      V10temp = Base.Vector(0,0,heightfret-1)
   
      L1temp = Part.Line(V1temp,V2temp)
      L2temp = Part.Line(V2temp,V3temp)
      L3temp = Part.Line(V3temp,V4temp)
      L4temp = Part.Line(V4temp,V5temp)
      L5temp = Part.Line(V5temp,V6temp)
      L6temp = Part.Line(V6temp,V7temp)
      L7temp = Part.Line(V7temp,V8temp)
      L8temp = Part.Line(V8temp,V9temp)
      L9temp = Part.Line(V9temp,V10temp)
      L10temp = Part.Line(V10temp,V1temp)
     
      Sfrettemp = Part.Shape([L1temp,L2temp,L3temp,L4temp,L5temp,L6temp,L7temp,L8temp,L9temp,L10temp])
      Wfrettemp = Part.Wire(Sfrettemp.Edges)
      Ffrettemp = Part.Face(Wfrettemp)
      Pfrettemp = Ffrettemp.extrude(Base.Vector(0,widthfret,0))
      Pfrettemp.translate(Base.Vector(0,-0.5*widthfret,0))
      Pfrettemp1 = Pfrettemp.copy()
      Pfret.append(Pfrettemp1)
      afrettemp = math.atan2(yfretdisttreble-yfretdistbass,xfretdisttreble-xfretdistbass)
      Pfrettemp.rotate((0,0,0),(0,0,1),afrettemp*180./math.pi)
      Pfrettemp.translate(Base.Vector(xfretdistbass,yfretdistbass,thicknessneck+thfretboard))
      Fretnr = "Fret"+str(i)
      Fret = FreeCAD.ActiveDocument.addObject("Part::Feature",Fretnr)
      Fret.Shape = Pfrettemp
      grp.addObject(Fret)

      L1cuttemp = Part.Line(Base.Vector(0,0,0),Base.Vector(0,0,-thfretboard))
      L2cuttemp = Part.Line(Base.Vector(0,0,-thfretboard),Base.Vector(distfretbasstreble-dist1-dist2,0,-thfretboard))
      L3cuttemp = Part.Line(Base.Vector(distfretbasstreble-dist1-dist2,0,-thfretboard),Base.Vector(distfretbasstreble-dist1-dist2,0,0))
      L4cuttemp = Part.Line(Base.Vector(distfretbasstreble-dist1-dist2,0,-0),Base.Vector(0,0,0))
     
      Scuttemp = Part.Shape([L1cuttemp,L2cuttemp,L3cuttemp,L4cuttemp])
      Wcuttemp = Part.Wire(Scuttemp.Edges)
      Fcuttemp = Part.Face(Wcuttemp)
      Pcuttemp = Fcuttemp.extrude(Base.Vector(0,widthfret,0))
      Pcuttemp.translate(Base.Vector(0,-0.5*widthfret,0))
      Pcuttemp.rotate((0,0,0),(0,0,1),afrettemp*180./math.pi)
      Pcuttemp.translate(Base.Vector(xfretoffsetbass,yfretoffsetbass,thicknessneck+thfretboard))
      Pcut.append(Pcuttemp)
    # tussenlijn
else:
  print 'no frets are drawn'
   
### 

# drawing outline

## points
xoffset = 30
yoffset = (widthnut/2.0-(widthbridge-widthnut)/2.0*xoffset/slbass)
V1 = Base.Vector(-xoffset,-yoffset)

V2 = Base.Vector(xneckbass,yneckbass)

V3 = Base.Vector(xnecktreble,ynecktreble,0)

V4 = Base.Vector(-xoffset,yoffset)

## lines
L1 = Part.Line(V1,V2)
L2 = Part.Line(V2,V3)
L3 = Part.Line(V3,V4)
L4 = Part.Line(V4,V1)

## make a part and wire of it
S1 = Part.Shape([L1,L2,L3,L4])
W1 = Part.Wire(S1.Edges)
F1 = Part.Face(W1)
P1 = F1.extrude(Base.Vector(0,0,thicknessneck))
P2 = F1.extrude(Base.Vector(0,0,thfretboard))
P2.translate(Base.Vector(0,0,thicknessneck))

## Cutout for trussrod
diffbetweentrussrods = (widthnut-numbertrusrod*Trussrodwidth)/(numbertrusrod+1)
cutouttrussrod1 = Part.makeBox(2,Trussrodwidth,thicknessneck)
cutouttrussrod2 = cutouttrussrod1.copy()
cutouttrussrod1.translate(Base.Vector(xneckbass-2., -0.5*widthnut+diffbetweentrussrods,0))
cutouttrussrod2.translate(Base.Vector(xneckbass-2., 0.5*widthnut-diffbetweentrussrods-Trussrodwidth,0))
P1 = P1.cut(cutouttrussrod1)
P1 = P1.cut(cutouttrussrod2)
Pcutjigrouter = P1.copy()

## cutout for strings

sdoffsettreble = (sdnuttreble-(sdbridgetreble-sdnuttreble)*xoffset/slbass)
sdoffset = []
sdoffset.append(0)
for i in range(0,(len(diastr)-1)):
  sdoffset.append(sdoffsettreble*factorsd**(len(diastr)-2.-i))

for i in range(len(diastr)):   # Note: cutout is 20% wider at the end then with 0 fret
  diastrtemp = diastr[0:i+1]
  sdnuttemp = sdnut[0:i+1]
  sdbridgetemp = sdbridge[0:i+1]
  sdoffsettemp = sdoffset[0:i+1]
  ynut = -widthnut/2 + sdside + sum(diastrtemp) - diastr[i] + sum(sdnuttemp)
  ybridge = -widthbridge/2.0 + sdside + sum(diastrtemp) - diastr[i] + sum(sdbridgetemp)
  xtemp1 = -xoffset
  ytemp1 = -yoffset + sdside + sum(diastrtemp) - diastr[i] - 0.1*diastr[i] + sum(sdoffsettemp)
  xtemp2 = xbass[0]+(xtreble[0]-xbass[0])*(ynut+widthnut/2.0)/widthnut - 5.0
  ytemp2 = ynut + (ybridge-ynut)*xtemp2/slbass
  xtemp3 = xtemp2
  ytemp3 = ytemp2 + diastr[i]
  xtemp4 = -xoffset
  ytemp4 = ytemp1 + 1.2*diastr[i]
  Vtemp1 = Base.Vector(xtemp1,ytemp1)
  Vtemp2 = Base.Vector(xtemp2,ytemp2)
  Vtemp3 = Base.Vector(xtemp3,ytemp3)
  Vtemp4 = Base.Vector(xtemp4,ytemp4)
  Ltemp1 = Part.Line(Vtemp1,Vtemp2)
  Ltemp2 = Part.Line(Vtemp2,Vtemp3)
  Ltemp3 = Part.Line(Vtemp3,Vtemp4)
  Ltemp4 = Part.Line(Vtemp4,Vtemp1)
  Stemp = Part.Shape([Ltemp1,Ltemp2,Ltemp3,Ltemp4])
  Wtemp = Part.Wire(Stemp.Edges)
  Ftemp = Part.Face(Wtemp)
  Ptemp = Ftemp.extrude(Base.Vector(0,0,thfretboard))
  Ptemp.translate(Base.Vector(0,0,thicknessneck))
  P2 = P2.cut(Ptemp)

## Cutting fretslots
if typefretboard == 0:
  P2 = P2.cut(Pcut[0])
else:
  for i in range(0,len(Pcut)+1):
    P2 = P2.cut(Pcut[i])

## Drawing mounting holes

cylindermountingneck = Part.makeCylinder(rneckbolts*0.8,thicknessbodyplate)
cylmneck1 = cylindermountingneck.copy()
cylmneck2 = cylindermountingneck.copy()
cylmneck3 = cylindermountingneck.copy()
cylmneck4 = cylindermountingneck.copy()
cylmneck1.translate(Base.Vector(slbass-slbass/2**(fretwherebodymeetsneck/octavedivider)+20.0,0.4*widthnut,0))
cylmneck2.translate(Base.Vector(slbass-slbass/2**(numberfrets/octavedivider)-20.0,0.4*widthnut,0))
cylmneck3.translate(Base.Vector(slbass-slbass/2**(fretwherebodymeetsneck/octavedivider)+20.0,-0.4*widthnut,0))
cylmneck4.translate(Base.Vector(slbass-slbass/2**(numberfrets/octavedivider)-20.0,-0.4*widthnut,0))

P1 = P1.cut(cylmneck1)
P1 = P1.cut(cylmneck2)
P1 = P1.cut(cylmneck3)
P1 = P1.cut(cylmneck4)
 
Neck = FreeCAD.ActiveDocument.addObject("Part::Feature","Neck")
Neck.Shape = P1

Fretboard = FreeCAD.ActiveDocument.addObject("Part::Feature","Fretboard")
Fretboard.Shape = P2

###

# Drawing the body

werkelijkeafstand = math.hypot(xend,yverschil)            # de werkelijke afstand van het begin van de hals langs de schuine zijde tot helemaal naar achteren
werkelijkelengthbody = lengthbody*werkelijkeafstand/xend      # de lengte van de lijn waar ik de cirkeldelen op ga berekenen is langer, dit wordt hier berekend

# berekenen vectoren waar de cirkeldelen uitgemaakt worden.

rgroteboog = (werkelijkelengthbody/goldenratio)/2.0
xcentregroteboog = werkelijkelengthbody-rgroteboog

rkleineboog = (werkelijkelengthbody/math.pow(goldenratio,2))/2.0
xcentrekleineboog = rkleineboog

rcutaway = (werkelijkelengthbody/math.pow(goldenratio,3))/2.0
rcutaway2 = (werkelijkelengthbody/math.pow(goldenratio,4))/2.0

d = rgroteboog+rkleineboog   # uitrekenen van snijpunt grote en kleine boog en straal van midden cirkeldeel
xcentremidden = (d**2.0-(rgroteboog+rcutaway)**2.0+(rgroteboog)**2.0)/(2.0*d)
ycentremidden = ((4*d**2.0*(rgroteboog)**2.0-(d**2.0-(rgroteboog+rcutaway)**2.0+(rgroteboog)**2.0)**2)/(4*d**2))**0.5
angle1centremidden = math.atan2(ycentremidden,xcentremidden)
angle2centremidden = math.atan2(ycentremidden,xcentremidden)

d2 = rkleineboog

xVb0 = werkelijkelengthbody
yVb0 = 0

xVb1 = werkelijkelengthbody-rgroteboog
yVb1 = rgroteboog

xVb2 = math.cos(angle2centremidden)*rgroteboog+rgroteboog
yVb2 = math.sin(angle2centremidden)*rgroteboog

xVb3 = rkleineboog + xcentremidden
yVb3 = ycentremidden-rcutaway

xVb4 = rkleineboog + math.cos(angle1centremidden)*rkleineboog
yVb4 = math.sin(angle1centremidden)*rkleineboog

xVb5 = rkleineboog
yVb5 = rkleineboog

xVb6 = rcutaway2
yVb6 = 2*rcutaway2

xVb7 = 2*rcutaway2
yVb7 = rcutaway2

xVb8 = rcutaway2
yVb8 = 0

xVb9 = 0
yVb9 = 0

xVb10 = xbass[len(xbass)-1]+20+lengthbody-xend
yVb10 = 0

xVb = [xVb0,xVb1,xVb2,xVb3,xVb4,xVb5,xVb6,xVb7,xVb8,xVb9,xVb10]
yVb = [yVb0,yVb1,yVb2,yVb3,yVb4,yVb5,yVb6,yVb7,yVb8,yVb9,yVb10]

# Transleren van coördinaten en maken van vectoren

xVbtrans = []
yVbtrans = []
Vpos = []
Vneg = []

for i in range(len(xVb)):
  xtemp = xVb[i]+werkelijkeafstand-werkelijkelengthbody
  print xtemp
  angleofcoord = math.atan2(yVb[i],xtemp)
  rcoord = math.hypot(xtemp,yVb[i])
  xVbtrans.append(math.cos(angleofcoord+angleneck)*rcoord)
  yVbtrans.append(math.sin(angleofcoord+angleneck)*rcoord+widthnut/2.0)
  Vpos.append(Base.Vector(xVbtrans[i],yVbtrans[i],0))
  Vneg.append(Base.Vector(xVbtrans[i],-yVbtrans[i],0))

# Maken van lijnstukken
Apos1 = Part.Arc(Vpos[0],Vpos[1],Vpos[2])
Apos2 = Part.Arc(Vpos[2],Vpos[3],Vpos[4])
Apos3 = Part.Arc(Vpos[4],Vpos[5],Vpos[6])
Apos4 = Part.Arc(Vpos[6],Vpos[7],Vpos[8])
Lpos1 = Part.Line(Vpos[8],Vpos[10])
Lpos2 = Part.Line(Vpos[10],Base.Vector(xVbtrans[10],0))
Lpos3 = Part.Line(Vpos[8],Vpos[9])
Lpos4 = Part.Line(Vpos[9],Base.Vector(xVbtrans[9],0))

Aneg1 = Part.Arc(Vneg[0],Vneg[1],Vneg[2])
Aneg2 = Part.Arc(Vneg[2],Vneg[3],Vneg[4])
Aneg3 = Part.Arc(Vneg[4],Vneg[5],Vneg[9])
Lneg1 = Part.Line(Vneg[8],Vneg[10])
Lneg2 = Part.Line(Vneg[10],Base.Vector(xVbtrans[10],0))
Lneg3 = Part.Line(Vneg[8],Vneg[9])
Lneg4 = Part.Line(Vneg[9],Base.Vector(xVbtrans[9],0))

back = Part.Line(Base.Vector(xend,-yend,0),Base.Vector(xend,yend,0))

# Tekenen van bovenplaat body
Bodybvnplaat = Part.Shape([Apos1,Apos2,Apos3,Apos4,Lpos1,Lpos2,Lneg2,Lneg1,Lneg3,Aneg3,Aneg2,Aneg1,back])
WBodybvnplaat = Part.Wire(Bodybvnplaat.Edges)
FBodybvnplaat = Part.Face(WBodybvnplaat)
PBodybvnplaat = FBodybvnplaat.extrude(Base.Vector(0,0,thicknessbodyplate))

## uitsparing stemmechanieken

xVbtuner1 = slbass + compensation + offsetfrombridge
yVbtuner1 = -0.5*widthbridge

xVbtuner2 = sltreble + offsetnut + compensation + offsetfrombridge
yVbtuner2 = 0.5*widthbridge

xVbtuner3 = xVbtuner2
yVbtuner3 = 0.5*widthbridge + offsettuners

xVbtuner4temp = math.sqrt(totdisttreble**2-(0.5*widthbridge)**2)
xVbtuner4 = xVbtuner2 + xVbtuner4temp
yVbtuner4 = offsettuners

xVbtuner5temp = math.sqrt(totdistbass**2-(0.5*widthbridge)**2)
xVbtuner5 = xVbtuner1 + xVbtuner5temp
yVbtuner5 = 0

xVbtuner6 = xVbtuner5
yVbtuner6 = -offsettuners

xVbtuner7 = xVbtuner1
yVbtuner7 = -0.5*widthbridge-offsettuners

xVbtuner = [xVbtuner1,xVbtuner2,xVbtuner3,xVbtuner4,xVbtuner5,xVbtuner6,xVbtuner7]
yVbtuner = [yVbtuner1,yVbtuner2,yVbtuner3,yVbtuner4,yVbtuner5,yVbtuner6,yVbtuner7]
Vbtuner = []

for i in range(len(xVbtuner)):
  Vbtuner.append(Base.Vector(xVbtuner[i],yVbtuner[i],0))


Lbtuner1 = Part.Line(Vbtuner[0],Vbtuner[1])
Lbtuner2 = Part.Line(Vbtuner[1],Vbtuner[2])
Lbtuner3 = Part.Line(Vbtuner[2],Vbtuner[3])
Lbtuner4 = Part.Line(Vbtuner[3],Vbtuner[4])
Lbtuner5 = Part.Line(Vbtuner[4],Vbtuner[5])
Lbtuner6 = Part.Line(Vbtuner[5],Vbtuner[6])
Lbtuner7 = Part.Line(Vbtuner[6],Vbtuner[0])

Bodybvnplaatcut = Part.Shape([Lbtuner1,Lbtuner2,Lbtuner3,Lbtuner4,Lbtuner5,Lbtuner6,Lbtuner7])
WBodybvnplaatcut = Part.Wire(Bodybvnplaatcut.Edges)
FBodybvnplaatcut = Part.Face(WBodybvnplaatcut)
PBodybvnplaatcut = FBodybvnplaatcut.extrude(Base.Vector(0,0,thicknessbodyplate))

PBodybvnplaat = PBodybvnplaat.cut(PBodybvnplaatcut)

## XLR input cut

rc1 = (yVbtuner4-yVbtuner3)/(xVbtuner4-xVbtuner3)
rc2 = -1/rc1

xVbxlr1 = xVbtuner3 + math.sqrt(offsetxlr**2/(rc2**2+1))
yVbxlr1 = yVbtuner3 + math.sqrt(offsetxlr**2/((1/rc2**2)+1))

xVbxlr2 = xVbxlr1 + math.sqrt(widthxlr**2/(rc2**2+1))
yVbxlr2 = yVbxlr1 + math.sqrt(widthxlr**2/((1/rc2**2)+1))

xVbxlr3 = xVbxlr2 + math.sqrt(lengthxlr**2/(rc1**2+1))
yVbxlr3 = yVbxlr2 - math.sqrt(lengthxlr**2/((1/rc1**2)+1))

xVbxlr4 = xVbxlr1 + math.sqrt(lengthxlr**2/(rc1**2+1))
yVbxlr4 = yVbxlr1 - math.sqrt(lengthxlr**2/((1/rc1**2)+1))

xVbxlr = [xVbxlr1,xVbxlr2,xVbxlr3,xVbxlr4]
yVbxlr = [yVbxlr1,yVbxlr2,yVbxlr3,yVbxlr4]
Vbxlr = []

for i in range(len(xVbxlr)):
  Vbxlr.append(Base.Vector(xVbxlr[i],yVbxlr[i],0))

Lbxlr1 = Part.Line(Vbxlr[0],Vbxlr[1])
Lbxlr2 = Part.Line(Vbxlr[1],Vbxlr[2])
Lbxlr3 = Part.Line(Vbxlr[2],Vbxlr[3])
Lbxlr4 = Part.Line(Vbxlr[3],Vbxlr[0])

Bodybvnplaatxlrcut = Part.Shape([Lbxlr1,Lbxlr2,Lbxlr3,Lbxlr4])
WBodybvnplaatxlrcut = Part.Wire(Bodybvnplaatxlrcut.Edges)
FBodybvnplaatxlrcut = Part.Face(WBodybvnplaatxlrcut)
PBodybvnplaatxlrcut = FBodybvnplaatxlrcut.extrude(Base.Vector(0,0,thicknessbodyplate))

xtrans = -math.sqrt(transxlr**2/(rc1**2+1))
ytrans = math.sqrt(transxlr**2/((1/rc1**2)+1))
PBodybvnplaatxlrcut.translate(Base.Vector(xtrans,ytrans,0))

PBodybvnplaat = PBodybvnplaat.cut(PBodybvnplaatxlrcut)

## Alignment cutout and bolts

cylinderalignment = Part.makeCylinder(0.5*Alignmenthole,2.*thicknessbodyplate)
cylalig1 = cylinderalignment.copy()
cylalig2 = cylinderalignment.copy()
cylalig1.translate(Base.Vector(slbass-slbass/2**(numberfrets/octavedivider)+40.,-0.5*widthnut,-thicknessbodyplate))
cylalig2.translate(Base.Vector(slbass-slbass/2**(numberfrets/octavedivider)+40.,0.5*widthnut,-thicknessbodyplate))

PBodybvnplaat = PBodybvnplaat.cut(cylalig1)
PBodybvnplaat = PBodybvnplaat.cut(cylalig2)

# Maken van onderplaat body
Bodyndrplaat = Part.Shape([Apos1,Apos2,Apos3,Apos4,Lpos3,Lpos4,Lneg4,Aneg3,Aneg2,Aneg1,back])
WBodyndrplaat = Part.Wire(Bodyndrplaat.Edges)
FBodyndrplaat = Part.Face(WBodyndrplaat)
PBodyndrplaat = FBodyndrplaat.extrude(Base.Vector(0,0,-thicknessbodyplate))

PBodyndrplaatxlrcut = PBodybvnplaatxlrcut.copy()
PBodyndrplaatxlrcut.translate(Base.Vector(0,0,-thicknessbodyplate))
PBodyndrplaat = PBodyndrplaat.cut(PBodyndrplaatxlrcut)
PBodyndrplaat = PBodyndrplaat.cut(cylalig1)
PBodyndrplaat = PBodyndrplaat.cut(cylalig2)

cylindermountingbody = Part.makeCylinder(rneckbolts,thicknessbodyplate)
cylmbody1 = cylindermountingbody.copy()
cylmbody2 = cylindermountingbody.copy()
cylmbody3 = cylindermountingbody.copy()
cylmbody4 = cylindermountingbody.copy()
cylmbody1.translate(Base.Vector(slbass-slbass/2**(fretwherebodymeetsneck/octavedivider)+20.,0.4*widthnut,-thicknessbodyplate))
cylmbody2.translate(Base.Vector(slbass-slbass/2**(numberfrets/octavedivider)-20.,0.4*widthnut,-thicknessbodyplate))
cylmbody3.translate(Base.Vector(slbass-slbass/2**(fretwherebodymeetsneck/octavedivider)+20.,-0.4*widthnut,-thicknessbodyplate))
cylmbody4.translate(Base.Vector(slbass-slbass/2**(numberfrets/octavedivider)-20.,-0.4*widthnut,-thicknessbodyplate))
PBodyndrplaat = PBodyndrplaat.cut(cylmbody1)
PBodyndrplaat = PBodyndrplaat.cut(cylmbody2)
PBodyndrplaat = PBodyndrplaat.cut(cylmbody3)
PBodyndrplaat = PBodyndrplaat.cut(cylmbody4)

###

# single string bridge tekenen
doc=App.activeDocument()
grp=doc.addObject("App::DocumentObjectGroup", "SingleStringBridge")

xbridgetreble = sltreble + offsetnut
ybridgetreble = 0.5*widthnut + (widthbridge-widthnut)/2*((sltreble+offsetnut)/slbass)
rcbridge = (-0.5*widthbridge-ybridgetreble)/(slbass-xbridgetreble)
bbridge = ybridgetreble - rcbridge*(xbridgetreble-0)
lyintersect = []
lxintersect = []
Lbridge = []

for i in range(len(diastr)):
  diastrtemp = diastr[0:i+1]
  sdnuttemp = sdnut[0:i+1]
  sdbridgetemp = sdbridge[0:i+1] 
  ynut = -widthnut/2.0 + sdside + sum(diastrtemp) - 0.5*diastr[i] + sum(sdnuttemp)
  ybridge = -widthbridge/2.0 + sdside + sum(diastrtemp) - 0.5*diastr[i] + sum(sdbridgetemp)
  rcstring = (ybridge-ynut)/(slbass-0.)
  xintersect = (ynut - bbridge)/(rcbridge-rcstring)
  yintersect = ynut + rcstring*xintersect
  lyintersect.append(yintersect)
  lxintersect.append(xintersect)
 
  bridge = Part.makeBox(bridgelength-bridgewidth, bridgewidth, thicknessbodyplate)
  bridgecyl1 = Part.makeCylinder(0.5*bridgewidth, thicknessbodyplate)
  bridgecyl2 = Part.makeCylinder(0.5*bridgewidth, thicknessbodyplate)
  bridgecyl3 = Part.makeCylinder(rbridgercylinder, thicknessbodyplate)
  bridgecyl1.translate(Base.Vector(0, 0.5*bridgewidth, 0))
  bridgecyl2.translate(Base.Vector(bridgelength-bridgewidth, 0.5*bridgewidth, 0))
  bridgecyl3.translate(Base.Vector(0.5*(bridgelength-bridgewidth), 0.5*bridgewidth, 0))
  bridge = bridge.fuse(bridgecyl1)
  bridge = bridge.fuse(bridgecyl2)
  bridge = bridge.cut(bridgecyl3)
 
  bridgemountinghole1 = Part.makeBox(10-2.*rbridgercylinder/0.8, 2.*rbridgercylinder/0.8, thicknessbodyplate)
  bridgecyl4 = Part.makeCylinder(rbridgercylinder/0.8,thicknessbodyplate)
  bridgecyl5 = Part.makeCylinder(rbridgercylinder/0.8,thicknessbodyplate)
  bridgecyl4.translate(Base.Vector(0,rbridgercylinder/0.8,0))
  bridgecyl5.translate(Base.Vector((10-2.*rbridgercylinder/0.8),rbridgercylinder/0.8,0))
  bridgemountinghole1 = bridgemountinghole1.fuse(bridgecyl4)
  bridgemountinghole1 = bridgemountinghole1.fuse(bridgecyl5)
  bridgemountinghole2 = bridgemountinghole1.copy()
  bridgemountinghole1.translate(Base.Vector(-0.5*(10-2.*rbridgercylinder/0.8),-rbridgercylinder/0.8,0))
  bridgemountinghole1.translate(Base.Vector(0.5*(bridgelength-bridgewidth)-10,0.5*bridgewidth,0))
  bridgemountinghole2.translate(Base.Vector(-0.5*(10-2.*rbridgercylinder/0.8),-rbridgercylinder/0.8,0))
  bridgemountinghole2.translate(Base.Vector(0.5*(bridgelength-bridgewidth)+10,0.5*bridgewidth,0))
  bridge = bridge.cut(bridgemountinghole1)
  bridge = bridge.cut(bridgemountinghole2)
 
  bridgefcutter = bridge.copy()
  Lbridge.append(bridgefcutter)
 
  bridge.translate(Base.Vector(-0.5*(bridgelength-bridgewidth),-0.5*bridgewidth,0))
  bridge.translate(Base.Vector(xintersect+compensation,yintersect,0))
 
  # displaying the bridge
  SingleStringBridge = FreeCAD.ActiveDocument.addObject("Part::Feature","SingleStringBridge")
  SingleStringBridge.Shape = bridge
  grp.addObject(SingleStringBridge)
 
  # drawing the cut from the bodyplate
  bridgecut = Part.makeBox(bridgelength+10-bridgewidth, bridgewidth, thicknessbodyplate)
  bridgecutcyl1 = Part.makeCylinder(0.5*bridgewidth, thicknessbodyplate)
  bridgecutcyl2 = Part.makeCylinder(0.5*bridgewidth, thicknessbodyplate)
  bridgecutcyl1.translate(Base.Vector(0, 0.5*bridgewidth, 0))
  bridgecutcyl2.translate(Base.Vector(bridgelength+10-bridgewidth, 0.5*bridgewidth, 0))
  bridgecut = bridgecut.fuse(bridgecutcyl1)
  bridgecut = bridgecut.fuse(bridgecutcyl2)
  bridgecut.translate(Base.Vector(-0.5*(bridgelength+10.-bridgewidth),-0.5*bridgewidth,0))
  bridgecut.translate(Base.Vector(xintersect+compensation,yintersect,0))
  PBodybvnplaat = PBodybvnplaat.cut(bridgecut)
 
  # cutting the holes for the SingleStringBridge
  bridgebodymountinghole1 = Part.makeCylinder(rbridgercylinder,thicknessbodyplate)
  bridgebodymountinghole2 = Part.makeCylinder(rbridgercylinder,thicknessbodyplate)
  bridgebodymountinghole1.translate(Base.Vector(xintersect+compensation-10,yintersect,-thicknessbodyplate))
  bridgebodymountinghole2.translate(Base.Vector(xintersect+compensation+10,yintersect,-thicknessbodyplate))
  PBodyndrplaat = PBodyndrplaat.cut(bridgebodymountinghole1)
  PBodyndrplaat = PBodyndrplaat.cut(bridgebodymountinghole2)


###

# drawing tuner mounting pieces and mounting holes

doc=App.activeDocument()
grp=doc.addObject("App::DocumentObjectGroup", "TunerMountingPiece")

tmountingpiecebass = Part.makeBox(tmountingpiecelength,tmountingpiecewidth,thicknessbodyplate)    # these measurements are based on this specific tuners
tmountingpiecebasscyl1 = Part.makeCylinder(rbridgercylinder/0.8,thicknessbodyplate)
tmountingpiecebasscyl2 = tmountingpiecebasscyl1.copy()
tmountingpiecebasscyl1.translate(Base.Vector(3+rbridgercylinder/0.8,0.5*tmountingpiecewidth,0))
tmountingpiecebasscyl2.translate(Base.Vector(tmountingpiecelength-(3+rbridgercylinder/0.8),0.5*tmountingpiecewidth,0))
tmountingpiecebass = tmountingpiecebass.cut(tmountingpiecebasscyl1)
tmountingpiecebass = tmountingpiecebass.cut(tmountingpiecebasscyl2)

tmountingpiecetreble = tmountingpiecebass.copy()

tmountingpiecebasscyl3 = Part.makeCylinder(1, thicknessbodyplate)
tmountingpiecebasscyl3.translate(Base.Vector(tmountingpiecelength-tmountingpieceholefortuner,0,0))
tmountingpiecebass = tmountingpiecebass.cut(tmountingpiecebasscyl3)

tmountingpiecetreblecyl1 = Part.makeCylinder(1, thicknessbodyplate)
tmountingpiecetreblecyl1.translate(Base.Vector(tmountingpiecelength-tmountingpieceholefortuner,tmountingpiecewidth,0))
tmountingpiecetreble = tmountingpiecetreble.cut(tmountingpiecetreblecyl1)

## Drawing the mounting piece of the bassside

tmountingpiecebass1 = tmountingpiecebass.copy()
tmountingpiecebass1.translate(Base.Vector(lxintersect[0]+2.*offsetfrombridge-(tmountingpiecelength-tmountingpieceholefortuner),lyintersect[0]-24, 0))
TunerMountingPiece = FreeCAD.ActiveDocument.addObject("Part::Feature","TunerMountingPiece")
TunerMountingPiece.Shape = tmountingpiecebass1
grp.addObject(TunerMountingPiece)

tmountingpiecebass2 = tmountingpiecebass.copy()
tmountingpiecebass2.translate(Base.Vector(lxintersect[0]+2.*offsetfrombridge-(tmountingpiecelength-tmountingpieceholefortuner)+tmountingpiecelength,lyintersect[1]-24, 0))
TunerMountingPiece = FreeCAD.ActiveDocument.addObject("Part::Feature","TunerMountingPiece")
TunerMountingPiece.Shape = tmountingpiecebass2
grp.addObject(TunerMountingPiece)

tmountingpiecebass3 = tmountingpiecebass.copy()
tmountingpiecebass3.translate(Base.Vector(lxintersect[0]+2.*offsetfrombridge-(tmountingpiecelength-tmountingpieceholefortuner)+2*tmountingpiecelength,lyintersect[2]-24, 0))
TunerMountingPiece = FreeCAD.ActiveDocument.addObject("Part::Feature","TunerMountingPiece")
TunerMountingPiece.Shape = tmountingpiecebass3
grp.addObject(TunerMountingPiece)

## Drawing the mounting piece of the trebleside

tmountingpiecetreble1 = tmountingpiecetreble.copy()
tmountingpiecetreble1.translate(Base.Vector(lxintersect[6]+2.*offsetfrombridge-(tmountingpiecelength-tmountingpieceholefortuner),lyintersect[6]+24-tmountingpiecewidth, 0))
TunerMountingPiece = FreeCAD.ActiveDocument.addObject("Part::Feature","TunerMountingPiece")
TunerMountingPiece.Shape = tmountingpiecetreble1
grp.addObject(TunerMountingPiece)

tmountingpiecetreble2 = tmountingpiecetreble.copy()
tmountingpiecetreble2.translate(Base.Vector(lxintersect[6]+2.*offsetfrombridge-(tmountingpiecelength-tmountingpieceholefortuner)+tmountingpiecelength,lyintersect[5]+24-tmountingpiecewidth, 0))
TunerMountingPiece = FreeCAD.ActiveDocument.addObject("Part::Feature","TunerMountingPiece")
TunerMountingPiece.Shape = tmountingpiecetreble2
grp.addObject(TunerMountingPiece)

tmountingpiecetreble3 = tmountingpiecetreble.copy()
tmountingpiecetreble3.translate(Base.Vector(lxintersect[6]+2.*offsetfrombridge-(tmountingpiecelength-tmountingpieceholefortuner)+2*tmountingpiecelength,lyintersect[4]+24-tmountingpiecewidth, 0))
TunerMountingPiece = FreeCAD.ActiveDocument.addObject("Part::Feature","TunerMountingPiece")
TunerMountingPiece.Shape = tmountingpiecetreble3
grp.addObject(TunerMountingPiece)

tmountingpiecetreble4 = tmountingpiecetreble.copy()
tmountingpiecetreble4.translate(Base.Vector(lxintersect[6]+2.*offsetfrombridge-(tmountingpiecelength-tmountingpieceholefortuner)+3*tmountingpiecelength,lyintersect[3]+24-tmountingpiecewidth, 0))
TunerMountingPiece = FreeCAD.ActiveDocument.addObject("Part::Feature","TunerMountingPiece")
TunerMountingPiece.Shape = tmountingpiecetreble4
grp.addObject(TunerMountingPiece)


## Drawing cut for underplate
cuttmountingpiecebasscyl1 = Part.makeCylinder(rbridgercylinder,thicknessbodyplate)
cuttmountingpiecebasscyl2 = cuttmountingpiecebasscyl1.copy()
cuttmountingpiecebasscyl1.translate(Base.Vector(3+rbridgercylinder/0.8,0.5*tmountingpiecewidth,0))
cuttmountingpiecebasscyl2.translate(Base.Vector(tmountingpiecelength-(3+rbridgercylinder/0.8),0.5*tmountingpiecewidth,0))

cuttmountingpiecebass1cyl1 = cuttmountingpiecebasscyl1.copy()
cuttmountingpiecebass1cyl1.translate(Base.Vector(lxintersect[0]+2.*offsetfrombridge-(tmountingpiecelength-tmountingpieceholefortuner),lyintersect[0]-24, -thicknessneck))
PBodyndrplaat = PBodyndrplaat.cut(cuttmountingpiecebass1cyl1)
cuttmountingpiecebass1cyl2 = cuttmountingpiecebasscyl2.copy()
cuttmountingpiecebass1cyl2.translate(Base.Vector(lxintersect[0]+2.*offsetfrombridge-(tmountingpiecelength-tmountingpieceholefortuner),lyintersect[0]-24, -thicknessneck))
PBodyndrplaat = PBodyndrplaat.cut(cuttmountingpiecebass1cyl2)

cuttmountingpiecebass2cyl1 = cuttmountingpiecebasscyl1.copy()
cuttmountingpiecebass2cyl1.translate(Base.Vector(lxintersect[0]+2.*offsetfrombridge-(tmountingpiecelength-tmountingpieceholefortuner)+tmountingpiecelength,lyintersect[1]-24, -thicknessneck))
PBodyndrplaat = PBodyndrplaat.cut(cuttmountingpiecebass2cyl1)
cuttmountingpiecebass2cyl2 = cuttmountingpiecebasscyl2.copy()
cuttmountingpiecebass2cyl2.translate(Base.Vector(lxintersect[0]+2.*offsetfrombridge-(tmountingpiecelength-tmountingpieceholefortuner)+tmountingpiecelength,lyintersect[1]-24, -thicknessneck))
PBodyndrplaat = PBodyndrplaat.cut(cuttmountingpiecebass2cyl2)

cuttmountingpiecebass3cyl1 = cuttmountingpiecebasscyl1.copy()
cuttmountingpiecebass3cyl1.translate(Base.Vector(lxintersect[0]+2.*offsetfrombridge-(tmountingpiecelength-tmountingpieceholefortuner)+2*tmountingpiecelength,lyintersect[2]-24, -thicknessneck))
PBodyndrplaat = PBodyndrplaat.cut(cuttmountingpiecebass3cyl1)
cuttmountingpiecebass3cyl2 = cuttmountingpiecebasscyl2.copy()
cuttmountingpiecebass3cyl2.translate(Base.Vector(lxintersect[0]+2.*offsetfrombridge-(tmountingpiecelength-tmountingpieceholefortuner)+2*tmountingpiecelength,lyintersect[2]-24, -thicknessneck))
PBodyndrplaat = PBodyndrplaat.cut(cuttmountingpiecebass3cyl2)

cuttmountingpiecetreble1cyl1 = cuttmountingpiecebasscyl1.copy()
cuttmountingpiecetreble1cyl1.translate(Base.Vector(lxintersect[6]+2.*offsetfrombridge-(tmountingpiecelength-tmountingpieceholefortuner),lyintersect[6]+24-tmountingpiecewidth, -thicknessbodyplate))
PBodyndrplaat = PBodyndrplaat.cut(cuttmountingpiecetreble1cyl1)
cuttmountingpiecetreble1cyl2 = cuttmountingpiecebasscyl2.copy()
cuttmountingpiecetreble1cyl2.translate(Base.Vector(lxintersect[6]+2.*offsetfrombridge-(tmountingpiecelength-tmountingpieceholefortuner),lyintersect[6]+24-tmountingpiecewidth, -thicknessbodyplate))
PBodyndrplaat = PBodyndrplaat.cut(cuttmountingpiecetreble1cyl2)

cuttmountingpiecetreble2cyl1 = cuttmountingpiecebasscyl1.copy()
cuttmountingpiecetreble2cyl1.translate(Base.Vector(lxintersect[6]+2.*offsetfrombridge-(tmountingpiecelength-tmountingpieceholefortuner)+tmountingpiecelength,lyintersect[5]+24-tmountingpiecewidth, -thicknessbodyplate))
PBodyndrplaat = PBodyndrplaat.cut(cuttmountingpiecetreble2cyl1)
cuttmountingpiecetreble2cyl2 = cuttmountingpiecebasscyl2.copy()
cuttmountingpiecetreble2cyl2.translate(Base.Vector(lxintersect[6]+2.*offsetfrombridge-(tmountingpiecelength-tmountingpieceholefortuner)+tmountingpiecelength,lyintersect[5]+24-tmountingpiecewidth, -thicknessbodyplate))
PBodyndrplaat = PBodyndrplaat.cut(cuttmountingpiecetreble2cyl2)

cuttmountingpiecetreble3cyl1 = cuttmountingpiecebasscyl1.copy()
cuttmountingpiecetreble3cyl1.translate(Base.Vector(lxintersect[6]+2.*offsetfrombridge-(tmountingpiecelength-tmountingpieceholefortuner)+2.*tmountingpiecelength,lyintersect[4]+24-tmountingpiecewidth, -thicknessbodyplate))
PBodyndrplaat = PBodyndrplaat.cut(cuttmountingpiecetreble3cyl1)
cuttmountingpiecetreble3cyl2 = cuttmountingpiecebasscyl2.copy()
cuttmountingpiecetreble3cyl2.translate(Base.Vector(lxintersect[6]+2.*offsetfrombridge-(tmountingpiecelength-tmountingpieceholefortuner)+2.*tmountingpiecelength,lyintersect[4]+24-tmountingpiecewidth, -thicknessbodyplate))
PBodyndrplaat = PBodyndrplaat.cut(cuttmountingpiecetreble3cyl2)

cuttmountingpiecetreble4cyl1 = cuttmountingpiecebasscyl1.copy()
cuttmountingpiecetreble4cyl1.translate(Base.Vector(lxintersect[6]+2.*offsetfrombridge-(tmountingpiecelength-tmountingpieceholefortuner)+3.*tmountingpiecelength,lyintersect[3]+24-tmountingpiecewidth, -thicknessbodyplate))
PBodyndrplaat = PBodyndrplaat.cut(cuttmountingpiecetreble4cyl1)
cuttmountingpiecetreble4cyl2 = cuttmountingpiecebasscyl2.copy()
cuttmountingpiecetreble4cyl2.translate(Base.Vector(lxintersect[6]+2.*offsetfrombridge-(tmountingpiecelength-tmountingpieceholefortuner)+3.*tmountingpiecelength,lyintersect[3]+24-tmountingpiecewidth, -thicknessbodyplate))
PBodyndrplaat = PBodyndrplaat.cut(cuttmountingpiecetreble4cyl2)

###

# Drawing nut extension
endpieceV1 = Base.Vector(-xoffset,-yoffset,thfretboard)
endpieceV2 = Base.Vector(-xoffset,-yoffset,0)
endpieceV3 = Base.Vector(-xoffset,-yoffset+thicknessneck-thicknessneck/2**0.5,-thicknessneck/2**0.5)
endpieceV4 = Base.Vector(-xoffset,-yoffset+thicknessneck,-thicknessneck)
endpieceV5 = Base.Vector(-xoffset,yoffset-thicknessneck,-thicknessneck)
endpieceV6 = Base.Vector(-xoffset,yoffset-thicknessneck+thicknessneck/2**0.5,-thicknessneck/2**0.5)
endpieceV7 = Base.Vector(-xoffset,yoffset,0)
endpieceV8 = Base.Vector(-xoffset,yoffset,thfretboard)

endpieceL1 = Part.Line(endpieceV1,endpieceV2)
endpieceA1 = Part.Arc(endpieceV2,endpieceV3,endpieceV4)
endpieceL2 = Part.Line(endpieceV4,endpieceV5)
endpieceA2 = Part.Arc(endpieceV5,endpieceV6,endpieceV7)
endpieceL3 = Part.Line(endpieceV7,endpieceV8)
endpieceL4 = Part.Line(endpieceV8,endpieceV1)

endpiece = Part.Shape([endpieceL1,endpieceA1,endpieceL2,endpieceA2,endpieceL3,endpieceL4])
Wendpiece = Part.Wire(endpiece.Edges)
Fendpiece = Part.Face(Wendpiece)
Pendpiece = Fendpiece.extrude(Base.Vector(-thendpiece,0,0))
Pendpiece.translate(Base.Vector(0,0,thicknessneck))

## Drawing string holes
for i in range(len(diastr)):   
  diastrtemp = diastr[0:i+1]
  sdoffsettemp = sdoffset[0:i+1]
  rholetemp =diastr[i]/2.+0.8
  holetemp = Part.makeCylinder(rholetemp,thendpiece)
  holetemp.rotate((0,0,0),(0,1,0),90)
  holetemp.translate(Base.Vector(-xoffset-thendpiece,-yoffset+sdside+sum(diastrtemp)+sum(sdoffsettemp)-0.5*diastr[i],thicknessneck+rholetemp))
  Pendpiece = Pendpiece.cut(holetemp)

## Drawing holes for mounting endpiece and trussrods
###
rtrussrodhole = 3.5
holetemp = Part.makeCylinder(rtrussrodhole,thendpiece)
holetemp.rotate((0,0,0),(0,1,0),90)
holetemp1 = holetemp.copy()
holetemp.translate(Base.Vector(-xoffset-thendpiece,-yoffset+diffbetweentrussrods+rtrussrodhole,thicknessneck-rtrussrodhole-2.))
holetemp1.translate(Base.Vector(-xoffset-thendpiece,yoffset-diffbetweentrussrods-rtrussrodhole,thicknessneck-rtrussrodhole-2.))
Pendpiece = Pendpiece.cut(holetemp)
Pendpiece = Pendpiece.cut(holetemp1)
holetemp =  Part.makeCylinder(2,thendpiece)
holetemp.rotate((0,0,0),(0,1,0),90)
holetemp.translate(Base.Vector(-xoffset-thendpiece,0,0.5*thicknessneck))
Pendpiece = Pendpiece.cut(holetemp)

## Drawing XLR plates

Pxlrplate = Part.makeBox(lengthxlr+20,widthxlr+20,widthfret)
Pxlrplate = Pxlrplate.makeFillet(0.4,Pxlrplate.Edges)

rxlrmountinghole = 2
xlrmountinghole1 = Part.makeCylinder(rxlrmountinghole,widthfret)
xlrmountinghole2 = xlrmountinghole1.copy()
xlrmountinghole3 = xlrmountinghole1.copy()
xlrmountinghole4 = xlrmountinghole1.copy()
xlrmountinghole1.translate(Base.Vector(5,5,0))
xlrmountinghole2.translate(Base.Vector(5,widthxlr+20-5,0))
xlrmountinghole3.translate(Base.Vector(lengthxlr+20-5,widthxlr+20-5,0))
xlrmountinghole4.translate(Base.Vector(lengthxlr+20-5,5,0))
Pxlrplate = Pxlrplate.cut(xlrmountinghole1)
Pxlrplate = Pxlrplate.cut(xlrmountinghole2)
Pxlrplate = Pxlrplate.cut(xlrmountinghole3)
Pxlrplate = Pxlrplate.cut(xlrmountinghole4)

Pxlrplate1 = Pxlrplate.copy()

rxlrinput = 10
nrrowxlr = 2
nrcolumnxlr = 4
difrowxlr = (widthxlr-nrrowxlr*2*rxlrinput)/(nrrowxlr+1)
difcolumnxlr = (lengthxlr-nrcolumnxlr*2*rxlrinput)/(nrcolumnxlr+1)
cutxlrplate = Part.makeCylinder(rxlrinput,widthfret)
cutxlrcyl1 = Part.makeCylinder(2,widthfret)
cutxlrcyl2 = cutxlrcyl1.copy()
cutxlrcyl1.translate(Base.Vector(0,-13,0))
cutxlrcyl2.translate(Base.Vector(0,13,0))
cutxlrplate = cutxlrplate.fuse(cutxlrcyl1)
cutxlrplate = cutxlrplate.fuse(cutxlrcyl2)

cutxlrplate.translate(Base.Vector(10+difcolumnxlr+rxlrinput,10+difrowxlr+rxlrinput,0))
Pxlrplate= Pxlrplate.cut(cutxlrplate)

cutxlrplate.translate(Base.Vector(difcolumnxlr+2*rxlrinput,0,0))
Pxlrplate= Pxlrplate.cut(cutxlrplate)

cutxlrplate.translate(Base.Vector(difcolumnxlr+2*rxlrinput,0,0))
Pxlrplate= Pxlrplate.cut(cutxlrplate)

cutxlrplate.translate(Base.Vector(difcolumnxlr+2*rxlrinput,0,0))
Pxlrplate= Pxlrplate.cut(cutxlrplate)

cutxlrplate.translate(Base.Vector(0,difrowxlr+2*rxlrinput,0))
Pxlrplate= Pxlrplate.cut(cutxlrplate)

cutxlrplate.translate(Base.Vector(-(difcolumnxlr+2*rxlrinput),0,0))
Pxlrplate= Pxlrplate.cut(cutxlrplate)

cutxlrplate.translate(Base.Vector(-(difcolumnxlr+2*rxlrinput),0,0))
Pxlrplate= Pxlrplate.cut(cutxlrplate)

cutxlrplate.translate(Base.Vector(-(difcolumnxlr+2*rxlrinput),0,0))
Pxlrplate= Pxlrplate.cut(cutxlrplate)

Pxlrplate.translate(Base.Vector(0,-200,0))

xlrplate = FreeCAD.ActiveDocument.addObject("Part::Feature","xlrplate")
xlrplate.Shape = Pxlrplate

Pxlrplate1.translate(Base.Vector(lengthxlr+20+10,-200,0))

xlrplate1 = FreeCAD.ActiveDocument.addObject("Part::Feature","xlrplate1")
xlrplate1.Shape = Pxlrplate1

# Drawing of body, neck and endpiece:
 
Bodyupperplate = FreeCAD.ActiveDocument.addObject("Part::Feature","Body - Upper plate")
Bodyupperplate.Shape = PBodybvnplaat

Bodyunderplate = FreeCAD.ActiveDocument.addObject("Part::Feature","Body under plate")
Bodyunderplate.Shape = PBodyndrplaat

Endpiece = FreeCAD.ActiveDocument.addObject("Part::Feature","Endpiece")
Endpiece.Shape = Pendpiece

### Frets on a row
doc=App.activeDocument()
grp=doc.addObject("App::DocumentObjectGroup", "Frets for cutter")

if typefretboard == 0:
    Fretdisplay = Pfret[0]
    Fretdisplay.rotate((0,0,0),(0,0,1),90)
    Fretdisplay.rotate((0,0,0),(0,1,0),-90)
    Fretdisplay.translate(Base.Vector(0*(thfretboard+heightfret+3),100,0))
    Fretnr = "Fret0"
    Fretfcutter = FreeCAD.ActiveDocument.addObject("Part::Feature",Fretnr)
    Fretfcutter.Shape = Fretdisplay
    grp.addObject(Fretfcutter)
else:
  for i in range(0,len(Pfret)+1):
    Fretdisplay = Pfret[i]
    Fretdisplay.rotate((0,0,0),(0,0,1),90)
    Fretdisplay.rotate((0,0,0),(0,1,0),-90)
    Fretdisplay.translate(Base.Vector(i*(thfretboard+heightfret+3),100,0))
    Fretnr = "Fret"+str(i)
    Fretfcutter = FreeCAD.ActiveDocument.addObject("Part::Feature",Fretnr)
    Fretfcutter.Shape = Fretdisplay
    grp.addObject(Fretfcutter)

### jig for router
PJigrouter = Part.makeBox(800,120,thicknessneck)
PJigrouter.translate(Base.Vector(-100,-60,0))
PJigrouter = PJigrouter.cut(Pcutjigrouter)
PJigrouter.translate(Base.Vector(0,-300,0))
Jigrouter = FreeCAD.ActiveDocument.addObject("Part::Feature","Jigrouter")
Jigrouter.Shape = PJigrouter

### TunerMountingPiece + SingleStringBridge

for i in range(0,len(diastr)+1):
  Ptmountingpiecetreblefcutter = tmountingpiecetreble.copy()
  Ptmountingpiecetreblefcutter.translate(Base.Vector(i*(tmountingpiecelength+5.),250,0))
  tmountingpiecefcutter = FreeCAD.ActiveDocument.addObject("Part::Feature","TunerMountingPiece")
  tmountingpiecefcutter.Shape = Ptmountingpiecetreblefcutter
  Pbridgefcutter = Lbridge[0].copy()
  Pbridgefcutter.translate(Base.Vector(i*(bridgelength+5.),300,0))
  bridgefcutter = FreeCAD.ActiveDocument.addObject("Part::Feature","SingleStringBridge")
  bridgefcutter.Shape = Pbridgefcutter

Gui.SendMsgToActiveView("ViewFit")

###
User avatar
Hans Bezemer
 
Posts: 372
Joined: Sat May 26, 2012 1:01 am
Location: The Netherlands

Re: Quintar by Hans Bezemer

Postby Hans Bezemer » Mon Jun 09, 2014 11:33 am

I've been nesting the parts.
This week I will do a software dry run. I will load the drawings in the cutter software and it will check if there are errors or ambiguities in the drawing.
Stainless steel plates.jpeg
Birch plate 1.jpeg
Birch plate 1.jpeg (16.38 KiB) Viewed 7863 times
Birch plate 2.jpeg
User avatar
Hans Bezemer
 
Posts: 372
Joined: Sat May 26, 2012 1:01 am
Location: The Netherlands

Re: Quintar by Hans Bezemer

Postby Hans Bezemer » Mon Jun 16, 2014 11:09 am

I've checked my drawings and made a dry run with one drawing, I've made a simple video of the process (the cutting starts at :40).
User avatar
Hans Bezemer
 
Posts: 372
Joined: Sat May 26, 2012 1:01 am
Location: The Netherlands

Re: Quintar by Hans Bezemer

Postby Hans Bezemer » Sat Jul 05, 2014 5:08 am

Time for an update.

I've been to the waterjetcutter twice now and most of the parts are now cut.
I've made a short clip of the cutter in action.

I've come to the point that the actual building starts, a good moment to evaluate the process so far.

Making the script and 3D drawings


As mentioned before I created my drawings by using a script. Making this script was a rather time consuming, typical trail and error process, where I had to learn to understand how the CAD-program works, learning the syntax of the programming language and dusting of my mathematical skills. I think it took about 100 hours to get the script at the point where it stands now.
Was it worth the effort?
Yes.
Because I have to tell the CAD-program where to draw what, I've learned a lot of the (history of the) geometry of a stringed instrument.
Second, the script -although still under development- makes it easy to draw new prototypes when needed, without starting from the ground up.
Third, I had time to fine tune my ideas and concepts before creating sawdust.

Offcourse there are a lot of things I would like to do better / different:
First, my script is a complete joke when it comes to programming etiquettes, so there is a lot to gain
Second, I would like to refine my body design, especially the bridge-end of the body is flat and it would be nicer if this would be a ellipse shape.

The use of the watercutter

In theory, one of the big advantages is that the cutter can cut out complex parts. This saves a lot of time.
In practice this didn't really turned out this way. We encountered a lot of trouble with the cutter's software, which freezed up every now and then, without any error message, so we couldn't do anything but to restart the process. Although it was easy to get to the point where the cutter stopped, rebooting the computer and setting up the software was time consuming.
Also the software may have a bug, several times the cutter did something different then in the dry run (cutting out parts, which needed to stay attached, or vice versa).
Another issue is that small parts can't be cut loose because they will fall in the water, so they are "undercut" which means that are cut out till 1 mm is left. This makes it necessary to file of sand the parts.
Because of the issues with the software, the plywood made longer contact with the water then expected, this resulted in some cracks between layers, which need some reglueing.
Last, the cutter uses sand as an abrasive, which clutters a little bit in the pores of the wood. This was solved by attaching a small waterhose besides the cuttershead.

Again, was it worth the efford?
With the software issues resolved and using waterresistance plywood for the next time, I think yes when making one of prototypes or making templates for a series of guitar.

Building!
Finally I'm ready to start building / assembling the Quintar.
I will build one at a time. My pace will be slow, but steady. I don't intend to make it before the deadline but I don't mind, this challenge have been a good kickstarter.

A first mock up of what I have so far. Although I don't care much for soccer, the 3D-printed magnetholder is a nice link to Dutch team. ;)
Quick mock up.JPG
User avatar
Hans Bezemer
 
Posts: 372
Joined: Sat May 26, 2012 1:01 am
Location: The Netherlands

Re: Quintar by Hans Bezemer

Postby Andrew Berry » Fri Sep 05, 2014 1:26 pm

How is this going, Hans? I came to the guitar from mandolin and fifths make much more sense to me. I usually wind up trying to get all my guitars tuned into fifths eventually. I'm in the planning phase for a multi-scale electric quintar now, though no where near as elaborate as what you are doing. So, any updates would be welcome.
Andrew Berry
 
Posts: 13
Joined: Tue Feb 26, 2013 5:39 pm

Re: Quintar by Hans Bezemer

Postby Hans Bezemer » Sat Sep 06, 2014 12:39 am

Andrew,
Great to hear that you're planning to build a quintar.
I'm really interested in your thoughts on your electric quintar!
How many strings? How do you want to tune them (besides the fifth intervals)?
Stringlengths? Electronics? et cetera.

I've been out camping with my family for a couple of weeks, but this week I've started building again. I have just a couple of hours a week to build, but I will post some pictures when I have a part ready.
I've been playing a lot on my other prototype though and I really love the fifths tuning.
As for my futher plans, I want finish the quintars I'm working on now, and then focus a bit more on playing / making (Youtube) tutorials about playing a quintar. But this will be a slow (but steady!) process.
User avatar
Hans Bezemer
 
Posts: 372
Joined: Sat May 26, 2012 1:01 am
Location: The Netherlands

Re: Quintar by Hans Bezemer

Postby Andrew Berry » Sun Sep 07, 2014 10:52 am

Well, I was planning on a 6 string starting on the C below the guitar's E and heading up to a high B. That essentially covers the entire range of the mandolin family--from a mandocello on the lowest four strings all the way to a mandolin on the highest four starting at the 5th fret--so that tuning has some appeal to me. I currently have an old Fender Mustang (short scale: 23 3/4") in fifths. The low C is rubbish, of course, but that scale is pretty much perfect for the high B, allowing me to use an off-the-shelf string (I think it's an 8, but maybe a 7) instead of having to have one made. I also have an old acoustic (25 1/2" scale) tuned in 5ths where I've just doubled the high string (CGDAEE). The C is better but still not quite long enough to get the sound I'm after and it's still really touchy on tuning so I have to be really careful when fretting down low.

So that's really my starting point: I'm planning to aim for an instrument with scales from 23 3/4" to 26 3/4". It might sound better with a longer C string, but I'm not sure I can make that stretch, especially since there's already so much stretch involved in playing 5ths-tuned instruments anyway.

Electronics are my weak point. I've just never spent much time playing through amps. I was thinking about something like the Lace humbuckers so I don't have to worry about matching poles to strings and because they seem designed to handle the low end without it getting muddy but that's about as far as I've gotten. I'm trying to get up to speed on them but any help there would be appreciated.
Andrew Berry
 
Posts: 13
Joined: Tue Feb 26, 2013 5:39 pm

Re: Quintar by Hans Bezemer

Postby Hans Bezemer » Mon Sep 08, 2014 3:13 pm

Andrew,

Sounds like a great plan, I would really like to see you make one!
It's good to hear that you can tune your high b.
I've started with this tuning also, inspired by someone one youtube who tuned his guitar this way.
I had a hard time trying to get the b string up to tune. A lot of strings broke or the ball turned loose. When up to pitch I did not dare to bend it a little more then to get some vibrato. I finally settled with a f# and with 25 frets that gives me a high g, a minor third above the high e of a regular 24 fret guitar. I use a 0.010 with 26" stringlength and everything is fine. I even tried a 0.014 for a future fretless build and even this worked.

In theory a string tuned a perfect fifth down has to have a diameter of 3/2 of the first string to get the same tension.
For other my stringgauges I use the goldenratio (1,618) as a rule of thumb and it works for me. The strings will get "fatter" when going down, but the higher tension on the lower string gives me a more balanced feel. In general the tension on a regular bass string is almost twice the tension on a guitar string.

I don't know much about common pickups either, I've strayed off the beaten track with my single loop pickup (see my other prototype) and the strings-as-pickup-concept.
I hardly play on a regular guitar amp anymore (although it is possible). I use my laptop and a external soundcard for my soundprocessing. I have a tube poweramp if there is no backline, else I just use the p.a. system.
With a single loop pickup you get a signal on microphone level, which can be converted to line level using a transformer (which can be bought of the shelf for about 20 dollars), or you can use a mic preamp.
I've did a studiorecording with my other prototype using a mic preamp and it sounded fine.

I have a span of 4" between my two stringlengths and for me it works fine, I think the fanned frets give little ergonomic advantage, because my lefthand tends to turn counterclockwise when playing on my low positions and clockwise when playing in higher positions.
Last edited by Hans Bezemer on Mon Sep 08, 2014 3:26 pm, edited 1 time in total.
User avatar
Hans Bezemer
 
Posts: 372
Joined: Sat May 26, 2012 1:01 am
Location: The Netherlands

Re: Quintar by Hans Bezemer

Postby Hans Bezemer » Mon Sep 08, 2014 3:22 pm

I've glued up the body and drilled the holes for the wires.
I placed magnets in the holder. I also mounted the connectors on the plate. And finally made a quick mock up.
Mock up.JPG

I also potted the current transformers, with my state-of-the-art potting equipment. ;)
Potting the current transformer.JPG
Potting the current transformer.JPG (132.43 KiB) Viewed 7206 times


I hope to solder them to the xlr-connectors the next time. I presoldered the wires (pardon the blurry picture).
Leads from strings.JPG


I'm still waiting for the last piece of wood to be cut on the waterjetcutter. Hopefully it will be ready soon, because then I can start on the neck.
User avatar
Hans Bezemer
 
Posts: 372
Joined: Sat May 26, 2012 1:01 am
Location: The Netherlands

Re: Quintar by Hans Bezemer

Postby Andrew Berry » Mon Sep 08, 2014 4:54 pm

I had a hard time trying to get the b string up to tune. A lot of strings broke or the ball turned loose. When up to pitch I did not dare to bend it a little more then to get some vibrato.


You do have to take it up slowly and give the steel a little time to relax before you push it more. I broke a few strings myself until I figured this out. My current B string has been on the guitar for a couple of years now. But what was the scale that you tried? Normal guitar scales will not work for a B without a special alloy string (and it's not cheap). I do know where to order them, though, if you'd like the information.

In theory a string tuned a perfect fifth down has to have a diameter of 3/2 of the first string to get the same tension. For other my string gauges I use the goldenratio (1,618) as a rule of thumb and it works for me. The strings will get "fatter" when going down, but the higher tension on the lower string gives me a more balanced feel. In general the tension on a regular bass string is almost twice the tension on a guitar string.


This is good information. I've been trying to work out a way to figure the gauges without resorting to trial and error. Thanks.

I have a span of 4" between my two stringlengths and for me it works fine


This is at the bridge?
Andrew Berry
 
Posts: 13
Joined: Tue Feb 26, 2013 5:39 pm

Next

Return to The "Try Something New" Challenge (Closed)

Who is online

Users browsing this forum: No registered users and 0 guests

Your purchase from these sites helps support the MIMForum, but only if you start at the links below!!!
Amazon music     Amazon books     Amazon tools     Rockler tools     Office Depot    

The MIMF is a member-supported forum, please consider supporting us with a donation, thanks!
 • Book store • Tool store • Links •