[vtkusers] Why does a vtkFeatureEdge return non-scalar output?

Cory Quammen cory.quammen at kitware.com
Wed May 2 09:48:39 EDT 2018


On Tue, May 1, 2018 at 10:52 PM pnt1614 <minpu.code at gmail.com> wrote:

> I am using a vtkFeatureEdge to extract a boundary edges and everything
> works
> fine. Now I want to render points on the boundary edge so I try to use
> vtkEdgePoints but there is an "No scalar data to contour
> " error. I found out that the boundary edge has no scalars. Is there
> something missing? or is this a bug?
>

vtkFeatureEdges does indeed copy data arrays to its output, so that is not
the problem. vtkEdgePoints expects a point data array to use for
interpolating points along edges. However, vtkSTLReader does not create any
point data arrays - I'm not sure STL files can even store data arrays.

If you just want to render the points in the vtkPolyData extracted from
vtkFeatureEdges, call

edgeActor->GetProperty()->SetRepresentationToPoints();

HTH,
Cory


>
>
>                 // Load a stl file
>                 //...
>                 vtkSmartPointer<vtkPolyData> data =
> pSTLReader->GetOutput();                            //
> vtkPolyData 형식으로 받아오기
>
>
>                                                   // Create a mapper and
> actor
>                 vtkSmartPointer<vtkPolyDataMapper> mapper =
> vtkSmartPointer<vtkPolyDataMapper>::New();
>                 mapper->SetInputData(data);
>
>                 vtkSmartPointer<vtkActor> actor =
> vtkSmartPointer<vtkActor>::New();
>                 actor->SetMapper(mapper);
>
>
>                 //---------------edges-----------
>                 vtkSmartPointer<vtkFeatureEdges> edges =
> vtkSmartPointer<vtkFeatureEdges>::New();
>                 edges->SetInputConnection(pSTLReader->GetOutputPort());
>                 edges->BoundaryEdgesOn();
>                 edges->FeatureEdgesOff();
>                 edges->ManifoldEdgesOff();
>                 edges->NonManifoldEdgesOff();
>                 edges->Update();
>
>                 int test = edges->GetColoring(); // the result is 1
>
>                 vtkSmartPointer<vtkPolyDataMapper> edgeMapper =
> vtkSmartPointer<vtkPolyDataMapper>::New();
>                 edgeMapper->SetInputConnection(edges->GetOutputPort());
>
>                 vtkSmartPointer<vtkActor> edgeActor =
> vtkSmartPointer<vtkActor>::New();
>                 edgeActor->SetMapper(edgeMapper);
>                 edgeActor->GetProperty()->SetLineWidth(3.0);
>
>
>                 vtkSmartPointer<vtkEdgePoints> e_points =
> vtkSmartPointer<vtkEdgePoints>::New();
>                 e_points->SetInputConnection(edges->GetOutputPort());
>                 e_points->SetValue(1150);
>                 e_points->Update();
>
>                 vtkSmartPointer<vtkActor> e_a =
> make_an_actor(e_points->GetOutputPort());
>
>                 vtkSmartPointer<vtkRenderer> renderer =
> vtkSmartPointer<vtkRenderer>::New();
>                 renderer->AddActor(e_a);
>
>
>
> --
> Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Search the list archives at: http://markmail.org/search/?q=vtkusers
>
> Follow this link to subscribe/unsubscribe:
> https://vtk.org/mailman/listinfo/vtkusers
>


-- 
Cory Quammen
Staff R&D Engineer
Kitware, Inc.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://vtk.org/pipermail/vtkusers/attachments/20180502/f328c530/attachment.html>


More information about the vtkusers mailing list