<div dir="ltr">Hi Mengda,<div class="gmail_extra"><br></div><div class="gmail_extra">I will suggest to figure out why it is crashing first. Even with only one node, it should still work.</div><div class="gmail_extra"><br></div><div class="gmail_extra">Also, assuming you are using this method vtkContourWidget::Initialize( vtkPolyData * poly, int state = 1, vtkIdList *idList = NULL ), your input poly doesn't have any points?</div><div class="gmail_extra"><br></div><div class="gmail_extra">Yumin</div><div class="gmail_extra"><br></div><div class="gmail_extra"><div class="gmail_quote">On Fri, Jan 22, 2016 at 10:40 AM, Mengda Wu <span dir="ltr"><<a href="mailto:wumengda@gmail.com" target="_blank">wumengda@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr">Hi all,<div><br></div><div>   I would like to set the state of vtkContourWidget to Manipulate at initialize and add the nodes programmably instead of interactively. Everything is fine but I have to check the there are at least 2 nodes in the following, otherwise AddNodeOnContour will crash</div><div><br></div><div>So I hope you can change the following function to</div><div><br></div></div></blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div></div><div>void vtkContourWidget::SelectAction( vtkAbstractWidget *w )<br></div><div>{</div><div><br></div><div>................</div><div>................</div><div><br></div><div><div>  switch ( self->WidgetState )</div><div>    {</div><div>    case vtkContourWidget::Start:</div><div>    case vtkContourWidget::Define:</div></div><div><div>................</div><div>................</div></div><div>    case vtkContourWidget::Manipulate:<br></div><div><div>      {</div><div>      if ( rep->ActivateNode( X, Y ) )</div></div><div>        {<br></div><div><div>................</div><div>................</div></div><div><div>        }</div><div>      else if ( rep->GetNumberOfNodes()>1 && rep->AddNodeOnContour( X, Y ) )   //Ensure the number of nodes is at least 2</div><div>        {</div></div><div><div><div>................</div><div>................</div></div><div>        }</div></div><div><div>................</div><div>................</div></div><div>}</div><div><br></div><div><br></div></div>
<br>_______________________________________________<br>
Powered by <a href="http://www.kitware.com" rel="noreferrer" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" rel="noreferrer" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
<br>
Search the list archives at: <a href="http://markmail.org/search/?q=vtkusers" rel="noreferrer" target="_blank">http://markmail.org/search/?q=vtkusers</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://public.kitware.com/mailman/listinfo/vtkusers" rel="noreferrer" target="_blank">http://public.kitware.com/mailman/listinfo/vtkusers</a><br>
<br></blockquote></div><br></div></div>