My solution assumes, that there is a \ character at the beginning of the length register name, it is not tested for tikz etc.
\documentclass[a4paper,10pt]{article}
\usepackage[utf8]{inputenc}
\usepackage{etoolbox}%
\usepackage{ifmtarg}%
\makeatletter
\newcommand*{\otherprovidelength}[2]{%
\begingroup
\escapechar\m@ne
\xdef\@gtempa{\string#1}%
\endgroup
\@ifundefined{\@gtempa}%
{\newskip#1%
#1=#2}% Assign the 2nd argument.
{}%
}
\makeatother
\providecommand{\providelength}[2]{%
\ifdeflength{#1}{% It is already defined!
}{% Not defined, so define it!
\newlength{#1}%
}%
\setlength{#1}{#2}%
}%
\makeatletter
\providecommand{\ProvideLength}[2][]{%
% Check, if the command is already defined, if not, then define it!
\ifdeflength{#2}{% It is already defined!
\GenericWarning{}{Warning: Length #2 already defined!!!!!!!!} % Optional
}{% Not defined, so define it!
\newlength{#2}%
}%
\@ifmtarg{#1}{% is 1st argument empty -> do not set the length at all!
}{% Set the length to the value of the 1st argument.
\setlength{#2}{#1}%
}% End of \@ifmtarg
}% End of \providecommand
\makeatother
\begin{document}
\providelength{\ltest}{0.01pt}
\the\ltest \par
% Some testing
\addtolength{\ltest}{0.05pt}
\the\ltest \par
\ProvideLength[0.17pt]{\ltesttwo}
\ProvideLength{\lyetanotherlength} % initialized to 0.0pt if undefined before
\the\ltesttwo \par
\the\lyetanotherlength
\end{document}
EDIT:
I added another command \ProvideLength which takes the length value as optional first argument and the length register names as 2nd argument. It will also generate a warning if the length register already exists.
I changed Simon's command to \otherprovidelength and added the missing 2nd argument as well as the assignment to the skip register.
tikzparse those values, so you could just store them in a macro, no need for a length. Does'tetoolboxprovide something similar? – daleif Mar 13 '14 at 11:52etoolboxwould provide it, but it doesn't not, as far as I know. – Mar 13 '14 at 12:07