tikz add tag
Anonymous 1123
I have to draw dashed lines of this figure by hand. My code
```
\documentclass[border=2mm,12pt,tikz]{standalone}
\usepackage{tikz,tikz-3dplot} 
\usepackage{fouriernc}
\usetikzlibrary{folding}
\begin{document}
\tdplotsetmaincoords{60}{135}
	\begin{tikzpicture}[tdplot_main_coords,scale=1,line join = round, line cap = round]
\pgfmathsetmacro\a{4}
\pgfmathsetmacro{\b}{\a/2}
\path
coordinate (A) at (\b,0,-\a) 
coordinate (B) at (0,\b,-\a) 
coordinate (C) at (-\b,0,-\a)
coordinate (D) at (0,-\b,-\a)
coordinate (I) at (\b,\a,0) 
coordinate (J) at (0,\a,-\b)
coordinate (K) at (-\b,\a,0) 
coordinate (L) at (0,\a,\b)
coordinate (P) at (\a,-\b,0) 
coordinate (Q) at (\a,0,-\b)
coordinate (R) at (\a,\b,0) 
coordinate (S) at (\a,0,\b)
 
coordinate (A') at ($(A)+ (0,0,2*\a)$) 
coordinate (B') at ($(B)+ (0,0,2*\a)$)  
coordinate (C') at ($(C)+ (0,0,2*\a)$) 
coordinate (D') at ($(D)+ (0,0,2*\a)$)

coordinate (I') at ($(I)+ (0,-2*\a,0)$) 
coordinate (J') at ($(J)+ (0,-2*\a,0)$)  
coordinate (K') at ($(K)+ (0,-2*\a,0)$) 
coordinate (L') at ($(L)+ (0,-2*\a,0)$)

coordinate (P') at ($(P)+ (-2*\a,0,0)$)
coordinate (Q') at ($(Q)+ (-2*\a,0,0)$)
coordinate (R') at ($(R)+ (-2*\a,0,0)$)
coordinate (S') at ($(S)+ (-2*\a,0,0)$);

\draw [ultra thick] 
(A) --(B)--(J)--(I) -- (R) -- (Q) --cycle
(I) --(J)--(K) --(L)--cycle
(K) --(L)--(B') --(C')--(S')--(R')--cycle 
(A') --(B')--(C')--(D') --cycle
(P) --(Q)--(R)--(S) --cycle
(S) --(P)--(I')--(L')--(D') --(A')--cycle
;

\draw [dashed]  (A) --(D) -- (C) --(B)
(C) -- (Q') -- (P') --(K')--(J') --(D)
(J') --(I') (K')-- (L') (P') --(S') (Q') --(R')

;
\foreach \point/\position in {A/below,B/below,C/below,D/left,I/below,J/below,K/right,L/above,P/right,Q/above,R/left,S/below,I'/below,J'/below,K'/right,L'/above,P'/right,Q'/above,R'/left,S'/below,A'/below,B'/below,C'/below,D'/left}
{\fill (\point) circle (0.0pt);
	%\node[\position=2pt] at (\point) {$\point$};
}

\end{tikzpicture}
\end{document}

```
![ScreenHunter 854.jpg](/image?hash=007ce36adf55bc48275b6e480eb4b1b45d8c760d5caf3add8039ee9508277d0b)

How to draw this dashed lines this figure automatically?
Top Answer
user 3.14159
This is a convex shape, so we can repeat the tricks from the previous answer on tetrahedra. Note that I added the style for the face to the `3dtools` library, so you need to load it to run the following code. Note that the default value of `O` happens to be inside the poyhedron here, in general you may to adjust it. 
```
\documentclass[border=2mm,12pt,tikz]{standalone}
\usepackage{tikz-3dplot} 
\usetikzlibrary{3dtools}% https://github.com/marmotghost/tikz-3dtools
\pgfdeclarelayer{background} 
\pgfdeclarelayer{foreground}
\pgfdeclarelayer{behind}  
\pgfsetlayers{behind,background,main,foreground}
\begin{document}
\foreach \Angle in {5,15,...,355}
{\tdplotsetmaincoords{60}{\Angle}
\begin{tikzpicture}[tdplot_main_coords,scale=1,line join=round, 
	line cap=round,rounded corners=0.6pt,
	declare function={a=4;b=a/2;}]
 \path[tdplot_screen_coords,use as bounding box] 
 	(-1.2*a,-1.2*a) rectangle (1.2*a,1.2*a);
 \path (b,0,-a)  coordinate (A)
  (0,b,-a)  coordinate (B)
  (-b,0,-a) coordinate (C)
  (0,-b,-a) coordinate (D)
  (b,a,0)  coordinate (I)
  (0,a,-b) coordinate (J)
  (-b,a,0)  coordinate (K)
  (0,a,b) coordinate (L)
  (a,-b,0)  coordinate (P)
  (a,0,-b) coordinate (Q)
  (a,b,0)  coordinate (R)
  (a,0,b) coordinate (S)
  [3d coordinate={(A')=(A)+ (0,0,2*a)}, 
   3d coordinate={(B')=(B)+ (0,0,2*a)},  
   3d coordinate={(C')=(C)+ (0,0,2*a)}, 
   3d coordinate={(D')=(D)+ (0,0,2*a)},
%
   3d coordinate={(I')=(I)+ (0,-2*a,0)}, 
   3d coordinate={(J')=(J)+ (0,-2*a,0)},  
   3d coordinate={(K')=(K)+ (0,-2*a,0)}, 
   3d coordinate={(L')=(L)+ (0,-2*a,0)},
%
   3d coordinate={(P')=(P)+ (-2*a,0,0)},
   3d coordinate={(Q')=(Q)+ (-2*a,0,0)},
   3d coordinate={(R')=(R)+ (-2*a,0,0)},
   3d coordinate={(S')=(S)+ (-2*a,0,0)}];
 \tikzset{3d/polyhedron/.cd,fore layer=foreground,back layer=background,
 	fore/.style={draw,fill=none,ultra thick,solid},
 	back/.style={draw,fill=none,dashed,thin},
	draw face with corners={{(A)},{(B)},{(J)},{(I)},{(R)},{(Q)}},
	draw face with corners={{(I)},{(J)},{(K)},{(L)}},
	draw face with corners={{(K)},{(L)},{(B')},{(C')},{(S')},{(R')}},
	draw face with corners={{(A')},{(B')},{(C')},{(D')}},
	draw face with corners={{(P)},{(Q)},{(R)},{(S)}},
	draw face with corners={{(S)},{(P)},{(I')},{(L')},{(D')},{(A')}},
    draw face with corners={{(I)},{(R)},{(S)},{(A')},{(B')},{(L)}},
    draw face with corners={{(C')},{(D')},{(L')},{(K')},{(P')},{(S')}},
    draw face with corners={{(B)},{(C)},{(Q')},{(R')},{(K)},{(J)}},
    draw face with corners={{(A)},{(D)},{(J')},{(I')},{(P)},{(Q)}},
	draw face with corners={{(A)},{(D)},{(C)},{(B)}},
	draw face with corners={{(C)},{(Q')},{(P')},{(K')},{(J')},{(D)}},
	draw face with corners={ {(L')},{(K')},{(J')},{(I')}},
	draw face with corners={{(R')},{(Q')},{(P')},{(S')}}}
% \foreach \point/\position in {A/below,B/below,C/below,D/left,I/below,J/below,K/right,L/above,P/right,Q/above,R/left,S/below,I'/below,J'/below,K'/right,L'/above,P'/right,Q'/above,R'/left,S'/below,A'/below,B'/below,C'/below,D'/left}
% {\fill (\point) circle (0.0pt);
% 	\node[\position=2pt] at (\point) {$\point$};
% }

\end{tikzpicture}}
\end{document}
```
![ani.gif](/image?hash=7c364066866a0258b4a260e2a1e6f671226a2a0d73650996f08b4bf82d8826af)

Enter question or answer id or url (and optionally further answer ids/urls from the same question) from

Separate each id/url with a space. No need to list your own answers; they will be imported automatically.