My purpose is draw an horizontal cylinder. I defined the left and the right base with /.pic
. Now I would link these bases with \draw
, using the bases anchor point .north
and .south
.
Something goes wrong: no output
\documentclass[12pt]{article}
\usepackage{tikz}
\begin{document}
\begin{figure}
\centering
\begin{tikzpicture}
\tikzset{
leftbase/.pic={
code={
\def\xR{0.5cm}; %x radius of ellipse
\def\yR{1cm}; %y radius of ellipse
\draw (-\xR,0) arc(90:270:0.5cm and 1cm);
\draw (-\xR,0) arc(90:-90:0.5cm and 1cm);
}
},
rightbase/.pic={
code={
\def\xR{0.5cm}; %x radius of ellipse
\def\yR{1cm}; %y radius of ellipse
\draw[dotted] (-\xR+1.7in,0) arc(90:270:0.5cm and 1cm);
\draw (-\xR+1.7in,0) arc(90:-90:0.5cm and 1cm);
}
}
}
node[leftbase] (lb) {};
node[rightbase] (rb) {};
\end{tikzpicture}
\end{figure}
\end{document}
Any idea?