Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.
3  
Step 1: stock up on canned goods because you'll be there a while ;) Kidding, of course... is there a specific problem you're having with some part of the diagram? TikZ is very well documented in the PGF manual, so if it's just a general question I would refer you to that. –  David Z Apr 6 '11 at 1:36
    
Rather use a full drawing program such as Inkscape. It is quite good with 3D isometric boxes such as the ones depicted above –  Danie Els Apr 6 '11 at 5:20
1  
To follow up on David's comment, if there's a specific part of the diagram that you're having trouble with (the cutaway looks like it might be tricky) then ask about that. Otherwise, your best bet is to read the manual and learn how to draw the different components. Apart from the cutaway, I don't see anything particularly difficult in that diagram, but it would be quite a complicated diagram due to the amount of stuff there. –  Loop Space Apr 6 '11 at 9:06
    
@David Zaslavsky: Thank you for your comment; it is help with the cut-away that I need the most. –  Thanos D. Papaïoannou Apr 6 '11 at 12:47
    
@Daniel Els: thank you for your suggestion; I will look into Inkscape. –  Thanos D. Papaïoannou Apr 6 '11 at 12:47

1 Answer 1

up vote 20 down vote accepted

Third version. I tried to make cleaner code. The only problem is for the magnets with rounded corners. My method is this case is not correct. The work with plans is interesting but it's preferable to draw the magnets in 2D, it's for easy to fill the magnets. The "front" faces and "back" faces are easy to draw with rounded corners but the lateral surface is very boring. I's certainly possible to improve the next code.

\documentclass[]{scrartcl}
\usepackage{tikz}
\usetikzlibrary{arrows,3d,calc,intersections}
\begin{document}

\begin{tikzpicture}[x  = {(-0.65cm,-0.45cm)},
                    y  = {(0.65cm,-0.45cm)},
                    z  = {(0cm,0.8cm)},
                    scale = 2,
                    color = {lightgray}] 

% style of faces
\tikzset{facestyle/.style={shade,line join=round,
                           bottom color=darkgray!60,
                           top color=lightgray}}

\path (1.5,1.5,2) coordinate (c);  
\path[facestyle] (0,0,2) -- (0,2,2) --(2,2,2)--(2,0,2)--cycle ; 
% face "left"
\begin{scope}[canvas is zy plane at x=2]
  \path[facestyle] (0,0) rectangle (2,2);
  \path (0.2,2) 
    coordinate (f1) -- (0.2,1.4)
    coordinate (f2) -- (1,1)
    coordinate (f3) -- (2,1) 
    coordinate (f4) -- (c)--(2,2) 
    coordinate (f6);
\end{scope} 

% face  "right"
\begin{scope}[canvas is zx plane at y=2]
  \path[facestyle] (0,0) rectangle (2,2);
  \path (0.2,2) 
     coordinate (g1) -- (0.2,1.4) 
     coordinate (g2) -- (1,1)
     coordinate (g3) -- (2,1)
     coordinate (g4) -- (c) -- (2,2)
     coordinate (g6);  
\end{scope}    
%<------------------    other faces ------------------------------> 
% face "front or left" magnet 2
\begin{scope}[canvas is zy plane at x=-5]
  \path[facestyle] (-0.05,-4.5) rectangle (1.95,-2.5);  
\end{scope}  
% face arriere magnet 1
 \begin{scope}[canvas is zx plane at y=0]
   \path[facestyle] (5,4) rectangle (7,7);  
   \draw[black] (6.98, -0.5) -- (6.98, 4);     
\end{scope}  
% face front magnet 1
\begin{scope}[canvas is zy plane at x=3]
  \path[facestyle] (2.5,-4) rectangle (0.5,-2);  
\end{scope}
% face sup magnet 1  
\begin{scope}
 \draw[facestyle]
       (1,-3,3.60) --  (1,-1,3.60) --  (4,-1,3.60) -- (4,-3,3.60);
 \draw[facestyle]  
       (-3.5,-3,3.60) --  (-3.5,-1,3.60) --  (-7,-1,3.60) -- (-7,-3,3.60) ; 
\end{scope}

%<------------------ cutout  ------------------------------>  
\draw[shade,color=gray,double=lightgray,double distance=1pt]%
   (f4) to [in=230,out=-15] 
   (c)  to [in=180 ,out = 80]
   (g4) to [in=20,out=190]
   (g3) to [in=30,out=190]
   (g2) to 
   (g1) to 
   (f2) to [in=20,out=100]
   (f3) to [in=-160,out=-120]
   (f4)
    ;
%<-------------------  hole in the box  ------------------------------> 
\fill[double=lightgray,double distance=1pt,top color=black!80,shade]%
              (0,0,.8) circle [x radius=2mm,y radius=1mm, rotate=15];
%<-------------------  source of rays --------------------------------> 
\fill[black!80] (1,1,0) circle [x radius=2mm,y radius=1mm, rotate=15];
%<-------------------  rays Gamma  ---------------------------------->
\begin{scope}[black!60,>=open triangle 45,line width =2]
 %  ray
 \draw (.7,.8,0)--++(0,0,1);    
  \draw[->] ((.7,.8,1.85)--++(0,0,7) ;      
 %  ray  
 \draw (.8,.7,0)--++(0,0,1);    
 \draw[->] (.8,.7,1.85)--++(0,0,8) ; 
 %  ray         
 \draw (1,1,0)--++(0,0,1.4);   
 \draw[->] (1,1,1.85)--++(0,0,9) node [above]{Gamma};  
\end{scope}


%<------------------- end rays Gamma  ------------------------------>


%<-------------------  rays Beta  ---------------------------------->

\begin{scope}[canvas is xz plane at y=1,black!60,>=open triangle 45,
             line width =2,rounded corners]
%  ray
\draw (1.1,0) -- ++(0,1.4);    
\draw[->,] (1.1,1.95) -- (1.1,6) -- (3,11) ; 

%  ray
\draw (1.2,0) -- ++(0,1.4);     
\draw[->] (1.2,1.95) -- (1.2,6) -- (4,10);
%  ray
\draw (1.15,0) -- ++(0,1.4);     
\draw[->] (1.15,1.95) -- (1.15,6) -- (3.5,10.5)node [above]{Beta};   

%<------------------- End  rays Beta  ------------------------------>    

%<-------------------  rays Alpha  ------------------------------>    
\draw (0.9,0) -- ++(0,1.5)
      (0.9,1.8) -- (0.9,6) to (-.5,5.8) coordinate (d);   
\draw[->,lightgray] (d) -- (-3,5.5) coordinate (d) ;

\draw (0.8,0) -- ++(0,1.45)
      (0.8,1.8) -- (0.8,5.7) to (-.5,5.6) ;   
\draw[->,lightgray] (-.5,5.6) -- (-3,5.3); 

\draw (0.85,0) -- ++(0,1.45)     
      (0.85,1.8) -- (0.85,5.5) to (-.5,5.4) ;
\draw[->,lightgray] (-.5,5.4) -- (-2.5,5.2);  
\end{scope}

%<--------------------------- face right  magnet 2 --------------------> 
\begin{scope}[canvas is zx plane at y=2]
  \path[facestyle,opacity=.8] (5,-4) rectangle (7,-0.5); 
\end{scope}  
%<---------------------------rays of magnets  ------------------------>
\begin{scope}[canvas is zx plane at y=2]
  \path[facestyle] (5,4) rectangle (7,7);
  \draw[black] (7,  -0.5) -- (7,  4)
               (5,  -0.5) -- (5,  4)
               (6,  -0.5) -- (6,  4)
               (5.5,-0.5) -- (5.5,4)
               (6.5,-0.5) -- (6.5,4) 
               (7.45,-.05)-- (7.45,4.45)
               (7.9,.35)  -- (7.9,4.85)
               (8.35,0.75) node[above right=1cm]{\textcolor{black!50}{NORTH}}%
            -- (8.35,5.25) node[below left=1cm]{\textcolor{black!50}{SOUTH}}
               (8.8,1.15) -- (8.8,5.65); 
 \end{scope}
  \node[black,right] at (d)  {Alpha};
 \end{tikzpicture}   
\end{document}

enter image description here

I try magnets with rounded corners but the result is not pretty and there are a lot of approximations

enter image description here


share|improve this answer
    
@Thanos @Daniel I can do better but with more time ! I don't know Inskape ! –  Alain Matthes Apr 6 '11 at 22:06
    
Thank you, Altermundus! Please do tell me when you are tired of improving the picture, then I will take it and improve it as much as I can! Of course, if no better answer has appeared until then, I will check this as the best answer! –  Thanos D. Papaïoannou Apr 6 '11 at 22:32
    
I have a lot of work about several packages that I need to upload on ctan. This is not easy to draw something like that. I think you can modify alone this code. I think the better for you is to indicate what is wrong in my picture or what you prefer and if it's possible I can do it. There are a lot of good TikZ(s users here, perhaps one of them will improve my code. –  Alain Matthes Apr 6 '11 at 22:40
    
@Thanos I add the second version . I removed a thin line in the first box. I can add other arrows for Beta, Gamma . I used gray for the alpha rays but I don't know if you want. If you want some explanations about the code I can help you but only in a few days. –  Alain Matthes Apr 7 '11 at 13:03
    
@Altermundus: I am very grateful for your help up to now. If you do have time, then please: add more arrows to each group of rays; make the edges of the cutout more rounded, as in my original image; and make the corners of the magnets rounded. Thanks, again! –  Thanos D. Papaïoannou Apr 7 '11 at 13:30

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.