<div dir="ltr">Hi all,<div><br></div><div>I&#39;ve been trying to export a scene using vtkGL2PSExporter. It works sometimes (maybe 80%), but not always. Moreover, I&#39;m not able to reproduce the pattern that causes it not to work.</div>


<div><br></div><div>Furthermore, after succeeding in exporting the .svg picture, I loose the control of the figure&#39;s interactor, so I can&#39;t rotate it anymore.</div><div><br></div><div>The scenario is the following: When right-click on the figure a menu opens with an option to &quot;Export...&quot;. It opens a Dialog which allows us to specify the format, the name and the directory where we want to save the .svg.<br>


</div><div><br></div><div><div>I attach you the detailed code.<br></div><div><br></div><div>Thanks in advance,</div><div><br></div><div>Laura</div><div><br></div><div><div><span style="white-space:pre-wrap">        </span>@Override</div>


<div><span style="white-space:pre-wrap">        </span>public void mousePressed(MouseEvent e) {</div><div><span style="white-space:pre-wrap">                </span>if (ren.VisibleActorCount() == 0)</div><div>            return;</div><div>
        Lock();</div><div>        rw.SetDesiredUpdateRate(5.0);</div><div>        lastX = e.getX();</div><div>        lastY = e.getY();</div><div><br></div><div>        ctrlPressed = (e.getModifiers() &amp; InputEvent.CTRL_MASK) == InputEvent.CTRL_MASK ? 1 : 0;</div>


<div>        shiftPressed = (e.getModifiers() &amp; InputEvent.SHIFT_MASK) == InputEvent.SHIFT_MASK ? 1 : 0;</div><div><br></div><div>        iren.SetEventInformationFlipY(e.getX(), e.getY(), ctrlPressed, shiftPressed, &#39;0&#39;, 0, &quot;0&quot;);</div>


<div><br></div><div>        if ((e.getModifiers() &amp; InputEvent.BUTTON1_MASK) == InputEvent.BUTTON1_MASK) {</div><div>            iren.LeftButtonPressEvent();</div><div>        } else if ((e.getModifiers() &amp; InputEvent.BUTTON2_MASK) == InputEvent.BUTTON2_MASK) {</div>


<div>            iren.MiddleButtonPressEvent();</div><div>        } else if ((e.getModifiers() &amp; InputEvent.BUTTON3_MASK) == InputEvent.BUTTON3_MASK) {</div><div><span style="white-space:pre-wrap">                        </span>JPopupMenu popup = new JPopupMenu();</div>


<div><span style="white-space:pre-wrap">                        </span>JMenuItem menuItem5 = new JMenuItem(&quot;Export As...&quot;);</div><div><span style="white-space:pre-wrap">                        </span>popup.add(menuItem5);</div><div><span style="white-space:pre-wrap">                        </span>popup.show(e.getComponent(), e.getX(), e.getY());</div>


<div><span style="white-space:pre-wrap">                        </span>final Chart3dCanvas canvas = this;</div><div><br></div><div><span style="white-space:pre-wrap">                        </span>menuItem5.addActionListener(new ActionListener() {</div><div>
<span style="white-space:pre-wrap">                                </span></div><div><span style="white-space:pre-wrap">                                </span>@Override</div><div><span style="white-space:pre-wrap">                                </span>public void actionPerformed(ActionEvent arg0) {</div>


<div><span style="white-space:pre-wrap">                                        </span>Display.getDefault().asyncExec(new Runnable() {</div><div><span style="white-space:pre-wrap">                                                </span></div><div><span style="white-space:pre-wrap">                                                </span>@Override</div>


<div><span style="white-space:pre-wrap">                                                </span>public void run() {<span style="white-space:pre-wrap">        </span></div><div><span style="white-space:pre-wrap">                                                        </span>Shell shell = new Shell(SWT.TITLE);</div>
<div><span style="white-space:pre-wrap">                                                        </span>shell.setText(&quot;Export As...&quot;);</div><div><span style="white-space:pre-wrap">                                                        </span>ExportAs id = new ExportAs(shell);</div><div><br></div><div>
<span style="white-space:pre-wrap">                                                        </span>if (id.open() == Window.OK) {</div><div><span style="white-space:pre-wrap">                                                                </span>vtkGL2PSExporter exp = new vtkGL2PSExporter();</div><div><span style="white-space:pre-wrap">                                                                </span>exp.SetRenderWindow(ren.GetRenderWindow());</div>


<div><span style="white-space:pre-wrap">                                                                </span>exp.SetSortToOff();</div><div><span style="white-space:pre-wrap">                                                                </span>exp.CompressOff();</div><div><span style="white-space:pre-wrap">                                                                </span>exp.DrawBackgroundOn();</div>


<div><span style="white-space:pre-wrap">                                                                </span>exp.Write3DPropsAsRasterImageOff();</div><div><br></div><div><span style="white-space:pre-wrap">                                                                </span>String route = id.getDirectory() + id.getName();</div>


<div><span style="white-space:pre-wrap">                                                                </span>exp.SetFilePrefix(route.toString());</div><div><span style="white-space:pre-wrap">                                                                </span>if(id.isSvg()) {</div><div><span style="white-space:pre-wrap">                                                                        </span>exp.SetFileFormatToSVG();</div>


<div><span style="white-space:pre-wrap">                                                                        </span>exp.Write();</div><div><span style="white-space:pre-wrap">                                                                </span>} </div><div><span style="white-space:pre-wrap">                                                                </span>if(id.isPdf()) {</div>
<div><span style="white-space:pre-wrap">                                                                        </span>exp.SetFileFormatToPDF();</div><div><span style="white-space:pre-wrap">                                                                        </span>exp.Write();</div><div><span style="white-space:pre-wrap">                                                                </span>}</div>


<div><span style="white-space:pre-wrap">                                                        </span>}</div><div><span style="white-space:pre-wrap">                                                </span>});</div><div><span style="white-space:pre-wrap">                                        </span>}</div><div><span style="white-space:pre-wrap">                                </span>});</div>


<div><span style="white-space:pre-wrap">                        </span>}</div><div>        }</div><div><span style="white-space:pre-wrap">                </span>UnLock();</div><div><span style="white-space:pre-wrap">        </span>}</div></div></div>
<div><br></div></div>