3D シリンダー モデルの断面を描く方法

3D シリンダー モデルの断面を描く方法

私は、\tikzpicture を使用して、作業中のモデルの断面アイソメトリック ビューを描画しようとしています。

希望するビューと寸法を示す写真を下記に添付しました。

どのような助けでも大歓迎です :)

(絵でごめんなさい)

ここに画像の説明を入力してください

答え1

これは、出発点となるものです。全体像を描き直す試みではありません。しかし、全体像の大部分は示しており、残りは繰り返しになると思います。

さらに詳細に、

  • 3D ビューをインストールするには、perspectiveライブラリを使用します。(私見では、この記述は、isometric view3D 空間でシリンダーの方向を追加で指定した場合にのみ意味を持ちます。)
  • 長さは を介し​​て「関数」に保存されますdeclare function
  • これはティですZ なので、さまざまな面を適切な順序で描画する必要があります。これが気に入らない場合は、 に切り替えてくださいasymptote

コードと結果:

\documentclass[tikz,border=3mm]{standalone}
\usetikzlibrary{perspective}
\begin{document}
\begin{tikzpicture}[>=stealth,semithick,line cap=round,
    declare function={R=20;d=9;dd=1.5;rr=5;L=10;l=1;},%<- d/2efine some lengths
    scale=0.15]
 \begin{scope}[3d view={30}{10}]%<- install 3d view and set view angles
  \path[fill=gray!80] plot[variable=\t,domain=60:110,smooth] 
     ({R*cos(\t)},{d/2},{R*sin(\t)})
   --   plot[variable=\t,domain=110:60,smooth] 
     ({R*cos(\t)},{-d/2},{R*sin(\t)}) -- cycle;
  \path[fill=gray!40] plot[variable=\t,domain=120:240,smooth] 
     ({R*cos(\t)},{-d/2},{R*sin(\t)}) 
      --   plot[variable=\t,domain=240:120,smooth] 
     ({rr*cos(\t)},{-d/2},{rr*sin(\t)}) --cycle;
  \path[fill=black]  plot[variable=\t,domain=120:240,smooth] 
     ({rr*cos(\t)},{-d/2},{rr*sin(\t)})
     -- ({rr*cos(240)},{d/2},{rr*sin(240)}) 
     -- ({(rr+dd)*cos(240)},{d/2},{(rr+dd)*sin(240)})
   -- plot[variable=\t,domain=240:120,smooth] 
     ({(rr+dd)*cos(\t)},{-d/2},{(rr+dd)*sin(\t)}) -- cycle;     
  \path[fill=brown!40] plot[variable=\t,domain=120:60,smooth] 
     ({rr*cos(\t)},{d/2+l},{rr*sin(\t)}) --
     plot[variable=\t,domain=60:120,smooth] 
     ({rr*cos(\t)},{-d/2-L},{rr*sin(\t)}) --
     cycle;  
  \path[fill=gray!40] plot[variable=\t,domain=60:120,smooth] 
     ({R*cos(\t)},{-d/2},{R*sin(\t)}) 
      --   plot[variable=\t,domain=120:60,smooth] 
     ({rr*cos(\t)},{-d/2},{rr*sin(\t)}) --cycle;
  \path[fill=black]  plot[variable=\t,domain=120:60,smooth] 
     ({rr*cos(\t)},{-d/2},{rr*sin(\t)})
     -- ({rr*cos(60)},{d/2},{rr*sin(60)})   
     -- ({(rr+dd)*cos(60)},{d/2},{(rr+dd)*sin(60)})
   -- plot[variable=\t,domain=60:120,smooth] 
     ({(rr+dd)*cos(\t)},{-d/2},{(rr+dd)*sin(\t)}) -- cycle;     
  \path[fill=gray!60]    
    ({(rr+dd)*cos(60)},{-d/2},{(rr+dd)*sin(60)}) 
    -- ({(rr+dd)*cos(60)},{d/2},{(rr+dd)*sin(60)})
    -- ({R*cos(60)},{d/2},{R*sin(60)})
    -- ({R*cos(60)},{-d/2},{R*sin(60)}) -- cycle;
  \path[fill=brown!60] plot[variable=\t,domain=240:60,smooth] 
     ({rr*cos(\t)},{-d/2-L},{rr*sin(\t)}) --cycle;   
  \path[fill=brown] 
     ({rr*cos(240)},{-d/2-L},{rr*sin(240)}) 
     -- ({rr*cos(60)},{-d/2-L},{rr*sin(60)}) 
     -- ({rr*cos(60)},{d/2+l},{rr*sin(60)}) 
     -- ({rr*cos(240)},{d/2+l},{rr*sin(240)}) 
     --cycle;    
  \path[fill=gray!60]    
    ({(rr+dd)*cos(240)},{-d/2},{(rr+dd)*sin(240)}) 
    -- ({(rr+dd)*cos(240)},{d/2},{(rr+dd)*sin(240)})
    -- ({R*cos(240)},{d/2},{R*sin(240)})
    -- ({R*cos(240)},{-d/2},{R*sin(240)}) -- cycle;
 \end{scope}  
 %
 \begin{scope}[xshift=35cm]
  \draw (-d/2,-R) rectangle (d/2,-rr-dd) (-d/2,R) rectangle (d/2,rr+dd)
   (-d/2-L,-rr) rectangle (d/2+l,rr);
  \draw[fill] (-d/2,-rr) rectangle (d/2,-rr-dd)
  (-d/2,rr) rectangle (d/2,rr+dd);
  \draw[dashed] (d/2,R) -- ++ (5,0) coordinate (rt)
     (d/2,-R) -- ++ (5,0) coordinate (rb);
  \draw[<->] (rt) -- (rb) node[midway,rotate=90,anchor=north]
     {\pgfmathparse{2*R}\pgfmathprintnumber\pgfmathresult\,mm};
  \draw[<->] (-d/2,R+1) --  (d/2,R+1) node[midway,rotate=90,anchor=west]
  {\pgfmathparse{d}\pgfmathprintnumber\pgfmathresult\,mm};
 \end{scope}
\end{tikzpicture}
\end{document}

ここに画像の説明を入力してください

関連情報