# How to use \Pnodecount when there are more than one \curvepnodes invocations?

Assume that there are 2 \curvepnodes macros invoked as follows.

\documentclass[pstricks,border=12pt]{standalone}
\usepackage{pst-node,pst-plot}

\begin{document}
\begin{pspicture}[showgrid](-4,-3)(4,3)
\curvepnodes[plotpoints=6]{0}{360}{.5 t PtoC}{I}
\def\points{}%
\multido{\i=0+1}{\Pnodecount}{\xdef\points{\points (I\i)(O\i)}}
\expandafter\pspolygon*[linecolor=red]\points
\end{pspicture}
\end{document}

1. How to use \Pnodecount in this case?
2. If plotpoints in the first is different from the last, how to reference to one of the \Pnodecount by a root node name?
3. Bonus question: How to make \expandafter\pspolygon*[linecolor=red]\points functional?

there is no \Pnodecount! The name is build by the forth parameter: \Inodecount and \Onodecount. However, I do not know what exactly you want to draw.

\documentclass[pstricks,border=12pt]{standalone}
\usepackage{pst-node,pst-plot}

\begin{document}
\begin{pspicture}[showgrid](-4,-3)(4,3)
\curvepnodes[plotpoints=6]{0}{360}{.5 t PtoC}{I}
\def\points{}%
\multido{\i=0+1}{\Inodecount}{\xdef\points{\points (I\i)(O\i)}}
\psset{linecolor=red}
\expandafter\pspolygon\expandafter*\points
\end{pspicture}
\end{document}


with pst-poly:

\documentclass{article}
\usepackage{pst-poly}

\begin{document}
foo \PstStarFive*[unit=2,linecolor=red] bar
\end{document}

• that is not easy in fact of the optional argument. Use \psset{linecolor=red,fillstyle=solid,fillcolor=\pslinecolor} instead of the star. – user2478 Jun 26 '13 at 6:47
• for a star simply use \multido{\iI=0+1}{\Inodecount}{\xdef\points{\points (I\iI)(O\iI)}}. However, use pst-poly instead – user2478 Jun 26 '13 at 6:48
• How about \expandafter\expandafter\expandafter\pspolygon\expandafter*\points – A.Ellett Jun 26 '13 at 6:50
• \expandafter\pspolygon\expandafter*\points is enough, but makes no sense, you have to set the linecolor anyway. – user2478 Jun 26 '13 at 6:53

I'm not sure what you're trying to do with \Pnodecount since you already know how many nodes you're placing along the curve. Also, I would do my own kind of work-around for the polygon.

Here's a MWE

\documentclass[pstricks,border=12pt]{standalone}
\usepackage{pst-node,pst-plot}
\psset{unit=1in}
\begin{document}

\def\mymaxvalue{6}
\begin{pspicture}[showgrid](-2,-2)(2,2)

\def\circI{ 0.5 t PtoC }
%    \psparametricplot[linecolor=blue]{0}{360}{  \circI  }
\curvepnodes[plotpoints=\mymaxvalue]{0}{360}{ \circI }{I}

\def\circQ{   1  t 36 add PtoC }
%    \psparametricplot[linecolor=red]{0}{360}{ \circQ  }
\curvepnodes[plotpoints=\mymaxvalue]{0}{360}{ \circQ }{Q}

\pscustom[fillcolor=red,fillstyle=solid,linecolor=red]{
\multido{\i=0+1}{\Inodecount}{
%      \psdot(I\i)\uput[75](I\i){$I_\i$}
%      \psdot(Q\i)\uput[75](Q\i){$Q_\i$}
\psline(I\i)(Q\i)
\ifnum\i<\number\numexpr\mymaxvalue-1\relax\relax\psline(Q\i)(I\number\numexpr\i+1\relax)\fi
}}
\end{pspicture}

\end{document}


The \Pnodecount macro is not strictly speaking \Pnodecount. You defined two collections of nodes. So, there are two macros: \Inodecount and \Qnodecount (I avoid using O because I can never tell when I've mistyped it as a zero, but in your example this would be \Onodecount). This particular point is not all that clear from the documentation, you need to look into the pst-node.tex file to see how it's defined there.

Sorry, forgot that you wanted it filled.

• Sorry. Using \pscustom is not my interest. – kiss my armpit Jun 26 '13 at 6:57