答案1
这是一个开始,而不是完全重现图表的尝试。您可以建立一些 3D 视图,然后逐个放置对象。对于重复的对象(例如圆柱体或长方体),定义pic
s 是有意义的。为了将某些东西投影到坐标平面上,您可以使用3d
库。
\documentclass[tikz,border=3mm]{standalone}
\usetikzlibrary{perspective,3d}
\begin{document}
\makeatletter
\tikzset{pics/3d cylinder z/.style={code={%
\tikzset{3d/cylinder/.cd,#1}%
\def\pv##1{\pgfkeysvalueof{/tikz/3d/cylinder/##1}}%
\edef\mylocalaz{\pgf@view@az}%
\draw[pic actions] %[left color=gray!90,right color=gray!60,middle color=gray!20]
plot[domain=\pgf@view@az:\pgf@view@az-180,variable=\t,smooth]
({\pv{r}*cos(\t)},
{\pv{r}*sin(\t)},0)
--
plot[domain=\mylocalaz-180:\mylocalaz,variable=\t,smooth]
({\pv{r}*cos(\t)},
{\pv{r}*sin(\t)},
\pv{h})
-- cycle;
\draw[pic actions] %[fill=gray!30]
plot[domain=0:360,variable=\t,smooth cycle]
({\pv{r}*cos(\t)},
{\pv{r}*sin(\t)},
\pv{h});
\pgfkeys{/tikz/3d/cylinder/extra}
}},pics/cuboid/.style={code={%
\tikzset{3d/cuboid/.cd,#1}%
\def\pv##1{\pgfkeysvalueof{/tikz/3d/cuboid/##1}}%
\draw[pic actions]
(-\pv{x}/2,-\pv{y}/2,-\pv{z}/2)
-- (-\pv{x}/2,-\pv{y}/2,\pv{z}/2)
-- (\pv{x}/2,-\pv{y}/2,\pv{z}/2)
-- (\pv{x}/2,-\pv{y}/2,-\pv{z}/2) -- cycle;
\draw[pic actions]
(-\pv{x}/2,-\pv{y}/2,-\pv{z}/2)
-- (-\pv{x}/2,-\pv{y}/2,\pv{z}/2)
-- (-\pv{x}/2,\pv{y}/2,\pv{z}/2)
-- (-\pv{x}/2,\pv{y}/2,-\pv{z}/2) -- cycle;
\draw[pic actions]
(-\pv{x}/2,-\pv{y}/2,\pv{z}/2)
-- (\pv{x}/2,-\pv{y}/2,\pv{z}/2)
-- (\pv{x}/2,\pv{y}/2,\pv{z}/2)
-- (-\pv{x}/2,\pv{y}/2,\pv{z}/2) -- cycle;
}},
3d/.cd,cylinder/.cd,r/.initial=1,h/.initial=2,extra/.code={},
/tikz/3d/.cd,cuboid/.cd,x/.initial=1,y/.initial=1,z/.initial=1}
\makeatother
\begin{tikzpicture}[3d view={-35}{25},line cap=round,line join=round]
\path (0,0,0) pic{cuboid={x=4,y=5,z=3}}
(0,0,1.6)pic[fill=white]{cuboid={x=4.2,y=5.2,z=0.2}};
\begin{scope}[canvas is yx plane at z=1.7]
\draw[yshift=6mm,xscale=-1] foreach \X [evaluate=\X as \Y using {int(Mod(\X,60))}]
in {0,10,...,120} {(234-2.4*\X:0.5) -- (234-2.4*\X:0.8)
\ifnum\Y=0
node[pos=1.5,transform shape,font=\sffamily] {\X}
\fi};
\end{scope}
\path(-1.3,1.8,1.7) pic[fill=white]{3d cylinder z={r=0.5,h=2}}
(1.3,1.8,1.9) pic[fill=white]{cuboid={z=0.4}}
(-1.3,-1.8,1.7) pic[fill=white]{3d cylinder z={r=0.3,h=0.2}}
(-1.3,-1.8,1.9) pic[fill=white]{3d cylinder z={r=0.4,h=0.4,
extra/.code={
\draw foreach \t in {0,10,...,180}
{({\pv{r}*cos(\mylocalaz-\t)},{\pv{r}*sin(\mylocalaz-\t)},0)
-- ({\pv{r}*cos(\mylocalaz-\t)},{\pv{r}*sin(\mylocalaz-\t)},\pv{h}) };
}}};
\end{tikzpicture}
\end{document}