Golf Lathe Machine

You probably know what a Turing Machine is but do you know what is a Turning Machine (lathe)? Ok you already know.. and what about a Golf Turning Machine ??

Ok I tell you..

A Golf Turning Machine is a full program or function taking a list/array (or any convenient method) representing the Profile (P) of a turned piece and producing an ascii turned shape.

An ascii turned shape has square rotated by 45° cutting section instead of a circle so that we only need '/' and '\' characters to draw it. And it has '_' characters for the profiles: upper, lower and median.(like the one of this challenge : ASCII TURNED SHAPE ) for simple and nice drawing purpose.

_________
/\        \
/  \________\
\  /        /
\/________/

A Profile P is a container of positive integers values in the range 0 <= value < 26(minimum)
- Every value represents the radius of a 1 long character section, so the length of the container is the length of the piece obtained.
- Alphabet are also valid [a to z] or [A to Z] they must correspond to a [0 to 25] value.

• 0 values at the beginning and at the end of the profile input can not be considered.

Test cases:

[2,2,2,2,2,4,4,4,4,4,6,6,6,6,6,4,4,4,4,4,2,2,2,2,2] or
"CCCCCEEEEEGGGGGEEEEECCCCC" or
['c','c','c','c','e',.....]
_____
/\    \
___/_ \    \__
/\    \ \    \ \
___/_ \    \ \    \ \__
/\    \ \    \ \    \ \ \
/  \____\ \____\ \____\_\_\
\  /    / /    / /    / / /
\/____/ /    / /    / /_/
\  /    / /    / /
\/____/ /    /_/
\  /    /
\/____/

.

[1,0,0,0,0,0,0,3,3,0,0,1] or
[0,0,0,0,0,1,0,0,0,0,0,0,3,3,1,1,1,0,0,0]
__
/\ \
_    /  \ \_
/\\  /    \_\\
\//  \    / //
\  / /
\/_/

.

[2,1,1,1,1,10,10,8,8,8,8,8,8,10,10,1,1,1,1,2]

__      __
/\ \    /\ \
/  \ \__/_ \ \
/    \ \   \ \ \
/      \ \   \ \ \
/        \ \   \ \ \
/          \ \   \ \ \
/            \ \   \ \ \
/  _           \ \   \ \ \
/  /\\___        \ \   \ \ \
/  /  \\__\        \_\___\ \_\
\  \  //__/        / /   / / /
\  \//           / /   / / /
\              / /   / / /
\            / /   / / /
\          / /   / / /
\        / /   / / /
\      / /   / / /
\    / /___/ / /
\  / /  \  / /
\/_/    \/_/

Rules :
- Margins are not specified.
- Standard loopholes are forbidden.
- Standard input/output methods.
- Shortest answer in bytes wins.

• Can we choose the number of trailing and leading zeroes? (inferring from test case 2) If so, we can require a amount of zeroes that happens to be the output converted from ASCII to unary. Nov 4 '19 at 5:08
• @someone if you refer to the input nope Nov 4 '19 at 6:49

JavaScript (ES6),  259 249  246 bytes

Takes input as an array of integers. Returns a matrix of characters.

a=>{for(m=[],i=a.length,X=i+25;i--;r[X]>' '|!w?0:r[X]='_',X--)for(y=w=a[i];y>=-w;y--)for(r=m[Y=y+25]=m[Y]||Array(X).fill ,W=w+(y>0?1-y:y),k=2;k--;)for(x=-W;x<W;x++)r[X+x+k]='/\\  _'[w^a[i+k]|w^a[i+k-1]?(x+W&&2-!(~x+W))^y>0:y&&y-w?2:4];return m}

Try it online! (with leading and trailing empty lines removed for readability)

Commented

We are 'drawing' in a matrix $$\m[\:]\$$, from right to left. The code essentially consists of 4 nested for loops, followed by the matrix update.

First loop: input values

for(                            // initialization:
m = [],                       //   m[] = output matrix
i = a.length,                 //   i   = length of input
X = i + 25;                   //   X   = center x-coordinate
// condition:
i--;                          //   stop when i = 0; decrement i
// final expression:
r[X] > ' ' | !w ? 0           //   unless w = 0 or there's already a character other
: r[X] = '_', //   than a space here, append the top '_'
X--                           //   decrement X
)                               //

Second loop: rows

for(                            // initialization:
y = w = a[i];                 //   y = w = next width, taken from the input list,
// condition:
y >= -w;                      //   stop when y = -w-1
// final expression:
y--                           //   decrement y
)                               //

Third loop: slices

for(                            // initialization:
r = m[Y = y + 25] =           //   r[] = row to update
m[Y] || Array(X).fill , //   if undefined, initialize it with X leading spaces
W = w + (y > 0 ? 1 - y : y),  //   W = width of the pattern at this row
k = 2;                        //   k = counter to draw two consecutive slices
// condition:
k--;                          //   stop when k = 0; decrement k
)                               //

Fourth loop: columns

for(                            // initialization:
// condition:
x < W;                        //   stop when x = W
// final expression:
x++                           //   increment x
)                               //

Matrix update

r[X + x + k] =                  // set the character at the current position:
'/\\  _'[                     //   0 = '/', 1 = '\', 2 or 3 = space, 4 = '_'
w ^ a[i + k] |              //   if a[i] is different from a[i + k]
w ^ a[i + k - 1] ?          //   or different from a[i + k - 1]:
( x + W &&                //     append a '/' if x = -W
2 - !(~x + W)           //     append a '\' if x = W - 1, or a space otherwise
) ^ y > 0                 //     invert '/' and '\' if we're below the middle row
:                           //   else:
y && y - w ? 2 : 4        //     append a '_' if y = 0 or y = w,
];                            //     or a space otherwise
• Suggest 32 for ' ' Nov 4 '19 at 2:52
• @ceilingcat This is not C. That would not work in JS. Nov 4 '19 at 6:57

Charcoal, 68 bytes

ＦＬθ«≔⌕α§⮌θιηＦη«Ｊ±⁺ιη⁰Ｇ↘η↗⊕η↖η ↘η←↙η↑↖η→↗η↘§_/⁼/ＫＫ≔⎇⁼ηζ◧_ηηδ↘δ←↙δ»≔ηζ

Try it online! Link is to verbose version of code. Takes a string of uppercase letters as input. Explanation:

ＦＬθ«

Loop once for each input letter.

≔⌕α§⮌θιη

Calculate the previous letter's value, since the drawing is done from end to start.

Ｆη«

Loop that many times; this is slightly golfier than an if since it doesn't need an else.

Ｊ±⁺ιη⁰Ｇ↘η↗⊕η↖η ↘η←↙η↑↖η→↗η

Erase and draw the main diamond of the section.

↘§_/⁼/ＫＫ

Draw the _ profile at the top if there isn't already a / there.

≔⎇⁼ηζ◧_ηηδ↘δ←↙δ

Draw the right side of the back of the section if this is a new section, otherwise erase the right side of the front diamond we drew last time (the left side was already erased earlier) leaving just two _s for the profiles.

»≔ηζ

Save the size of the section for the next loop.