<div dir="ltr"><div><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div dir="ltr"><span class="gmail-im" style="color:rgb(80,0,80)">vtkSmartPointer<vtkIdTypeArray> globalIds = vtkSmartPointer<vtkIdTypeArray>::New();<br>globalIds = </span>vtkIdTypeArray::SafeDownCast(selected->GetPointData()->GetGlobalIds());<span class="gmail-im" style="color:rgb(80,0,80)"><br></span><div><span style="color:rgb(80,0,80)">assert(globalIds); </span><br></div><div><br></div><div>I think the assert tells you that the smartpointer itself exists, but it doesn't say anything about the vtkIdTypeArray pointed to by the smartpointer. I suspect if you assert(globalIds.GetPointer()) it will fail. If that is the case, since it is null, gloablids->* crashes on the next line.</div><div><br></div><div>Why it is null will take some more tracking down.</div><div><br></div><div>One thing to note about globalids is that VTK is conservative about preserving their meaning and throws them away when it can't do that. For example they won't be interpolated like most arrays are because averaging ids or (i.e. names) is undefined. Likewise filters that don't simply copy cells/points across won't attempt to preserve globalids. So what you should do is trace through the filters you are using to see where specifically the globalids are lost.</div><div><br></div><div>hth</div><div><br></div><div>David E DeMarle<br>Kitware, Inc.<br>Principal Engineer<br>21 Corporate Drive<br>Clifton Park, NY 12065-8662<br>Phone: 518-881-4909<br></div></div></div></div></div><br></div><br><div class="gmail_quote"><div dir="ltr">On Sat, Nov 24, 2018 at 9:47 AM meakcey <<a href="mailto:meakcey@gmail.com">meakcey@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Cleaner comparison to problem<br>
<br>
*Code below is working*<br>
<br>
vtkPlanes* frustum =<br>
static_cast<vtkAreaPicker*>(this->GetInteractor()->GetPicker())->GetFrustum();<br>
vtkSmartPointer<vtkExtractGeometry> extractGeometry =<br>
vtkSmartPointer<vtkExtractGeometry>::New();<br>
extractGeometry->SetImplicitFunction(frustum);<br>
extractGeometry->SetInputData(this->Points);<br>
extractGeometry->Update();<br>
extractGeometry->GetOutput()->GetPointData()->CopyGlobalIdsOn();<br>
<br>
vtkSmartPointer<vtkVertexGlyphFilter> glyphFilter =<br>
vtkSmartPointer<vtkVertexGlyphFilter>::New();<br>
glyphFilter->SetInputConnection(extractGeometry->GetOutputPort());<br>
glyphFilter->Update();<br>
glyphFilter->GetOutput()->GetPointData()->CopyGlobalIdsOn();<br>
vtkPolyData* selected = glyphFilter->GetOutput();<br>
<br>
vtkSmartPointer<vtkIdTypeArray> globalIds =<br>
vtkSmartPointer<vtkIdTypeArray>::New();<br>
globalIds =<br>
vtkIdTypeArray::SafeDownCast(selected->GetPointData()->GetGlobalIds());<br>
assert(globalIds);<br>
std::cout << "Nof globalIds " << globalIds->GetNumberOfComponents() << " "<br>
<< globalIds->GetNumberOfTuples() << std::endl;<br>
<br>
*Code below is crashing at the line of cout<br>
*<br>
vtkPlanes* frustum =<br>
static_cast<vtkAreaPicker*>(this->GetInteractor()->GetPicker())->GetFrustum();<br>
vtkSmartPointer<vtkExtractGeometry> extractGeometry =<br>
vtkSmartPointer<vtkExtractGeometry>::New();<br>
extractGeometry->SetImplicitFunction(frustum);<br>
extractGeometry->SetInputData(this->Points);<br>
extractGeometry->Update();<br>
extractGeometry->GetOutput()->GetPointData()->CopyGlobalIdsOn();<br>
<br>
vtkSmartPointer<vtkSelectVisiblePoints> visiblePoints =<br>
vtkSmartPointer<vtkSelectVisiblePoints>::New();<br>
visiblePoints->SetInputConnection(extractGeometry->GetOutputPort());<br>
visiblePoints->SetRenderer(this->GetInteractor()->GetRenderWindow()->GetRenderers()->GetFirstRenderer());<br>
visiblePoints->Update();<br>
visiblePoints->GetOutput()->GetPointData()->CopyGlobalIdsOn();<br>
<br>
vtkSmartPointer<vtkVertexGlyphFilter> visibleFilter =<br>
vtkSmartPointer<vtkVertexGlyphFilter>::New();<br>
visibleFilter->SetInputConnection(visiblePoints->GetOutputPort());<br>
visibleFilter->Update();<br>
visibleFilter->GetOutput()->GetPointData()->CopyGlobalIdsOn();<br>
vtkPolyData* visibles = visibleFilter->GetOutput();<br>
<br>
vtkSmartPointer<vtkIdTypeArray> globalIds =<br>
vtkSmartPointer<vtkIdTypeArray>::New();<br>
globalIds =<br>
vtkIdTypeArray::SafeDownCast(visibles->GetPointData()->GetGlobalIds());<br>
assert(globalIds);<br>
std::cout << "Nof globalIds " << globalIds->GetNumberOfComponents() << " "<br>
<< globalIds->GetNumberOfTuples() << std::endl;<br>
<br>
<br>
<br>
<br>
<br>
<br>
--<br>
Sent from: <a href="http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html" rel="noreferrer" target="_blank">http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html</a><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="https://public.kitware.com/mailman/listinfo/vtkusers" rel="noreferrer" target="_blank">https://public.kitware.com/mailman/listinfo/vtkusers</a><br>
</blockquote></div>