Hi,<br>
<br>
I use vtkBoxWidget but this don't clip or cut the volume<br>
The Code is:<br>
<br>
#include "vtkActor.h"<br>
#include "vtkCamera.h"<br>
#include "vtkClipPolyData.h"<br>
#include "vtkDebugLeaks.h"<br>
#include "vtkPlanes.h"<br>
#include "vtkPolyDataMapper.h"<br>
#include "vtkProperty.h"<br>
#include "vtkRegressionTestImage.h"<br>
#include "vtkRenderWindow.h"<br>
#include "vtkRenderWindowInteractor.h"<br>
#include "vtkRenderer.h"<br>
#include "vtkBoxWidget.h"<br>
#include "vtkSphereSource.h"<br>
#include "vtkConeSource.h"<br>
#include "vtkGlyph3D.h"<br>
#include "vtkAppendPolyData.h"<br>
#include "vtkLODActor.h"<br>
#include "vtkCommand.h"<br>
<br>
class vtkMyCallback : public vtkCommand<br>
{<br>
public:<br>
vtkPlanes *planes;<br>
vtkActor *a; <br>
void SetPlane(vtkPlanes * planes)<br>
{<br>
this->planes=planes;<br>
}<br>
<br>
void SetActor(vtkActor * a)<br>
{<br>
this->a=a;<br>
}<br>
static vtkMyCallback *New() <br>
{ return new vtkMyCallback; }<br>
void Delete()<br>
{ delete this; }<br>
virtual void Execute(vtkObject *caller, unsigned long, void*)<br>
{<br>
<br>
vtkBoxWidget *widget = reinterpret_cast<vtkBoxWidget*>(caller);<br>
//widget->GetTransform(t);<br>
<br>
widget->GetPlanes(planes);<br>
this->a->VisibilityOn();<br>
<br>
//widget->GetProp3D()->SetUserTransform(t);<br>
}<br>
};<br>
<br>
<br>
<br>
void main()<br>
{<br>
// Create a mace out of filters.<br>
vtkSphereSource *sphere = vtkSphereSource::New();<br>
vtkConeSource *cone = vtkConeSource::New();<br>
vtkGlyph3D *glyph = vtkGlyph3D::New();<br>
glyph->SetInput((vtkDataSet *)sphere->GetOutput());<br>
glyph->SetSource(cone->GetOutput());<br>
glyph->SetVectorModeToUseNormal();<br>
glyph->SetScaleModeToScaleByVector();<br>
glyph->SetScaleFactor(0.25);<br>
<br>
// The sphere and spikes are appended into a single polydata. This just<br>
// makes things simpler to manage.<br>
vtkAppendPolyData *apd = vtkAppendPolyData::New();<br>
apd->AddInput(glyph->GetOutput());<br>
apd->AddInput(sphere->GetOutput());<br>
vtkPolyDataMapper *maceMapper = vtkPolyDataMapper::New();<br>
maceMapper->SetInput(apd->GetOutput());<br>
vtkLODActor *maceActor = vtkLODActor::New();<br>
maceActor->SetMapper(maceMapper);<br>
maceActor->VisibilityOn();<br>
<br>
// This portion of the code clips the mace with the vtkPlanes implicit<br>
// function. The clipped region is colored green.<br>
vtkPlanes *planes = vtkPlanes::New();<br>
vtkClipPolyData *clipper = vtkClipPolyData::New();<br>
clipper->SetInput(apd->GetOutput());<br>
clipper->SetClipFunction(planes);<br>
clipper->InsideOutOff(); <br>
<br>
vtkPolyDataMapper *selectMapper = vtkPolyDataMapper::New();<br>
<br>
selectMapper->SetInput(clipper->GetOutput());<br>
selectMapper->CroppingOn();<br>
vtkLODActor *selectActor = vtkLODActor::New();<br>
selectActor->SetMapper(selectMapper);<br>
selectActor->GetProperty()->SetColor(0, 1, 0);<br>
selectActor->VisibilityOff();<br>
selectActor->SetScale(1.01, 1.01, 1.01);<br>
<br>
// Create the RenderWindow, Renderer and both Actors<br>
vtkRenderer *ren = vtkRenderer::New();<br>
vtkRenderWindow *renWin = vtkRenderWindow::New();<br>
renWin->AddRenderer(ren);<br>
<br>
vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New();<br>
iren->SetRenderWindow(renWin);<br>
<br>
// The SetInteractor method is how 3D widgets are associated with the<br>
// render window interactor. Internally, SetInteractor sets up a bunch<br>
// of callbacks using the Command/Observer mechanism (AddObserver()).<br>
vtkBoxWidget *boxWidget = vtkBoxWidget::New();<br>
boxWidget->SetInteractor(iren);<br>
boxWidget->SetPlaceFactor(1.25);<br>
<br>
ren->AddActor(maceActor);<br>
ren->AddActor(selectActor);<br>
<br>
// Add the actors to the renderer, set the background and size<br>
ren->SetBackground(0.1, 0.2, 0.4);<br>
renWin->SetSize(300, 300);<br>
<br>
// This callback funciton does the actual work: updates the vtkPlanes<br>
// implicit function. This in turn causes the pipeline to update.<br>
/*de<f SelectPolygons(object, event):<br>
// object will be the boxWidget<br>
global selectActor, planes<br>
object.GetPlanes(planes)<br>
selectActor.VisibilityOn()*/<br>
<br>
// Place the interactor initially. The input to a 3D widget is used to<br>
// initially position and scale the widget. The "EndInteractionEvent" is<br>
// observed which invokes the SelectPolygons callback.<br>
boxWidget->SetInput((vtkDataSet *)glyph->GetOutput());<br>
boxWidget->PlaceWidget();<br>
vtkMyCallback *callback = vtkMyCallback::New(); <br>
callback->SetActor(selectActor);<br>
callback->SetPlane(planes);<br>
boxWidget->AddObserver(vtkCommand::InteractionEvent, callback);<br>
<br>
iren->Initialize();<br>
renWin->Render();<br>
iren->Start();<br>
}<br><br><div><span class="gmail_quote">2005/11/28, Darshan Pai <<a href="mailto:darshanpai@gmail.com">darshanpai@gmail.com</a>>:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Try Using vtkPlaneWidget .. Should Work<br><br>
<div><div><span class="e" id="q_107d8ca38ba739a9_1"><span class="gmail_quote">On 11/25/05, <b class="gmail_sendername">Diego Parada</b> <<a href="mailto:icebishop@gmail.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
icebishop@gmail.com</a>> wrote:</span>
</span></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0px 0px 0px 0.8ex; padding-left: 1ex;"><div><span class="e" id="q_107d8ca38ba739a9_3">Hi,<br><br>How i can do the cutter that appears in the image attach?
<br clear="all"><span><br>--
<br>Diego Armando Parada Cuervo<br>Estudiante de Ingeniería de Sistemas y Computación<br>Universidad Pedagógica y Tecnológica de Colombia </span><br></span></div>_______________________________________________<br>This is the private VTK discussion list.
<br>Please keep messages on-topic. Check the FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://www.vtk.org/Wiki/VTK_FAQ</a><br>Follow this link to subscribe/unsubscribe:
<br><a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://www.vtk.org/mailman/listinfo/vtkusers</a><br><br><br><br clear="all"></blockquote></div>
<br>
</blockquote></div><br><br clear="all"><br>-- <br>Diego Armando Parada Cuervo<br>Estudiante de Ingeniería de Sistemas y Computación<br>Universidad Pedagógica y Tecnológica de Colombia