[pstricks] U tube

Manfred Braun manfred.braun at uni-due.de
Fri Feb 19 16:54:56 CET 2016


Dear Orlando,
On my system your code works fine. The only thing is that your hatched frame ends at x = 2.4 instead of x = 2.5 (the second \psframe command). I suppose that this is just a typo.
Nevertheless I would write it differently. There are several ways to do it, for instance

\begin{pspicture}(-6,-6)(6,6)
\pscustom[linestyle=none, fillstyle=hlines]{%
  \psline(-2,0)(-2,2)(-2.5,2)(-2.5,0)
  \psarc(0,0){2.5}{180}{0}
  \psline(2.5,0)(2.5,4)(2,4)(2,0)
  \psarcn(0,0){2}{0}{180}
}
\psset{linewidth=1mm}
\psline(-2,0)(-2,5)
\psline(-2.5,5)(-2.5,0)
\psarc(0,0){2.5}{180}{0}
\psline(2.5,0)(2.5,5)
\psline(2,5)(2,0)
\psarcn(0,0){2}{0}{180}
\psset{linewidth=0.5mm}
\psline[linestyle=dashed, dash=5mm 2mm](-3.5,3)(3.5,3)
\psline(-3.5,2)(-2,2) \psline(2,4)(3.5,4)
\psset{arrowsize=2pt 2, arrowlength=2, arrowinset=0.1}
\psline{<->}(-3.25,2)(-3.25,3) \psline{<->}(3.25,3)(3.25,4)
\Large
\rput[r](-3.5,2.5){$-\Delta z$} \rput[l](3.5,3.5){$\Delta z$}
\end{pspicture}

The \pscustom command allows you to generate an arbitrary closed line composed of straight lines, arcs, or even curves. The enclosed area can be filled in whatever style.
Manfred

> On 19 Feb 2016, at 15:08, orodrig at ualg.pt wrote:
> 
> Dear wizards of PStricks, please enlighten me with your wisdom: I'm trying to create a U shaped tube with the following code:
> 
> \begin{pspicture}(-6,-6)(6,6)
> \psframe[linewidth=0mm,linecolor=white,fillstyle=hlines](-2.5,0)(-2,2)
> \psframe[linewidth=0mm,linecolor=white,fillstyle=hlines](2,0)(2.4,4)
> \psline[linewidth=1mm,linecolor=black]{-}(-2.5,0)(-2.5,5)
> \psline[linewidth=1mm,linecolor=black]{-}(2.5,0)(2.5,5)
> \psline[linewidth=1mm,linecolor=black]{-}(-2,0)(-2,5)
> \psline[linewidth=1mm,linecolor=black]{-}(2,0)(2,5)
> \psline[linewidth=0.5mm,linecolor=black]{-}(-2.5,2)(-2,2)
> \psline[linewidth=0.5mm,linecolor=black]{-}(2,4)(2.5,4)
> \psline[linewidth=0.5mm,linecolor=black,linestyle=dashed,dash=5mm 2mm]{-}(-3.5,3)(3.5,3)
> \psline[linewidth=1mm,linecolor=black]{<->}(-3,2)(-3,3)
> \psline[linewidth=1mm,linecolor=black]{<->}(3,3)(3,4)
> \psarc[linewidth=1mm,linecolor=black,arrows=-,fillstyle=hlines](0,0){2.5}{180}{0}
> \psarc[linewidth=1mm,linecolor=black,arrows=-,fillstyle=solid,fillcolor=white](0,0){2}{180}{0}
> \rput{0}(-4,2.5){\scalebox{1.5}{$-\Delta z$}}
> \rput{0}(4,3.5){\scalebox{1.5}{$\Delta z$}}
> \end{pspicture}
> 
> It does the job, but for some weird reason either gv and acrobat display some "artifacts", like lines with different widths or non-continuous filling of the tube and arc. How can I merge all line and arc segments and do the filling properly? Thanks in advance (whatever the answer is).
> 
> Best regards
> 
> Orlando Camargo Rodríguez
> 
> ----------------------------------------------------------------
> This message was sent using IMP, the Internet Messaging Program.
> 
> 
> _______________________________________________
> PSTricks mailing list
> PSTricks at tug.org
> http://tug.org/mailman/listinfo/pstricks
> archive: http://www.tug.org/pipermail/pstricks/
> 




More information about the PSTricks mailing list