Hi,<br>
<br>
I have the floowing code:<br>
<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>
vtkClipPolyData *clipper;<br>
void SetPlane(vtkPlanes * planes)<br>
{<br>
this->planes=planes;<br>
}<br>
<br>
void SetClipper(vtkClipPolyData *clipper)<br>
{<br>
this->clipper=clipper;<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>
this->clipper->SetClipFunction(planes);<br>
<br>
<br>
//widget->GetProp3D()->SetUserTransform(t);<br>
}<br>
};<br>
<br>
void main()<br>
{<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->GenerateClipScalarsOn();<br>
clipper->GenerateClippedOutputOn();<br>
clipper->InsideOutOff(); <br>
<br>
<br>
vtkPolyDataMapper *selectMapper = vtkPolyDataMapper::New();<br>
<br>
selectMapper->SetInput(clipper->GetClippedOutput());<br>
selectMapper->ScalarVisibilityOff(); <br>
<br>
vtkProperty *backProp =vtkProperty::New();<br>
backProp->SetDiffuseColor(0,0,0.25);<br>
<br>
vtkLODActor *selectActor = vtkLODActor::New();<br>
selectActor->SetMapper(selectMapper);<br>
selectActor->GetProperty()->SetColor(1,0,1);<br>
selectActor->VisibilityOff();<br>
selectActor->SetScale(1.01, 1.01, 1.01);<br>
selectActor->SetBackfaceProperty(backProp);<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>
callback->SetClipper(clipper); <br>
boxWidget->AddObserver(vtkCommand::InteractionEvent, callback);<br>
<br>
iren->Initialize();<br>
renWin->Render();<br>
iren->Start();<br>
}<br>
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////<br>
How I Can do to the clip region can`t to visualize?<br>
<br>
Thanks;<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