[vtkusers] help

ghzhao ghzhao at comgi.com
Fri Sep 21 23:56:26 EDT 2001

I write a class vtkKnittedFabricSource, but it does not work.
When I move the Execut() method outside just like the CSpline.tcl demo, it works. Why?

void vtkKnittedFabricSource::Execute()
  float pi= 3.141592654;
  int i, numPts;
  float x, y, z, s;
  vtkPoints *newPoints; 
  vtkCellArray *newPolys;
  vtkTubeFilter *profileTubes;
  vtkPolyData *profileData = vtkPolyData::New();
  vtkPolyData *polyData = vtkPolyData::New();
// Set things up; allocate memory

  numPts = this->ThetaResolution;
  newPoints = vtkPoints::New();
  newPolys = vtkCellArray::New();
// Generate points and lines
  for(i=0; i<numPts; i++)
     x = this->Shape*s*s*s-1.5*this->Shape*s*s+(this->Width+this->Shape)*s/2;
     y = 0.5*(this->Height+this->Overlap)*(1-cos(pi*s));
     z = 0.5*(this->Thickness-2*this->Radius)*(1-cos(2*pi*s));
     newPoints->InsertPoint(i, x, y, z);

  profileData->SetPoints( newPoints);
  profileData->SetLines( newPolys);

  profileTubes =vtkTubeFilter::New();
  profileTubes->SetInput( profileData);
  profileTubes->SetRadius( this->Radius);
// Update ourselves and release memory
//  newPoints->Delete();
//  newPolys->Delete();
//  profileTubes->Delete();

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20010922/ab145079/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: vtkKnittedFabricSource.cxx
Type: application/octet-stream
Size: 7349 bytes
Desc: not available
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20010922/ab145079/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: vtkKnittedFabricSource.h
Type: application/octet-stream
Size: 5689 bytes
Desc: not available
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20010922/ab145079/attachment-0001.obj>

More information about the vtkusers mailing list