5

I have a technical drawing of a mechanical setup which I would like to draw in either TikZ or PSTricks. My experience with these two packages is very limited.

A "MWE" of the drawing is shown in the following, all units are in meters. I would like to make a drawing which is true to the various scales. I think one way to achieve this is simply to use coordinates to label the various positions and lengths, but I am very interested in reading your comments.

enter image description here

My questions are:

  1. Is this even possible?
  2. Which package would be best for this purpose? And what strategy can I use to achieve this?
5

Adapt the following code. It is very easy and basic.

\documentclass[pstricks,border=12pt]{standalone}% set border=0pt at the final stage
\usepackage{pst-node}
\psset
{
    dimen=middle,
    offset=.2,
    arrows=|*-|*,
    unit=2cm,% set it to 100cm if you want 1 scale = 100cm = 1m
}

\usepackage{siunitx}
\begin{document}
\begin{pspicture}[showgrid=false](5,1.25)% set showgrid=false at the final stage
    \psframe(1,1)
    \psframe(1,.25)(4,.75)
    \pscircle(4.5,.5){.5}
    \pcline(0,1)(1,1)\naput{\SI{1}{\m}}
    \pcline[offset=0]{<->}(4,.5)(4.5,.5)\naput{\SI{0.5}{\m}}
\end{pspicture}
\end{document}

enter image description here

  • Is it possible to add an offset such that the $x$-axis runs from (e.g.) -2..5? – BillyJean Oct 5 '13 at 19:00
  • 1
    @BillyJean: Yes. It is possible by changing the pspicture domain, for example, \begin{pspicture}(-2.5,0)(5,1.25) instead of \begin{pspicture}(5,1.25). – kiss my armpit Oct 5 '13 at 19:08
2

With TikZ

\documentclass[]{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}[scale=2]
\draw (0,0) rectangle (1,1) node at (0.5,0.9) {1} node at (0.1,0.5) {1};
\draw (1,0.25) rectangle (4,0.75) node at (1.2,0.5) {0.5} node at (2.5,0.9){3};
\draw (5,0.5) circle (1);
\draw[<->] (4,0.5)--(5,0.5) node at (4.5,0.6){1m};
\end{document}

The result

enter image description here

Your Answer

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

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