[vtkusers] SetActiveVectors when there are many pipelines that use different arrays
Fernando Nellmeldin
f.nellmeldin at open-engineering.com
Wed Oct 26 10:44:42 EDT 2016
Hello and thank you for your reply!
After your suggestion, I tried using vtkPassArray, but I can't find how to
set the Active Vectors. The output is a vtkDataObject*, which of course
doesn't have the PointsData and therefore no setActiveVectors.
The result is the same as before, when I change the input to Full, I see
the wrong deformed mesh.
This is my modified code:
// given that model is first an UnstructuredGrid1 and then
UnstructuredGridFull
vtkSmartPointer<vtkPassArrays> passArrays =
vtkSmartPointer<vtkPassArrays>::New();
passArrays->SetInput(model);
passArrays->UseFieldTypesOn(); // restrict to only pass what I say
passArrays->AddFieldType(vtkDataObject::POINT);
passArrays->AddArray(fieldType, "nameOfArray");
passArrays->Update();
//warping vector is a vtkWarpVector
warpingVector->SetInputConnection(passArrays->GetProducerPort());
warpingVector->SetInputArrayToProcess(0, 0,
0, vtkDataObject::FIELD_ASSOCIATION_POINTS, "nameOfArray"); // I don't know
why this line is needed to see something
// the rest of the pipeline is the same...
Am I missing something?
Thank you.
On 26 October 2016 at 15:40, Dan Lipsa <dan.lipsa at kitware.com> wrote:
> Fernando,
> Can you try vtkPassArray to pass the proper vector array to each of your
> pipelines? Then you can set the active vector on the output of this
> algorithm.
>
> Dan
>
>
> On Wed, Oct 26, 2016 at 6:23 AM, Fernando Nellmeldin <f.nellmeldin at open-
> engineering.com> wrote:
>
>> Hello.
>> I would like to show the deformed mesh of a model based on the values of
>> a point data array of dimension 3 (vectorial data).
>>
>> I have the following pipeline:
>> UnstructuredGrid1 -> WarpVector -> GeometryFilter -> ExtractEdges ->
>> PolyDataMapper -> Actor
>> In the WarpVector, I call to say which array to use
>> WarpVector->SetInputArrayToProcess(0,0,0, FIELD_ASSOCIATION_POINTS,"name
>> OfArray");
>>
>> The first time I load the actor in screen, everything is OK.
>>
>> Later, I would like to mirror the input UnstructuredGrid1 because it
>> represents half the model. So I do the following:
>> UnstructuredGrid1 -> ReflectionFilter -> UnstructuredGrid2
>> {UnstructuredGrid1, UnstructuredGrid2} -> AppendFilter ->
>> UnstructuredGridFull
>>
>> Then, I replace the input of WarpVector by UnstructuredGridFull, and I
>> reload the actor.
>> However, what I see on screen is the same deformed mesh than before, plus
>> another deformed mesh that is not its mirror, it's something different and
>> not correct, of course.
>>
>> If, however, I call:
>> At the beginning: UnstructuredGrid1->GetPointData()->SetActiveVectors("
>> nameOfArray");
>> After I did the mirroring: UnstructuredGridFull->GetPoint
>> Data()->SetActiveVectors("nameOfArray");
>> I don't have the problem and everything works OK.
>>
>> Problem is, I don't want to call setActiveVectors because I can have more
>> than one pipeline that makes uses of the same UnstructuredGrid with
>> different vectorial data, and I noticed that each call to setActive* will
>> modify all the pipelines that makes use of the Scalars/Vectors/Tensors. So
>> this doesn't seem an option.
>>
>> What is the alternative to use here to solve the problem?
>>
>> I tried with vtkAssignAttributes but didn't work.
>> vtkSmartPointer<vtkAssignAttribute> aa = vtkSmartPointer<vtkAssignAttri
>> bute>::New();
>> aa->SetInput(UnstructuredGridFull);
>> aa->Assign("nameOfArray", vtkDataSetAttributes::VECTORS,
>> vtkAssignAttribute::POINT_DATA);
>> aa->Update();
>>
>> And then:
>> AssignAttribute -> WarpVector instead of UnstructuredGridFull ->
>> WarpVector.
>> but same result...
>>
>> Thank you.
>>
>> --
>> *Fernando NELLMELDIN*
>> Software Engineer
>> *_______________________________________________________________*
>>
>> *Open Engineering s.a.*
>>
>> Rue Bois Saint-Jean 15/1
>> B-4102 Seraing (Belgium)
>> Tel: +32.4.353.30.34
>>
>> http://www.open-engineering.com
>> https://www.linkedin.com/company/open-engineering?trk=biz-companies-cym
>>
>>
>> *_________________________________________________________________________*
>>
>> _______________________________________________
>> 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:
>> http://public.kitware.com/mailman/listinfo/vtkusers
>>
>>
>
--
*Fernando NELLMELDIN*
Software Engineer
*_______________________________________________________________*
*Open Engineering s.a.*
Rue Bois Saint-Jean 15/1
B-4102 Seraing (Belgium)
Tel: +32.4.353.30.34
http://www.open-engineering.com
https://www.linkedin.com/company/open-engineering?trk=biz-companies-cym
*_________________________________________________________________________*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20161026/bfb2e8f9/attachment.html>
More information about the vtkusers
mailing list