I would like some help turning this code for a stickman into a Tikz pic.
\documentclass[11pt]{scrartcl}
\usepackage{tikz}
\usetikzlibrary{shapes.callouts}
%--------------------
\usepackage{amssymb} %maths
\usepackage{amsmath} %maths
\usepackage[utf8]{inputenc} %useful to type directly diacritic characters
\usepackage[siunitx,american, RPvoltages]{circuitikz}
\usetikzlibrary{positioning}
\usepackage{pgfplots}
\usetikzlibrary{arrows,shapes,graphs}
\usepackage{physics}
\usepackage{ifthen}
\usepackage{cancel}
\usepackage[portuges]{babel}
%%
\usepackage[electronic]{ifsym}
\usepackage{xstring}
\usepackage{xcolor}
\usepackage{marvosym} %Smiley
\usepackage{tikzsymbols}%\Cooley
\usepackage{ifthen}
\usepackage{caption}
\pgfplotsset{compat=newest}
%%%%%%%%%%%5
\newcommand{\stickman}[9] % all parameters should be between -1 and 1.
% \stickman{Char}{rightArmpit}{rightElbow}{rightLeg}{rightKnee} {leftArmpit}{lefttElbow}{leftLeg}{lefttKnee}
{
\def\diaHead{0.3}
\def\rap{#2} \def\relb{#3} \def\lap{#6} \def\lelb{#7}
\def\rleg{#4} \def\rknee{#5} \def\lleg{#8} \def\lknee{#9}
\def\phead{(180-90*\rap+90*\lap)/2-90}
\draw[-{Ellipse[line cap=round,length=1.25mm]},thick] (0,0) to[short] ++(-90+180*\lap:2*\diaHead) to ++(180*\lelb+180*\lap-90:2*\diaHead);
\draw[-{Ellipse[line cap=round,length=1.25mm]},thick] (0,0) to[short] ++(270-180*\rap:2*\diaHead) to ++(270-180*\relb-180*\rap:2*\diaHead);
\draw[line width=1.25pt, line cap=mitter] (0,0) to ++(0,-3*\diaHead) node[inner sep=0pt](v){};
\draw[-Bar,thick] (v) to[short] ++(-85+170*\lleg:2*\diaHead) to[short] ++(-85+170*\lknee+170*\lleg:2*\diaHead);
\draw[-Bar,thick] (v) to[short] ++(-95-170*\rleg:2*\diaHead) to[short] ++(-95-170*\rknee-170*\rleg:2*\diaHead);
\node[rotate=\phead, scale=1] at (0,0){\rotatebox[origin=c]{0}{\raisebox{1.0\height}{#1}} } ;
}
\begin{document}
\begin{tikzpicture}[]
\draw[step=2mm] [help lines, black!10] (0,-5) grid (10,5);
\draw[step=10mm] [help lines, blue!30] (0,-5) grid (10,5);
\begin{scope}[xshift=4cm,yshift=4cm,xscale=1]
\stickman{\Smiley{}}{0.1}{0.5}{-0.2}{0.1} {0.1}{0.5}{0}{0}
\end{scope}
\begin{scope}[xshift=2cm,yshift=4cm,scale=0.3]
\stickman{\Smiley{}}{0.5}{0.15}{0}{0} {0.45}{0.75}{0}{0}
\end{scope}
\begin{scope}[xshift=4cm,yshift=0.5cm,xscale=1, color=gray]
\stickman{\Smiley{}}{0.1}{0}{0}{0} {0.1}{0.5}{0}{0}
\end{scope}
\begin{scope}[xshift=5cm,yshift=0.4cm,xscale=1, color=gray]
\stickman{\Smiley{}}{0.25}{-0.4}{0}{0.25} {0.1}{0.5}{0.25}{-0.5}
\end{scope}
\begin{scope}[xshift=6cm,yshift=0.1cm,xscale=1]
\stickman{\Tongey{}}{0.25}{-0.4}{0}{0.5} {0.4}{0.15}{0.5}{-0.5}
\end{scope}
\draw[ thick] (7.5,-2) node[ground](){} to[short]++(0,1) to[nopb] ++(0,2) to[cute inductor]++(0,2) node[vcc](){$+V_{CC}$};
\end{tikzpicture}
\end{document}



\pv#1to yield\pgfkeysvalueof{/tikz/stickman/#1}}. Since this\defis inside another\defof thepic, we need to double the number of#. (One way to think about this is that otherwise the argument of\defwill be indistinguishable from the argument of thepic,#1.) I am using this shortcut all over, see e.g. here. Otherwise one would always have to type things like\pgfkeysvalueof{/tikz/stickman/left knee}. – Apr 26 '20 at 22:45circleshape nodes are safe, and the others can be put in a\savebox. ;-) – Apr 27 '20 at 09:53groundis safe, the other side of the switch not at all, by the way ;-P;-P) – Rmano Apr 27 '20 at 09:59