<< Click to Display Table of Contents >> 3d_guitar |
{ 3D_GUITAR.PDE
This example shows the construction of a guitar by layered extrusion.
It only constructs a domain. There are no variables or equations.
It does demonstrate the use of the MATERIALS section.
}
TITLE "3D Guitar Body"
COORDINATES cartesian3
MATERIALS
"Default" : d = 1.0 k = 1.0
"Air" : d = 100 k = 0.07
"Maple" : d = 0.9 k = 7
"Spruce" : d = 0.7 k = 13
"Plastic" : d = 10 k = 0.22
"Composite" : d = 3 k = 1.3
DEFINITIONS
{------------- SIZE POSITION PARAMETERS -------------}
dface = 0.3, dback = 0.5, dbody = 10 ! some basic depths
dside = 0.7, dsaddle = 0.4, dnut = 0.8 ! some basic depths
slen = 11, swid = 3, spos = 19 ! saddle size and positions
fpos = 50, fwid = 10, flen = 5 ! fretboard size and positions
orad = 6, opos = 36 ! sound hole radius and position
hrad = 0.7 ! string radius
h6 = 5, h5 = 3, h4 = 1, h1 = -h6, h2 = -h5, h3 = -h4 ! saddle hole radius and positions
{------------- SPLINE POINTS -------------}
x0 = 0, x1 = 0, x2 = 18, x3 = 30, x4 = 40, x5 = 46, x6 = 60, x7 = 60
y0 = 0, y1 = 1, y2 = 19, y3 = 15, y4 = 12, y5 = 14, y6 = 2, y7 = 0
{------------- LAYER DEPTHS -------------}
origin = 0
inback = origin + dback
inface = inback + dbody
outface = inface + dface
outtool = outface + dsaddle
EXTRUSION
surface 'OUTSIDE BOTTOM' z = origin
layer 'BOTTOM'
surface 'INSIDE BOTTOM' z = inback
layer 'BODY'
surface 'INSIDE TOP' z = inface
layer 'TOP'
surface 'OUTSIDE TOP' z = outface
layer 'TOOL'
surface 'OUTSIDE TOOL' z = outtool
BOUNDARIES
{------------- OUTTER BODY -------------}
limited region 'OUTER BODY'
layer 'TOOL' VOID
layer 'BOTTOM' use material "Maple"
layer 'BODY' use material "Composite"
layer 'TOP' use material "Spruce"
start (x1,y0)
spline to (x1, y1) to (x2, y2) ! NW arc
to (x3, y3) to (x4, y4) !N arc
to (x5, y5) to (x6, y6) ! NE arc
!to (x6, y6) to (x6+flen, y6) !top of fretboard
to (x6, y7) ! top of neck
!to (x6+flen,-y6) to (x6,-y6) !bott of fretboard
to (x6, -y6) to (x5, -y5) ! SE arc
to (x4, -y4) to (x3, -y3) ! S arc
to (x2, -y2) to (x1, -y1) ! SW arc
to close
{------------- INNER BODY -------------}
limited region "INNER BODY"
layer 'BODY' VOID
!use material "Air"
start (x1+dside,y0)
spline to (x1+dside, y1) to (x2, y2-dside) ! NW
to (x3, y3-dside) to (x4, y4-dside) !N
to (x5, y5-dside) to (x6-dside, y6) ! NE
to (x6-dside, y7) ! top of neck
to (x6-dside, -y6) to (x5, dside-y5) ! SE
to (x4, dside-y4) to (x3, dside-y3) ! S
to (x2, dside-y2) to (x1+dside, -y1) ! SW
to close
{------------- SOUND HOLE -------------}
limited region "SOUND HOLE"
layer 'TOP' VOID
!use material "Air"
start (opos, orad)
arc (center = opos, 0) angle=360
{------------- SADDLE BASE-------------}
limited region "Saddle Base"
layer 'TOOL'
use material "Plastic"
start (spos+swid/2, slen/2)
arc (center = spos, slen/2) angle=180
line to (spos-swid/2, -slen/2)
arc (center = spos, -slen/2) angle=180
line to close
{------------- SADDLE HOLES-------------}
limited region "Saddle Holes"
layer 'TOOL' VOID
layer 'TOP'
start (spos, h1-hrad) arc (center = spos, h1) angle=360
start (spos, h2-hrad) arc (center = spos, h2) angle=360
start (spos, h3-hrad) arc (center = spos, h3) angle=360
start (spos, h4-hrad) arc (center = spos, h4) angle=360
start (spos, h5-hrad) arc (center = spos, h5) angle=360
start (spos, h6-hrad) arc (center = spos, h6) angle=360
{------------- FRETBOARD -------------}
limited region "Fret Board"
layer 'TOOL'
start (fpos, fwid/2)
line to (fpos, -fwid/2) fillet 1
line to (fpos+8, -fwid/2) fillet 1
line to (fpos+8, fwid/2) fillet 1
line to close fillet 1
PLOTS
grid(x,y,z) paintmaterials
glgrid(x,y,z) paintmaterials
glgrid(x,y,z) on layer 'body'
glgrid(x,y,z) on layer 'tool' on region 'saddle base'
END