[vtkusers] Programmatically move actors and reset all actors

Wang Q wangq1979 at outlook.com
Thu May 3 09:36:31 EDT 2018


Hello vtkers,

I use Qt5.9 with VTK8.0 to develop a GUI based system. I create multiple actors and want to allow users to interact with the actors by clicking relating buttons, e.g. changing colours, moving in one direction and rotating along one axis. The basic strategy is that all actors store in a vector and update the colours or transforms in a separate function when a button is clicked.  In the function, the code is like:

double tmpColor[4];

    tmpColor[0] = pipeColor[0];

    tmpColor[1] = pipeColor[1];

    tmpColor[2] = pipeColor[2];

    tmpColor[3] = pipeColor[3];

    pipeActor->GetProperty()->SetColor(tmpColor);

    pipeActor->GetProperty()->SetOpacity(tmpColor[3]);

    pipeTransform->Translate(0.0, 0.0, currentMove);

    pipeTransform->RotateY(static_cast<double>(currentRotate));

    pipeTransform->Update();

    pipeActor->SetUserTransform(pipeTransform);


    this->bmRenderer->ResetCamera();

    this->bmRenderer->GetActiveCamera()->Zoom(scaleFactor);



    ui->bmWidget->GetRenderWindow()->Render();

The actor's colour is updated but the movement is not.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://vtk.org/pipermail/vtkusers/attachments/20180503/1b2ddb40/attachment.html>


More information about the vtkusers mailing list