[Paraview-developers] object not displaying in the paraview window
Utkarsh Ayachit
utkarsh.ayachit at kitware.com
Fri Apr 17 08:24:56 EDT 2015
You're missing a call to `transformModel->Update()` before calling
`transformModel->GetOutput()`. The filter never updated, and hence its
output is empty.
Utkarsh
On Fri, Apr 17, 2015 at 6:34 AM, Chiranjib Sur <sur.chiranjib at gmail.com> wrote:
> Hi All,
> I want to apply the tranform filter while I create an object in paraview. TO
> try with I have overloaded vtkCubeSource class and can create the object
> which appears in the paraview pipeline and I can visualize the object in the
> PV window.
>
> Now I want to apply the transformation filter (vtkTransform) to the objct
> when I create it. To do that I have overloaded the RequestData function like
> the following.
>
> The code is compiling and executing but when I create the object and apply
> transform, nothing is appearing in the PV visualization window.
>
> Can anybody help me pointing out what is going wrong with my implementation.
>
> I cam copying my code below
>
> Thanks,
> Chiranjib
>
>
> ------
>
>
>
> int MyOwnCubeSource::RequestData( vtkInformation *vtkNotUsed(request),
>
> vtkInformationVector **vtkNotUsed(inputVector),
>
> vtkInformationVector *outputVector)
>
> {
>
> // get the info object
>
> vtkInformation *outInfo = outputVector->GetInformationObject(0);
>
>
>
> // get the ouptut
>
> vtkPolyData *output = vtkPolyData::SafeDownCast(
>
> outInfo->Get(vtkDataObject::DATA_OBJECT()));
>
> ....
>
> ....
>
>
>
> // output (type vtkPolyData) is already ready at this stage
>
>
>
> // If I don’t appy transform operation afterwards, I can visualize the
> object in the PV pipeline
>
>
>
>
>
> // -----------------------------------------------//
>
>
>
> // Implementation of vtkTransform starts here
>
>
>
> double _rotationZ = 30.0;
>
>
>
> // Define transform
>
> vtkSmartPointer<vtkTransform> transform =
> vtkSmartPointer<vtkTransform>::New();
>
>
>
> // Define transformModel : transform filter
>
> vtkSmartPointer<vtkTransformFilter> transformModel =
> vtkSmartPointer<vtkTransformFilter>::New();
>
> transformModel->SetTransform(transform);
>
>
>
> //Decoupling the pipeline and asking the transformfilter to update the
> newpipeline (created out of shallowcopy)
>
> vtkNew<vtkPolyData> cubeCopy;
>
> cubeCopy->ShallowCopy(output);
>
> transformModel->SetInputData(cubeCopy.GetPointer());
>
>
>
> // Describe all the transform operations
>
> transform->PostMultiply();
>
> transform->RotateZ(10*_rotationZ);
>
> transform->Update();
>
>
>
> // getting the transformed output
>
> vtkSmartPointer<vtkDataSet> transformedOutput =
> transformModel->GetOutput();
>
>
>
> // Shallowcopy the transformed output to the old pipeline
>
>
>
> output->ShallowCopy(transformedOutput);
>
>
>
> // A this stage "output" should be updated and the visualization pipeline
> should show the transformed object
>
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Search the list archives at:
> http://markmail.org/search/?q=Paraview-developers
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/paraview-developers
>
More information about the Paraview-developers
mailing list