[vtkusers] PlaneWidget
John Biddiscombe
jbiddiscombe at skippingmouse.co.uk
Tue Aug 3 20:29:36 EDT 2004
Jim,
difficult to tell from the snippet, but a good guess would be that
initializing with this...
// Note pPlane is the pointer to the implicit function that is used by the
vtkCutter
pPlaneWidget->GetPlane(pPlane) ;
is not good enough, after InteractionEndEvent, do that every time, then on
each end event, you call getplane and the implicit plane should be updated.
Apologies if I've misunderstood.
JB
From: "James Robinson" <j.robinson at kepler-systems.com>
To: "Vtk Users" <vtkusers at vtk.org>
Sent: Tuesday, August 03, 2004 11:15 PM
Subject: [vtkusers] PlaneWidget
> 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
>
>
>
>
----------------------------------------------------------------------------
----
> _______________________________________________
> This is the private VTK discussion list.
> Please keep messages on-topic. Check the FAQ at:
<http://public.kitware.com/cgi-bin/vtkfaq>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
More information about the vtkusers
mailing list