tikz pic scaling with line width

How can I scale also the values of line width in this MWE?

\documentclass[tikz,border=5mm]{standalone}
\begin{document}
\tikzset{
mytest/.pic = {
\draw[blue, line width=0.5cm](0,0)--(90:1.5)--(60:2.5)--(30:3.0);
\draw[white, line width=0.4cm,shorten >=1pt,shorten <=1pt](0,0)--(90:1.5)--(60:2.5)--(30:3.0);
}
}
\begin{tikzpicture}
\pic at (0cm,0cm){mytest};
\pic [scale=5] at (5cm,0cm){mytest};
%HELP GRID LINES:
\draw[very thin, gray!20,step=1cm] (current bounding box.south west) grid (current bounding box.north east);
\end{tikzpicture}
\end{document}


Related question: Tikz and enveloping border

• You are hard-coding the line widths and other distances. What do you expect? – user121799 Mar 27 '18 at 14:09
• @marmot Do you have another option? (the distances are scaled correctly) – Arianna Angeletti Mar 27 '18 at 14:15
• I have not really thought about this, but one way that will work is to use line widths which are a multiple of a macro \mylinewidth, which you could adjust. – user121799 Mar 27 '18 at 14:19

\documentclass{article}
\usepackage{tikz}
\begin{document}
\tikzset{
mytest/.pic = {
\draw[
blue,
scale=#1,
line width=#1*4pt,
double distance between line centers=#1*8pt,
double,
shorten >=1pt, shorten <=1pt]
(0,0)--(90:1.5)--(60:2.5)--(30:3.0);
}
}
\begin{tikzpicture}
\pic at (0cm,0cm){mytest={1}};
\pic at (5cm,0cm) {mytest=4};
%HELP GRID LINES:
\draw[very thin, gray!20,step=1cm] (current bounding box.south west) grid (current bounding box.north east);
\end{tikzpicture}
\end{document}