# VTK+PCL Viewer BOXwidget2 is not show

**URL:** https://discourse.vtk.org/t/vtk-pcl-viewer-boxwidget2-is-not-show/12830
**Category:** Development
**Created:** [December 2, 2023, 7:37am UTC](https://discourse.vtk.org/t/vtk-pcl-viewer-boxwidget2-is-not-show/12830 "2023-12-02T07:37:17Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![bowen\_zhu](https://discourse.vtk.org/user_avatar/discourse.vtk.org/bowen_zhu/32/8088_2.png) [@bowen\_zhu](https://discourse.vtk.org/u/bowen_zhu)
#### Post date: [December 2, 2023, 7:37am UTC](https://discourse.vtk.org/t/vtk-pcl-viewer-boxwidget2-is-not-show/12830/1 "2023-12-02T07:37:17Z")

</div>

this is my code  
class QVTKWindow : public QVTKOpenGLNativeWidget

impl-\>renderer = vtkSmartPointer::New();/  
impl-\>renderWindow = vtkSmartPointer::New();  
impl-\>renderWindow-\>AddRenderer(impl-\>renderer);  
impl-\>viewer.reset(new pcl::visualization::PCLVisualizer(impl-\>renderer, impl-\>renderWindow, “viewer”, false));  
this-\>setRenderWindow(impl-\>viewer-\>getRenderWindow());  
impl-\>viewer-\>setupInteractor(this-\>interactor(), this-\>renderWindow());

below is boxwidget2 show code

```
vtkNew<vtkNamedColors> colors;

vtkNew<vtkConeSource> coneSource;
coneSource->SetHeight(1.5);

vtkNew<vtkPolyDataMapper> mapper;
mapper->SetInputConnection(coneSource->GetOutputPort());

vtkNew<vtkActor> actor;
actor->SetMapper(mapper);
actor->GetProperty()->SetColor(colors->GetColor3d("BurlyWood").GetData());

vtkSmartPointer<vtkBoxWidget2> boxWidget= vtkSmartPointer<vtkBoxWidget2>::New();

boxWidget->SetInteractor(this->interactor());
boxWidget->GetRepresentation()->SetPlaceFactor(2); // Default is 0.5
boxWidget->GetRepresentation()->PlaceWidget(actor->GetBounds());

// Set up a callback for the interactor to call so we can manipulate the actor
vtkSmartPointer<vtkBoxCallback> boxCallback= vtkSmartPointer<vtkBoxCallback>::New();
boxCallback->SetActor(actor);
boxWidget->AddObserver(vtkCommand::InteractionEvent, boxCallback);
boxWidget->On();
impl->renderer->AddActor(actor);
impl->renderWindow->Render();

```

How can I modify the code to solve this problem?
