<!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>&nbsp;</DIV>
<DIV><FONT size=2>void vtkKnittedFabricSource::Execute()<BR>{<BR>&nbsp; float 
pi= 3.141592654;<BR>&nbsp; int i, numPts;<BR>&nbsp; float x, y, z, s;<BR>&nbsp; 
vtkPoints *newPoints; <BR>&nbsp; vtkCellArray *newPolys;<BR>&nbsp; vtkTubeFilter 
*profileTubes;<BR>&nbsp; vtkPolyData *profileData = 
vtkPolyData::New();<BR>&nbsp; vtkPolyData *polyData = 
vtkPolyData::New();<BR>&nbsp;<BR>//<BR>// Set things up; allocate 
memory<BR>//</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT size=2>&nbsp; numPts = this-&gt;ThetaResolution;<BR>&nbsp; newPoints 
= vtkPoints::New();<BR>&nbsp; newPoints-&gt;Allocate(numPts);<BR>&nbsp; newPolys 
= vtkCellArray::New();<BR>&nbsp; 
newPolys-&gt;InsertNextCell(numPts);<BR>//<BR>// Generate points and 
lines<BR>//<BR>&nbsp; for(i=0; i&lt;numPts; i++)<BR>&nbsp; {<BR>&nbsp; 
s=1.0*i/numPts;<BR>&nbsp;&nbsp;&nbsp;&nbsp; x = 
this-&gt;Shape*s*s*s-1.5*this-&gt;Shape*s*s+(this-&gt;Width+this-&gt;Shape)*s/2;<BR>&nbsp;&nbsp;&nbsp;&nbsp; 
y = 
0.5*(this-&gt;Height+this-&gt;Overlap)*(1-cos(pi*s));<BR>&nbsp;&nbsp;&nbsp;&nbsp; 
z = 
0.5*(this-&gt;Thickness-2*this-&gt;Radius)*(1-cos(2*pi*s));<BR>&nbsp;&nbsp;&nbsp;&nbsp; 
newPoints-&gt;InsertPoint(i, x, y, z);<BR>&nbsp;&nbsp;&nbsp;&nbsp; 
newPolys-&gt;InsertCellPoint(i);<BR>&nbsp; }</FONT></DIV>
<DIV>&nbsp;</DIV><FONT size=2>
<DIV><BR>&nbsp; profileData-&gt;SetPoints( newPoints);<BR>&nbsp; 
profileData-&gt;SetLines( newPolys);</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp; profileTubes =vtkTubeFilter::New();<BR>&nbsp; 
profileTubes-&gt;SetNumberOfSides(this-&gt;PhiResolution);<BR>&nbsp; 
profileTubes-&gt;SetInput( profileData);<BR>&nbsp; profileTubes-&gt;SetRadius( 
this-&gt;Radius);<BR>&nbsp; <BR>//<BR>// Update ourselves and release 
memory<BR>//<BR>&nbsp;&nbsp;&nbsp; 
this-&gt;SetOutput(profileTubes-&gt;GetOutput());<BR>//&nbsp; 
newPoints-&gt;Delete();<BR>//&nbsp; newPolys-&gt;Delete();<BR>//&nbsp; 
profileTubes-&gt;Delete();<BR>}</DIV>
<DIV>&nbsp;</DIV>
<DIV></FONT>&nbsp;</DIV></BODY></HTML>