[vtkusers] Getting the scalar value from vtkCell

Mark Kobine mark at bugless.co.uk
Mon Aug 13 11:08:13 EDT 2007


Hi Dominik,

Thanks for that - vtkExtractEdges looks like the way to go.

What I think I need to do next is to get the set of cells that share the
same scalar value (as allocated by vtkSTLReader with ScalarTagsOn())
when the STL file was read in. I can get the cell the user clicked
easily with vtkCellPicker but I haven't been able to find anything that
will give me that cell's scalar value or the rest of the cells with the
same scalar.

Or am I approaching this the wrong way?

Many thanks,
Mark

Dominik Szczerba wrote:
> Hi Mark,
> Please make cc's to the mailing list.
> The easiest thing to set up (not necessarily the fastest to perform)
> would be to extract the picked selection and use the vtkExtractEdges
> filter on it. Then set linewidth to 2 or 3 and color to red in a
> corresponding actor.
> bye, Dominik
> 
> Mark Kobine wrote:
>> Hi Dominik,
>>
>> Many thanks for the advice.
>>
>> If I were to go about plotting the edges of the selected geometry, as
>> you suggest, how would I go about this?
>>
>> Many thanks,
>> Mark
>>
>> Dominik Szczerba wrote:
>>> This has been frequently asked here. There is no way to change a cell
>>> color other than to change its scalar value. This is not elegant as you
>>> have to write to your original dataset, supposedly writing down the
>>> overwritten value temporarily and taking care it is written back when
>>> you un-pick. Then, you have to remember that the modified scalar has
>>> still go through a color lookup table to be seen and having it always
>>> e.g. red may not always be that trivial and robust.
>>> I would recommend a different way without modifying the actual data,
>>> like shrinking the element, plotting it edges, or annotating it's
>>> nodes etc.
>>> - Dominik
>>>
>>> Mark Kobine wrote:
>>>> Hi,
>>>>
>>>> I have some geometry read in from an STL file that contains several
>>>> "solid" sections. These sections are currently coloured automatically
>>>> by vtk based on the scalar value assigned to each section as it is
>>>> read in. I want to change the appearance of one of these sections if
>>>> the user clicks on it in the renderer window.
>>>>
>>>> I'm using vtkCellPicker and from that I can get the selected vtkCell.
>>>> From there is there a way to get the scalar value for that cell?
>>>>
>>>> My approach is to use that scalar to somehow change the appearance of
>>>> all cells with the same scalar value.
>>>>
>>>> Can any one help? Is this a sensible approach?
>>>>
>>>> Many thanks,
>>>> Mark
>>>> _______________________________________________
>>>> This is the private VTK discussion list. Please keep messages on-topic.
>>>> Check the FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
>>>> Follow this link to subscribe/unsubscribe:
>>>> http://www.vtk.org/mailman/listinfo/vtkusers
> 



More information about the vtkusers mailing list