Consider the following example:
\documentclass{article}
\usepackage{pst-coil}
\psset{dimen = middel}
\def\frekvensgenerator[#1,#2](#3,#4){
\psframe(#3,#4)(!#3 #1 add #4 #2 add)
\psline(!#3 #4 #2 2 div add)(!#3 #1 add #4 #2 2 div add)
\psframe(!#3 #1 2 div add 0.2 sub #4)(!#3 #1 2 div add 0.2 add #4 #2 2 div add)
\rput{270}(!#3 #1 2 div add #4){%
\psCoil[
linewidth = 1.5pt,
coilwidth = \spolevidde,
coilheight = \spolehoejde,
coilarm = 0
]{0}{\drejning}%
}
\psframe[
fillstyle = solid,
fillcolor = yellow!70
](!#3 #1 2 div add 0.25 sub #4 \drejning\space 480 div \spolevidde\space mul \spolehoejde\space mul sub 1 sub)(!#3 #1 2 div add 0.25 add #4 \drejning\space 480 div \spolevidde\space mul \spolehoejde\space mul sub)
\psline(!#3 #1 2 div add #4 \drejning\space 480 div \spolevidde\space mul \spolehoejde\space mul sub 1 sub)(!#3 #1 2 div add #4 \drejning\space 480 div \spolevidde\space mul \spolehoejde\space mul sub 3 sub)
}
\begin{document}
\def\spolevidde{0.5}
\def\spolehoejde{0.5}
\begin{pspicture}(3.5,6.2)
\def\drejning{810}
\frekvensgenerator[1.5,1.5](0,4.7)
\def\drejning{3330}
\frekvensgenerator[1.5,1.5](2,4.7)
\end{pspicture}
\end{document}

As can be seen, the weight is not connected to the same point on the spring (modulo an integer number of windings) if I change the total numbers of degrees that the spring is twisted.
How do I accomplish this?
P.S. If the code can be made simpler (which it almost certainly can), you are very welcome to improve it. :)




480... – Werner Dec 28 '13 at 07:29:)(Code improvement is more than welcome.) – Svend Tveskæg Dec 28 '13 at 10:22dx=height x width. – Dec 28 '13 at 10:41