[vtkusers] PlaneWidget

James Robinson j.robinson at kepler-systems.com
Tue Aug 3 18:15:08 EDT 2004


Dear all,

 

I am trying to use the vtkPlaneWidget object to try control a vtkCutter
object (see earlier query). The essential part of the code is:

 

void vtkMyCallback::Execute(vtkObject *caller, unsigned long, void*)

{

  CMainFrame* pMainFrame = (CMainFrame*)AfxGetMainWnd() ;

  if (pMainFrame==NULL) return ;

  CSampleView* pVTKView =
(CSampleView*)(pMainFrame->MDIGetActive()->GetActiveView()) ;

  if (pVTKView == NULL) AfxMessageBox("NULL") ; ;

  if (pVTKView == NULL) return ;

  pVTKView->GetDocument()->UpdateXSection() ; // Part of what this does is
update pPlane

}

In document class definition:

  vtkPlaneWidget            *pPlaneWidget ;

  vtkMyCallback             *pCallback ;

 

 

IN document constructor:

  this->pPlaneWidget = vtkPlaneWidget::New() ;

  this->pCallback    = vtkMyCallback::New();

 

 

In Open Document

            pPlaneWidget->SetInteractor(GetView()->Interactor);

            vtkFloatingPointType bounds[6] ;

            vtkFloatingPointType center[3] ;

            GetView()->Renderer->ComputeVisiblePropBounds(bounds) ; 

            center[0] = (bounds[0] + bounds[1])/2.0;

            center[1] = (bounds[2] + bounds[3])/2.0;

            center[2] = (bounds[4] + bounds[5])/2.0;

// Note pPlane is the pointer to the implicit function that is used by the
vtkCutter

            pPlaneWidget->GetPlane(pPlane) ;

            pPlaneWidget->SetResolution(10) ;

            pPlaneWidget->PlaceWidget();

            pPlaneWidget->NormalToYAxisOn() ;

            pPlaneWidget->AddObserver(vtkCommand::InteractionEvent,
pCallback);

 

The code doesn't crash, but the movement of the vtkPlaneWidget has no effect
on the vtkPlane  (pPlane). Any ideas??

 

Regards,

 

Jim

 

 

 

James C Robinson, PhD, Chartered Engineer,

*     42 Rivergrove,

         Glanmire,

         Co. Cork,

         Eire

'     +353 21 4822028

         +353 87 2393010

6      +353 21 4822028

*    j.robinson at kepler-systems.com 

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20040803/037bbdb9/attachment.htm>


More information about the vtkusers mailing list