5

I am aware of some questions regarding technical drawings in LaTeX, e.g.,

that address only parts, but not all aspects of my question.

My applications when teching the very basics of technical drawing are rather simple. Consider the MWE

\documentclass[a4paper, landscape]{article}

\usepackage{tikz}
\usepackage{geometry}

\usetikzlibrary{arrows.meta}
\usetikzlibrary{patterns}

\geometry{margin=0mm}
\pagestyle{empty}

\makeatletter

\newlength{\td@FullWidth}
\newlength{\td@HalfWidth}
\newlength{\td@TextSizeL}
\newlength{\td@TextSizeM}

\setlength{\td@FullWidth}{0.50mm}
\setlength{\td@HalfWidth}{0.25mm}
\setlength{\td@TextSizeL}{3.50mm}
\setlength{\td@TextSizeM}{2.50mm}
\def\td@RuleDist{5.00mm}
\def\td@ArrowLength{2.50mm}
\def\td@ArrowWidth{0.669873mm}

\tikzstyle{tdEdge}   = [line width=\td@FullWidth]
\tikzstyle{tdHidden} = [line width=\td@HalfWidth, dash pattern=on 2.50mm off 1.00mm]
\tikzstyle{tdSym}    = [line width=\td@HalfWidth, dash pattern=on 2.50mm off 0.50mm on 0.25mm off 0.50mm]
\tikzstyle{tdHelp}   = [line width=\td@HalfWidth]
\tikzstyle{tdDim}    = [line width=\td@HalfWidth, <->, >={Triangle[length=\td@ArrowLength, width=\td@ArrowWidth]}]

\pgfdeclarepatternformonly{tdRuled}
  {\pgfqpoint{-1pt}{-1pt}}
  {\pgfqpoint{\td@RuleDist}{\td@RuleDist}}
  {\pgfqpoint{\td@RuleDist}{\td@RuleDist}}
  {
    \pgfsetlinewidth{\td@HalfWidth}
    \pgfsys@rectcap
    \pgfpathmoveto{\pgfqpoint{0mm}{0mm}}
    \pgfpathlineto{\pgfqpoint{\td@RuleDist}{\td@RuleDist}}
    \pgfusepath{stroke}
  }

\makeatother

\begin{document}

\begin{center}
\begin{tikzpicture}[x=1mm, y=1mm]
\sffamily
\draw[color=white] (0, 0) -- (296.8, 0) -- (296.8, 209.8);

\begin{scope}[shift={(5, 5)}]

  \draw[tdEdge] (0, 0) -- (287, 0) -- (287, 200) -- (0, 200) -- (0, 0);
  \draw[tdEdge] (112, 0) -- (112, 15) -- (287, 15);
  \node[anchor=west] at (117, 7.5) {\textbf{Description}};

  \small

  \begin{scope}[shift={(40, 180)}]
    \draw[tdEdge] (0, 0) -- (20, 0) -- (20, -40) -- (40, -40) -- (40, -60) -- (0, -60) -- (0, -50) -- (10, -50) -- (10, -15) -- (0, -15) -- (0, 0);
    \draw[tdHelp] (0, 0) -- (-12, 0);
    \draw[tdHelp] (0, -60) -- (-12,-60);
    \draw[tdDim] (-10, 0) -- (-10, -60); \node[anchor=east] at (-10, -30) {\rotatebox{90}{60}};
  \end{scope}

  \begin{scope}[shift={(120, 180)}]
    \draw[tdEdge] (0, 0) -- (30, 0) -- (30, -60) -- (0, -60) -- (0, 0);
    \draw[tdHidden] (0, -15) -- (30, -15);
    \draw[tdEdge] (0, -40) -- (30, -40);
    \draw[tdHidden] (0, -50) -- (30, -50);
    \draw[tdHelp] (30, 0) -- (42, 0);
    \draw[tdHelp] (30, -15) -- (42, -15);
    \draw[tdHelp] (30, -40) -- (42, -40);
    \draw[tdHelp] (30, -50) -- (42, -50);
    \draw[tdHelp] (30, -60) -- (42, -60);
    \draw[tdDim] (40, 0) -- (40, -15); \node[anchor=east] at (40, -7.5) {\rotatebox{90}{15}};
    \draw[tdDim] (40, -40) -- (40, -50); \node[anchor=east] at (40, -45) {\rotatebox{90}{10}};
    \draw[tdDim] (40, -50) -- (40, -60); \node[anchor=east] at (40, -55) {\rotatebox{90}{10}};
  \end{scope}

  \begin{scope}[shift={(40, 80)}]
    \draw[tdEdge] (0, 0) -- (40, 0) -- (40, -30) -- (0, -30) -- (0, 0);
    \draw[tdHidden] (10, 0) -- (10, -30);
    \draw[tdEdge] (20, 0) -- (20, -30);
    \draw[tdHelp] (0, -30) -- (0, -42);
    \draw[tdHelp] (10, -30) -- (10, -42);
    \draw[tdHelp] (20, -30) -- (20, -42);
    \draw[tdHelp] (40, -30) -- (40, -42);
    \draw[tdDim] (0, -40) -- (10, -40); \node[anchor=south] at (5, -40) {10};
    \draw[tdDim] (10, -40) -- (20, -40); \node[anchor=south] at (15, -40) {10};
    \draw[tdDim] (20, -40) -- (40, -40); \node[anchor=south] at (30, -40) {20}; 
    \draw[tdHelp] (0, 0) -- (-12, 0);
    \draw[tdHelp] (0, -30) -- (-12, -30);
    \draw[tdDim] (-10, 0) -- (-10, -30); \node[anchor=east] at (-10, -15) {\rotatebox{90}{30}};
  \end{scope}

\end{scope}

\end{tikzpicture}
\end{center}

\end{document}

which leads to the following output.

Output of the MWE

In general, the best way may be to use an external CAD tool for creating such technical drawings and to embed them as PDF files into a document to be created with LaTeX. However, when dealing with a lot of very small and simple drawings, e.g., in worksheets for students, I would prefer to have everything in one LaTeX file instead of switching between applications.

Therefore, I would like to ask the following questions:

  1. Is there any free font that fulfills EN ISO 3098 and that can be used within LaTeX?
  2. Is there any package that helps to create simple technical drawings according to the DIN/EN ISO standards applicable by defining more powerful commands, e.g., for introducing the dimensioning?
  3. Do you see one or the other approach to improve and/or simplify the above code with minimum effort?
  • Have you tried searching ctan.org and the internet in general for 1 and 2? – Henri Menke Dec 9 '17 at 11:12
  • 1
    I have some experience of using ISOCPEUR.TTF font in LaTeX. There is weaked related topic: https:[link] (tex.stackexchange.com/questions/344392/…). – Konstantin Dec 9 '17 at 15:41
  • 2
    For 3., instead of e.g. \draw[tdDim] (0, -40) -- (10, -40); \node[anchor=south] at (5, -40) {10}; I would use draw[tdDim] (0, -40) -- (10, -40) node[midway,below] {10};, which makes it one less explicit coordinate to figure out. – Torbjørn T. Dec 9 '17 at 15:41
  • 2
    \tikzstyle is deprecated. use \tikzset instead (and make the code less verbose to boot). Use cycle when finishing a closed path to avoid raggedness. Name coordinates rather than hard-coding all locations. Consider using pics for common elements. – cfr Dec 10 '17 at 2:28
  • 1
    Another comment that might simplify your work. Instead of doing (0, 0) -- (287, 0) -- (287, 200) -- (0, 200) -- (0, 0) consider using the -| and |- paths, that go first on the x direction and then on the y direction and viceversa. For example \draw (0, 0) -| (287, 200) -| cycle; – Alex Recuenco Dec 10 '17 at 16:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.