<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=gb2312">
<META content="MSHTML 5.50.4616.200" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT size=2>I write a class vtkKnittedFabricSource, but it does not
work.</FONT></DIV>
<DIV><FONT size=2>When I move the Execut() method outside just like the
CSpline.tcl demo, it works. Why?</FONT></DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT size=2>void vtkKnittedFabricSource::Execute()<BR>{<BR> float
pi= 3.141592654;<BR> int i, numPts;<BR> float x, y, z, s;<BR>
vtkPoints *newPoints; <BR> vtkCellArray *newPolys;<BR> vtkTubeFilter
*profileTubes;<BR> vtkPolyData *profileData =
vtkPolyData::New();<BR> vtkPolyData *polyData =
vtkPolyData::New();<BR> <BR>//<BR>// Set things up; allocate
memory<BR>//</FONT></DIV>
<DIV> </DIV>
<DIV><FONT size=2> numPts = this->ThetaResolution;<BR> newPoints
= vtkPoints::New();<BR> newPoints->Allocate(numPts);<BR> newPolys
= vtkCellArray::New();<BR>
newPolys->InsertNextCell(numPts);<BR>//<BR>// Generate points and
lines<BR>//<BR> for(i=0; i<numPts; i++)<BR> {<BR>
s=1.0*i/numPts;<BR> x =
this->Shape*s*s*s-1.5*this->Shape*s*s+(this->Width+this->Shape)*s/2;<BR>
y =
0.5*(this->Height+this->Overlap)*(1-cos(pi*s));<BR>
z =
0.5*(this->Thickness-2*this->Radius)*(1-cos(2*pi*s));<BR>
newPoints->InsertPoint(i, x, y, z);<BR>
newPolys->InsertCellPoint(i);<BR> }</FONT></DIV>
<DIV> </DIV><FONT size=2>
<DIV><BR> profileData->SetPoints( newPoints);<BR>
profileData->SetLines( newPolys);</DIV>
<DIV> </DIV>
<DIV> profileTubes =vtkTubeFilter::New();<BR>
profileTubes->SetNumberOfSides(this->PhiResolution);<BR>
profileTubes->SetInput( profileData);<BR> profileTubes->SetRadius(
this->Radius);<BR> <BR>//<BR>// Update ourselves and release
memory<BR>//<BR>
this->SetOutput(profileTubes->GetOutput());<BR>//
newPoints->Delete();<BR>// newPolys->Delete();<BR>//
profileTubes->Delete();<BR>}</DIV>
<DIV> </DIV>
<DIV></FONT> </DIV></BODY></HTML>