# Creating “cylinder with bottom” node shape in TikZ/PGF

How to create custom TikZ node "cylinder with bottom", where hidden line in cylinder bottom is shown using dashed line.

Something like the following creation, except node center should be in the middle of cylinder (as if it was in the middle of the center of 3D cylinder), not in center of the side -- it looks imbalanced

https://www.writelatex.com/1149537sksqzs#/2737083/

\documentclass[tikz]{standalone}

\usepackage{tikz}
\usetikzlibrary{shapes.geometric,calc}

\begin{document}
\begin{tikzpicture}
\node[cylinder,draw=black,thick,aspect=0.7,
minimum height=1.7cm,minimum width=1.5cm,
shape border rotate=90,
cylinder uses custom fill,
cylinder body fill=red!30,
cylinder end  fill=red!10]
(A) {A};
\draw[dashed]
let \p1 = ($(A.after bottom) - (A.before bottom)$),
\n1 = {0.5*veclen(\x1,\y1)},
\p2 = ($(A.bottom) - (A.after bottom)!.5!(A.before bottom)$),
\n2 = {veclen(\x2,\y2)}
in
(A.before bottom) arc [start angle=0, end angle=180,
\end{tikzpicture}
\end{document} • It seams to be a problem of line width. Try x radius=\n1 - \pgflinewidth ? – Tarass Jun 3 '14 at 17:58

As Tarass correctly guessed, it is a problem of line width, but it affects both to the arc radius and to the initial point (A.before bottom). This is a possible fix:

\documentclass[tikz]{standalone}

\usepackage{tikz}
\usetikzlibrary{shapes.geometric,calc}

\title{TikZ: cylinder with bottom - example}
\begin{document}
\begin{tikzpicture}
\node[cylinder,draw=black,thick,aspect=0.7,minimum height=1.7cm,minimum width=1.5cm,shape border rotate=90,cylinder uses custom fill, cylinder body fill=red!30,cylinder end fill=red!10] (A) {A};
\draw[dashed]
let \p1 = ($(A.after bottom) - (A.before bottom)$),
\n1 = {0.5*veclen(\x1,\y1)-\pgflinewidth},
\p2 = ($(A.bottom) - (A.after bottom)!.5!(A.before bottom)$),
\n2 = {veclen(\x2,\y2)-\pgflinewidth}
in
([xshift=-\pgflinewidth] A.before bottom) arc [start angle=0, end angle=180, 