# Calculations in pstricks swallows the spaces after a command [duplicate]

The following MWE works fine when plotting a square using pstricks with xelatex.

 \documentclass{article}
\usepackage{pstricks}
\begin{document}
\def\x{0 } % Notice that there MUST be a white space after 0
\end{document}


The problems is, when I try to make the \psframe in a whiledo loop with a counter, the space after a command is swallowed. Look at the following MWE:

 \documentclass{article}
\usepackage{pstricks}
\newcounter{Y}
\setcounter{Y}{1}
\begin{document}
\def\x{0 }
\def\Y{\theY  }
\end{document}


When compile with the command xelatex test where test.tex is the name of the source file, it throws the following error:

 Using PSTricks configuration for XeTeX+xdvipdfmx
))) (/usr/share/texlive/texmf-dist/tex/generic/pstricks/pst-fp.tex))
(./test.aux) [1] (./test.aux)Error: /undefined in 1add
Operand stack:
--nostringval--   0.0   true   0.0   28.4527   1   1


Looks like after expanding \Y in \psframe, the second coordinate becomes (!1 0 add 1 1add) where the white space between the last 1 and add is swallowed.

How can the value of a counter be used in the coordinate calculations in pstricks? Thanks.

\psframe(\x, \Y)(!1 \x\space add 1 \Y\space add}