<div dir="ltr"><div class="gmail_default" style="font-size:small">Hi all,</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">I'm trying to get a png file out of my polydata.</div><div class="gmail_default" style="font-size:small">(I take several pictures from different angles.)</div><div class="gmail_default" style="font-size:small">but sometimes the outcome is clipped.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">this is my code</div><div class="gmail_default"><pre style="font-size:small;margin-top:0px;margin-bottom:0px"><span style="color:#df41df">vtkSmartPointer</span><span style="color:#000000"><</span><span style="color:#df41df">vtkSTLReader</span><span style="color:#000000">></span><span style="color:#c0c0c0"> </span><span style="color:#5582ff">reader</span><span style="color:#c0c0c0"> </span><span style="color:#000000">=</span><span style="color:#c0c0c0"> </span><span style="color:#df41df">vtkSmartPointer</span><span style="color:#000000"><</span><span style="color:#df41df">vtkSTLReader</span><span style="color:#000000">>::</span><span style="color:#ff8200">New</span><span style="color:#000000">();</span></pre>
<pre style="font-size:small;margin-top:0px;margin-bottom:0px"><span style="color:#5582ff">reader</span><span style="color:#000000">-></span><span style="font-style:italic;color:#fa821e">SetFileName</span><span style="color:#000000">(</span><span style="color:#189494">name</span><span style="color:#000000">);</span></pre>
<pre style="font-size:small;margin-top:0px;margin-bottom:0px"><span style="color:#5582ff">reader</span><span style="color:#000000">-></span><span style="font-style:italic;color:#fa821e">Update</span><span style="color:#000000">();</span></pre>
<pre style="font-size:small;margin-top:0px;margin-bottom:0px"><span style="color:#5582ff">inputPolyData</span><span style="color:#c0c0c0"> </span><span style="color:#000000">=</span><span style="color:#c0c0c0"> </span><span style="color:#5582ff">reader</span><span style="color:#000000">-></span><span style="color:#ff8200">GetOutput</span><span style="color:#000000">();</span></pre><pre style="margin-top:0px;margin-bottom:0px"><pre style="font-size:small;margin-top:0px;margin-bottom:0px"><span style="color:#df41df">vtkSmartPointer</span><span style="color:#000000"><</span><span style="color:#df41df">vtkPolyDataMapper</span><span style="color:#000000">></span><span style="color:#c0c0c0"> </span><span style="color:#5582ff">inputPolyMapper</span><span style="color:#c0c0c0"> </span><span style="color:#000000">=</span><span style="color:#c0c0c0"> </span><span style="color:#df41df">vtkSmartPointer</span><span style="color:#000000"><</span><span style="color:#df41df">vtkPolyDataMapper</span><span style="color:#000000">>::</span><span style="color:#ff8200">New</span><span style="color:#000000">();</span></pre><pre style="font-size:small;margin-top:0px;margin-bottom:0px"><span style="color:#5582ff">inputPolyMapper</span><span style="color:#000000">-></span><span style="color:#ff8200">SetInputData</span><span style="color:#000000">(</span><span style="color:#5582ff">inputPolyData</span><span style="color:#000000">);</span></pre><pre style="font-size:small;margin-top:0px;margin-bottom:0px"><span style="color:#df41df">vtkSmartPointer</span><span style="color:#000000"><</span><span style="color:#df41df">vtkActor</span><span style="color:#000000">></span><span style="color:#c0c0c0"> </span><span style="color:#5582ff">actor</span><span style="color:#c0c0c0"> </span><span style="color:#000000">=</span><span style="color:#c0c0c0"> </span><span style="color:#df41df">vtkSmartPointer</span><span style="color:#000000"><</span><span style="color:#df41df">vtkActor</span><span style="color:#000000">>::</span><span style="color:#ff8200">New</span><span style="color:#000000">();</span></pre><pre style="font-size:small;margin-top:0px;margin-bottom:0px"><span style="color:#5582ff">actor</span><span style="color:#000000">-></span><span style="font-style:italic;color:#fa821e">SetMapper</span><span style="color:#000000">(</span><span style="color:#5582ff">inputPolyMapper</span><span style="color:#000000">);</span></pre><pre style="font-size:small;margin-top:0px;margin-bottom:0px"><span style="font-family:arial,sans-serif;color:rgb(223,65,223)">vtkSmartPointer</span><span style="font-family:arial,sans-serif;color:rgb(0,0,0)"><</span><span style="font-family:arial,sans-serif;color:rgb(223,65,223)">vtkRenderer</span><span style="font-family:arial,sans-serif;color:rgb(0,0,0)">></span><span style="font-family:arial,sans-serif;color:rgb(192,192,192)"> </span><span style="font-family:arial,sans-serif;color:rgb(85,130,255)">renderer</span><span style="font-family:arial,sans-serif;color:rgb(192,192,192)"> </span><span style="font-family:arial,sans-serif;color:rgb(0,0,0)">=</span><span style="font-family:arial,sans-serif;color:rgb(192,192,192)"> </span><span style="font-family:arial,sans-serif;color:rgb(223,65,223)">vtkSmartPointer</span><span style="font-family:arial,sans-serif;color:rgb(0,0,0)"><</span><span style="font-family:arial,sans-serif;color:rgb(223,65,223)">vtkRenderer</span><span style="font-family:arial,sans-serif;color:rgb(0,0,0)">>::</span><span style="font-family:arial,sans-serif;color:rgb(255,130,0)">New</span><span style="font-family:arial,sans-serif;color:rgb(0,0,0)">();</span><br></pre><pre style="font-size:small;margin-top:0px;margin-bottom:0px"><span style="color:#df41df">vtkSmartPointer</span><span style="color:#000000"><</span><span style="color:#df41df">vtkRenderWindow</span><span style="color:#000000">></span><span style="color:#c0c0c0"> </span><span style="color:#5582ff">renderWindow</span><span style="color:#c0c0c0"> </span><span style="color:#000000">=</span><span style="color:#c0c0c0">  </span><span style="color:#df41df">vtkSmartPointer</span><span style="color:#000000"><</span><span style="color:#df41df">vtkRenderWindow</span><span style="color:#000000">>::</span><span style="color:#ff8200">New</span><span style="color:#000000">();</span></pre><pre style="font-size:small;margin-top:0px;margin-bottom:0px"><span style="color:#df41df">vtkSmartPointer</span><span style="color:#000000"><</span><span style="color:#df41df">vtkRenderWindowInteractor</span><span style="color:#000000">></span><span style="color:#c0c0c0"> </span><span style="color:#5582ff">interactor</span><span style="color:#c0c0c0"> </span><span style="color:#000000">=</span><span style="color:#c0c0c0">  </span><span style="color:#df41df">vtkSmartPointer</span><span style="color:#000000"><</span><span style="color:#df41df">vtkRenderWindowInteractor</span><span style="color:#000000">>::</span><span style="color:#ff8200">New</span><span style="color:#000000">();</span></pre><pre style="font-size:small;margin-top:0px;margin-bottom:0px"><span style="color:#5582ff">interactor</span><span style="color:#000000">-></span><span style="color:#ff8200">SetRenderWindow</span><span style="color:#000000">(</span><span style="color:#5582ff">renderWindow</span><span style="color:#000000">);</span></pre><pre style="font-size:small;margin-top:0px;margin-bottom:0px"><span style="color:#df41df">vtkSmartPointer</span><span style="color:#000000"><</span><span style="color:#df41df">vtkAxesActor</span><span style="color:#000000">></span><span style="color:#c0c0c0"> </span><span style="color:#5582ff">axes</span><span style="color:#c0c0c0"> </span><span style="color:#000000">=</span></pre><pre style="font-size:small;margin-top:0px;margin-bottom:0px"><span style="color:#df41df">vtkSmartPointer</span><span style="color:#000000"><</span><span style="color:#df41df">vtkAxesActor</span><span style="color:#000000">>::</span><span style="color:#ff8200">New</span><span style="color:#000000">();</span></pre><pre style="font-size:small;margin-top:0px;margin-bottom:0px"><span style="font-family:arial,sans-serif;color:rgb(223,65,223)">vtkSmartPointer</span><span style="font-family:arial,sans-serif;color:rgb(0,0,0)"><</span><span style="font-family:arial,sans-serif;color:rgb(223,65,223)">vtkOrientationMarkerWidget</span><span style="font-family:arial,sans-serif;color:rgb(0,0,0)">></span><span style="font-family:arial,sans-serif;color:rgb(192,192,192)"> </span><span style="font-family:arial,sans-serif;color:rgb(85,130,255)">axisWidget</span><span style="font-family:arial,sans-serif;color:rgb(192,192,192)"> </span><span style="font-family:arial,sans-serif;color:rgb(0,0,0)">=</span><span style="font-family:arial,sans-serif;color:rgb(192,192,192)"> </span><span style="font-family:arial,sans-serif;color:rgb(223,65,223)">vtkSmartPointer</span><span style="font-family:arial,sans-serif;color:rgb(0,0,0)"><</span><span style="font-family:arial,sans-serif;color:rgb(223,65,223)">vtkOrientationMarkerWidget</span><span style="font-family:arial,sans-serif;color:rgb(0,0,0)">>::</span><span style="font-family:arial,sans-serif;color:rgb(255,130,0)">New</span><span style="font-family:arial,sans-serif;color:rgb(0,0,0)">();</span><br></pre><pre style="font-size:small;margin-top:0px;margin-bottom:0px"><span style="color:#5582ff">axisWidget</span><span style="color:#000000">-></span><span style="color:#ff8200">SetOutlineColor</span><span style="color:#000000">(</span><span style="color:#000080">0.9300</span><span style="color:#000000">,</span><span style="color:#c0c0c0"> </span><span style="color:#000080">0.5700</span><span style="color:#000000">,</span><span style="color:#c0c0c0"> </span><span style="color:#000080">0.1300</span><span style="color:#000000">);</span></pre><pre style="font-size:small;margin-top:0px;margin-bottom:0px"><span style="color:#5582ff">axisWidget</span><span style="color:#000000">-></span><span style="font-style:italic;color:#fa821e">SetOrientationMarker</span><span style="color:#000000">(</span><span style="color:#5582ff">axes</span><span style="color:#000000">);</span></pre><pre style="font-size:small;margin-top:0px;margin-bottom:0px"><span style="font-family:arial,sans-serif;color:rgb(85,130,255)">axisWidget</span><span style="font-family:arial,sans-serif;color:rgb(0,0,0)">-></span><span style="font-family:arial,sans-serif;font-style:italic;color:rgb(250,130,30)">SetInteractor</span><span style="font-family:arial,sans-serif;color:rgb(0,0,0)">(</span><span style="font-family:arial,sans-serif;color:rgb(85,130,255)">interactor</span><span style="font-family:arial,sans-serif;color:rgb(0,0,0)">);</span><br></pre><pre style="font-size:small;margin-top:0px;margin-bottom:0px"><span style="font-family:arial,sans-serif;color:rgb(85,130,255)">renderWindow</span><span style="font-family:arial,sans-serif;color:rgb(0,0,0)">-></span><span style="font-family:arial,sans-serif;font-style:italic;color:rgb(250,130,30)">AddRenderer</span><span style="font-family:arial,sans-serif;color:rgb(0,0,0)">(</span><span style="font-family:arial,sans-serif;color:rgb(85,130,255)">renderer</span><span style="font-family:arial,sans-serif;color:rgb(0,0,0)">);</span><br></pre><pre style="font-size:small;margin-top:0px;margin-bottom:0px"><span style="color:#5582ff">axisWidget</span><span style="color:#000000">-></span><span style="font-style:italic;color:#fa821e">SetEnabled</span><span style="color:#000000">(</span><span style="color:#000080">1</span><span style="color:#000000">);</span></pre><pre style="font-size:small;margin-top:0px;margin-bottom:0px"><span style="color:#5582ff">axisWidget</span><span style="color:#000000">-></span><span style="font-style:italic;color:#fa821e">InteractiveOff</span><span style="color:#000000">();</span></pre><pre style="font-size:small;margin-top:0px;margin-bottom:0px"><span style="color:#5582ff">renderWindow</span><span style="color:#000000">-></span><span style="font-style:italic;color:#fa821e">SetOffScreenRendering</span><span style="color:#000000">(</span><span style="color:#000080">1</span><span style="color:#000000">);</span></pre><pre style="font-size:small;margin-top:0px;margin-bottom:0px"><span style="color:#5582ff">renderer</span><span style="color:#000000">-></span><span style="color:#ff8200">AddActor</span><span style="color:#000000">(</span><span style="color:#5582ff">actor</span><span style="color:#000000">);</span></pre><pre style="font-size:small;margin-top:0px;margin-bottom:0px"><span style="font-family:arial,sans-serif;color:rgb(223,65,223)">vtkSmartPointer</span><span style="font-family:arial,sans-serif;color:rgb(0,0,0)"><</span><span style="font-family:arial,sans-serif;color:rgb(223,65,223)">vtkLightKit</span><span style="font-family:arial,sans-serif;color:rgb(0,0,0)">></span><span style="font-family:arial,sans-serif;color:rgb(192,192,192)"> </span><span style="font-family:arial,sans-serif;color:rgb(85,130,255)">lightKit</span><span style="font-family:arial,sans-serif;color:rgb(192,192,192)"> </span><span style="font-family:arial,sans-serif;color:rgb(0,0,0)">=</span><span style="font-family:arial,sans-serif;color:rgb(192,192,192)"> </span><span style="font-family:arial,sans-serif;color:rgb(223,65,223)">vtkSmartPointer</span><span style="font-family:arial,sans-serif;color:rgb(0,0,0)"><</span><span style="font-family:arial,sans-serif;color:rgb(223,65,223)">vtkLightKit</span><span style="font-family:arial,sans-serif;color:rgb(0,0,0)">>::</span><span style="font-family:arial,sans-serif;color:rgb(255,130,0)">New</span><span style="font-family:arial,sans-serif;color:rgb(0,0,0)">();</span><br></pre><pre style="font-size:small;margin-top:0px;margin-bottom:0px"><span style="font-family:arial,sans-serif;color:rgb(85,130,255)">lightKit</span><span style="font-family:arial,sans-serif;color:rgb(0,0,0)">-></span><span style="font-family:arial,sans-serif;color:rgb(255,130,0)">AddLightsToRenderer</span><span style="font-family:arial,sans-serif;color:rgb(0,0,0)">(</span><span style="font-family:arial,sans-serif;color:rgb(85,130,255)">renderer</span><span style="font-family:arial,sans-serif;color:rgb(0,0,0)">);</span><br></pre><pre style="font-size:small;margin-top:0px;margin-bottom:0px"><span style="color:#5582ff">renderer</span><span style="color:#000000">-></span><span style="color:#ff8200">ResetCamera</span><span style="color:#000000">();</span></pre><pre style="font-size:small;margin-top:0px;margin-bottom:0px"><span style="font-family:arial,sans-serif;color:rgb(85,130,255)">renderWindow</span><span style="font-family:arial,sans-serif;color:rgb(0,0,0)">-></span><span style="font-family:arial,sans-serif;font-style:italic;color:rgb(250,130,30)">Render</span><span style="font-family:arial,sans-serif;color:rgb(0,0,0)">();</span><br></pre><pre style="font-size:small;margin-top:0px;margin-bottom:0px"><span style="color:#df41df">vtkSmartPointer</span><span style="color:#000000"><</span><span style="color:#df41df">vtkWindowToImageFilter</span><span style="color:#000000">></span><span style="color:#c0c0c0"> </span><span style="color:#5582ff">windowToImageFilter</span><span style="color:#c0c0c0"> </span><span style="color:#000000">=</span></pre><pre style="font-size:small;margin-top:0px;margin-bottom:0px"><span style="color:#df41df">vtkSmartPointer</span><span style="color:#000000"><</span><span style="color:#df41df">vtkWindowToImageFilter</span><span style="color:#000000">>::</span><span style="color:#ff8200">New</span><span style="color:#000000">();</span></pre><pre style="font-size:small;margin-top:0px;margin-bottom:0px"><span style="color:#5582ff">windowToImageFilter</span><span style="color:#000000">-></span><span style="color:#ff8200">SetInput</span><span style="color:#000000">(</span><span style="color:#5582ff">renderWindow</span><span style="color:#000000">);</span></pre><pre style="font-size:small;margin-top:0px;margin-bottom:0px"><span style="color:#5582ff">windowToImageFilter</span><span style="color:#000000">-></span><span style="font-style:italic;color:#fa821e">SetMagnification</span><span style="color:#000000">(</span><span style="color:#000080">3</span><span style="color:#000000">);</span></pre><pre style="font-size:small;margin-top:0px;margin-bottom:0px"><span style="color:#5582ff">windowToImageFilter</span><span style="color:#000000">-></span><span style="color:#ff8200">SetInputBufferTypeToRGBA</span><span style="color:#000000">();</span><span style="color:#c0c0c0"> </span></pre><pre style="font-size:small;margin-top:0px;margin-bottom:0px"><span style="font-family:arial,sans-serif;color:rgb(85,130,255)">windowToImageFilter</span><span style="font-family:arial,sans-serif;color:rgb(0,0,0)">-></span><span style="font-family:arial,sans-serif;font-style:italic;color:rgb(250,130,30)">Update</span><span style="font-family:arial,sans-serif;color:rgb(0,0,0)">();</span></pre><pre style="font-size:small;margin-top:0px;margin-bottom:0px"><span style="font-family:arial,sans-serif;color:rgb(0,0,0)"><br></span></pre><pre style="margin-top:0px;margin-bottom:0px"><font color="#000000" face="arial, sans-serif">for example I receive this picture for a rectangle:</font></pre><pre style="font-size:small;margin-top:0px;margin-bottom:0px"><font color="#000000" face="arial, sans-serif"><br></font></pre><pre style="font-size:small;margin-top:0px;margin-bottom:0px"><img src="cid:ii_14ef75d2b91cb355" alt="Inline image 1" width="544" height="544"><br></pre><pre style="font-size:small;margin-top:0px;margin-bottom:0px"><br></pre><pre style="font-size:small;margin-top:0px;margin-bottom:0px">Can someone assist?</pre><pre style="font-size:small;margin-top:0px;margin-bottom:0px"><br></pre><pre style="font-size:small;margin-top:0px;margin-bottom:0px">Thanks,</pre><pre style="font-size:small;margin-top:0px;margin-bottom:0px"><span style="font-family:arial,sans-serif">Gilad.</span><b style="font-family:arial,sans-serif"> </b></pre></pre></div>
</div>