# How to draw oval line through specified coordinates?

How to draw oval line through specified coordinates? I have used simple \draw [red, dashed, line width=1px] (A) to[out=180, in=180] (C); for each connection manually. And connected line dashes are not properly connected (as oval made from separate parts, at A and B points). Perhaps there is some other more effective way?

\documentclass[preview,border=12pt,12pt, varwidth=\maxdimen]{standalone}
\usepackage[americaninductors, europeanresistor]{circuitikz}
\usepackage{siunitx}
\usepackage{nccmath}
\begin{document}
\sisetup{output-decimal-marker = {,}}

\begin{circuitikz}

\draw (0,0) coordinate(point0) to[R, l_=$\underline{Z}_1$, *-]  (0,4) coordinate(point1);

\draw (0,4) to[L=$\underline{Z}_2$, label distance=2px, *-*] (4,4) coordinate(point2);

\draw (4,4) to[L=$\underline{Z}_3$] (4,0);

\draw (0,0) to[short, -*] (4,0);

\draw (4,4) to[C=$\underline{Z}_5$, label distance=2px, -*] (8,4) coordinate(point3);

\draw (8,4) to[R=$\underline{Z}_{67}$] (8,0);

\draw (4,0) to[short] (8,0);

\draw (0,4) -- (0,6) to[C=$\underline{Z}_4$, label distance=2px] (8,6) -- (8,4);

\draw (point1) -- ++ (-2,0);
\draw (point0) -- ++ (-2,0);

\node[draw,rectangle,text centered,font=\bfseries] at ([xshift=-0.5cm,yshift=0.5cm] point1){1};
\node[draw,rectangle,text centered,font=\bfseries] at ([yshift=0.5cm] point2){2};
\node[draw,rectangle,text centered,font=\bfseries] at ([xshift=0.5cm,yshift=0.5cm] point3){3};
\node[draw,rectangle,text centered,font=\bfseries] at (0,-0.5){4};

\coordinate (A) at (1.5,5.2);
\coordinate (B) at (6.5,5.2);
\coordinate (C) at (4,0.8);

\draw [red, dashed, line width=1px] (A) -- (B);
\draw [red, dashed, line width=1px] (A) to[out=180, in=180] (C);
\draw [red, dashed, line width=1px] (B) to[out=0, in=0] (C);

\end{circuitikz}
\end{document} • Is it the connections from one part to another or the shape you want to change? That's not what I'd call 'oval', but I don't see how it could be in that space.
– cfr
Sep 30 at 20:35
• Shape is exactly as should be (+ / -). But you can see red line is not the same thickness and dashes are badly connected (at A and B points). Sep 30 at 20:39
• @ErnestasGruodis The varying line thickness is most likely a problem of your PDF viewer, they sometimes render things weirdly. Sep 30 at 20:53

If you're just concerned about the messy joins, the trick is to draw the shape as a single path, so that the pattern of dashes isn't stopping and starting over, but continues throughout. You can't completely avoid inconsistency without ensuring the length of the dash pattern divides evenly into the length of the path, but a single path improves the result dramatically, even so.

\documentclass[preview,border=12pt,12pt, varwidth=\maxdimen]{standalone}
\usepackage[americaninductors, europeanresistor]{circuitikz}
\usepackage{siunitx}
\usepackage{nccmath}
\begin{document}
\sisetup{output-decimal-marker = {,}}
\begin{circuitikz}
\draw (0,0) coordinate(point0) to[R, l_=$\underline{Z}_1$, *-]  (0,4) coordinate(point1);

\draw (0,4) to[L=$\underline{Z}_2$, label distance=2px, *-*] (4,4) coordinate(point2);

\draw (4,4) to[L=$\underline{Z}_3$] (4,0);

\draw (0,0) to[short, -*] (4,0);

\draw (4,4) to[C=$\underline{Z}_5$, label distance=2px, -*] (8,4) coordinate(point3);

\draw (8,4) to[R=$\underline{Z}_{67}$] (8,0);

\draw (4,0) to[short] (8,0);

\draw (0,4) -- (0,6) to[C=$\underline{Z}_4$, label distance=2px] (8,6) -- (8,4);

\draw (point1) -- ++ (-2,0);
\draw (point0) -- ++ (-2,0);

\node[draw,rectangle,text centered,font=\bfseries] at ([xshift=-0.5cm,yshift=0.5cm] point1){1};
\node[draw,rectangle,text centered,font=\bfseries] at ([yshift=0.5cm] point2){2};
\node[draw,rectangle,text centered,font=\bfseries] at ([xshift=0.5cm,yshift=0.5cm] point3){3};
\node[draw,rectangle,text centered,font=\bfseries] at (0,-0.5){4};

\coordinate (A) at (1.5,5.2);
\coordinate (B) at (6.5,5.2);
\coordinate (C) at (4,0.8);

\draw [red, dashed, line width=1px] (A) -- (B) to[out=0, in=0] (C) to[out=180,in=180] cycle;
\end{circuitikz}
\end{document}

• There's dash expand off (which originated somewhere on this site) but it's for open paths. For closed paths this could be adjusted so that it wraps around cleanly. Though, in this example it's barely a problem anyway. Sep 30 at 20:51
• Now it looks so pretty in .pdf. I'm very happy :) Magic 'cycle' at the end helped, thanks. Sep 30 at 20:54
• @Qrrbrbirlbel Thanks. I didn't know about that one. I thought it worth mentioning there is an inconsistency, but isn't something I'd be inclined to go to the effort of addressing. The complexity clearly wouldn't be worth it here.
– cfr
Sep 30 at 20:55
• @ErnestasGruodis You made it incredibly easy to answer ;). The only thing which threw me was that 'oval' ;).
– cfr
Sep 30 at 20:56

Based on my answer on your previous question and with using of the fit library:

\documentclass[12pt,, margin=12pt]{standalone}
\usepackage[americaninductors, europeanresistor]{circuitikz}
\usetikzlibrary{fit,
shapes.geometric}
\usepackage{siunitx}
\usepackage{nccmath}

\begin{document}
\begin{circuitikz}[every label/.style = {label distance=2mm,
draw, minimum size=1em, inner sep=1pt,
font=\bfseries}
]
\ctikzset{capacitors/width=0.1, capacitors/height=0.5,
label distance=3pt}
% 1. loop
\draw   (0,0)   coordinate[label=below:4]   (p0)
to[R=$\underline{Z}_1$, *-] ++ (0, 4) coordinate[label=above left:1]  (p1)
to[L=$\underline{Z}_2$,*-*,
name=A]                  ++ (3, 0) coordinate[label=above:2] (p2)
to[L=$\underline{Z}_3$, -*,
name=B]                  ++ (0,-4)
% 2. loop
(p2)    to[C=$\underline{Z}_5$, -*,
name=C]                  ++ (3, 0) coordinate[label=above right:3] (p3)
to[R=$\underline{Z}_{67}$]  ++ (0,-4)
-- (p0)
% 3. loop
(p1)    -- ++ (0,2)
to[C=$\underline{Z}_4$]     ++ (6, 0)
to[short,-*]                ++ (0,-2)
% input connectors
(p1)    to[short,*-o]   ++ (-2,0)
(p0)    to[short,*-o]   ++ (-2,0);
% group of elements forming T circuit
\node [trapezium, minimum height=40mm, trapezium stretches, yscale=-1,
draw=red, thick, densely dashed, rounded corners=5mm,
inner xsep=-2ex, yshift=-2ex,
fit=(A.center) (B) (C.center)] {};
\end{circuitikz}
\end{document} • Red dashed curve may looks nicer/smoother if you replace rounded corners=5mm with rounded corners=11mm. Oct 1 at 10:57
• Easier than figuring the coordinates for your non-oval than mine!
– cfr
Oct 1 at 13:43