[vtkusers] How do I output PolyData's points?

Amy Henderson amy.henderson at kitware.com
Tue Jul 8 15:56:22 EDT 2003


At 08:51 PM 7/8/2003 +0000, Matt Zumwalt wrote:
>Thanks Amy.
>     Possibly someone knows what I'm doing wrong in translating Amy's code 
> from
>C++ to Tcl?  I've gotten the following error (tcl code included below):
>
>         Error in startup script: Object named: sphere, could not find
>         requested method: GetPoints
>         or the method was called with incorrect arguments.
>
>             while executing
>         "sphere GetPoints"
>            invoked from within
>         "set points [sphere GetPoints]"
>             (file "PointsToArray.tcl" line 6)
>
>
>This is what I've done in Tcl:
>
>package require vtk
>
>vtkSphereSource sphere
>  sphere SetThetaResolution 8
>  sphere SetPhiResolution 8
>set points [sphere GetPoints]
>set numberOfPoints [sphere GetNumberOfPoints]

The above 2 lines should be:

set points [[sphere GetOutput] GetPoints]
set numberOfPoints [[sphere GetOutput] GetNumberOfPoints]

- Amy


>for {set i 0} {i < $numberOfPoints} {incr i} {
>     set outarray($i) [points GetPoint $i]
>}
>
>Thanks again,
>MattZ
>
>On Tuesday 08 July 2003 18:18, Amy Henderson wrote:
> > At 07:04 PM 7/8/2003 +0000, Matt Zumwalt wrote:
> > >Hi all,
> > >     I'm trying to figure out how to generate a list containing the
> > > coordinates
> > >for all the points in a PolyData object.  I need to pass the list as
> > >parameters to one of the methods in an external program.   I'm sure there
> > >must be some simple way of doing this, but I can't figure it out.  Any
> > > help would be greatly appreciated.
> >
> > The following should work:
> >
> > vtkPoints *points = polyData->GetPoints();
> > int numPts = polyData->GetNumberOfPoints();
> > int i;
> >
> > float **ptArray = new float[numPts][3];
> >
> > for (i = 0; i < numPts; i++)
> > {
> > points->GetPoint(i, ptArray[i]);
> > }
> >
> > - Amy
> >
> > >thanks,
> > >  Matt Z
> > >_______________________________________________
> > >This is the private VTK discussion list.
> > >Please keep messages on-topic. Check the FAQ at:
> > ><http://public.kitware.com/cgi-bin/vtkfaq>
> > >Follow this link to subscribe/unsubscribe:
> > >http://www.vtk.org/mailman/listinfo/vtkusers
>
>--
>---------------------
>MSc Candidate
>Programme in Music Technology
>Department of Electronics
>University of York
>_______________________________________________
>This is the private VTK discussion list.
>Please keep messages on-topic. Check the FAQ at: 
><http://public.kitware.com/cgi-bin/vtkfaq>
>Follow this link to subscribe/unsubscribe:
>http://www.vtk.org/mailman/listinfo/vtkusers







More information about the vtkusers mailing list