Yep, turns out a "for each" can give very strange results for a
MFloatPointArray... iterating with "for i in range(array.length())"
works properly -- thanks Damon!

On Feb 23, 1:22 am, damon shelton <[email protected]> wrote:
> yea you should be able to loop through the returnedPointArray
> the get function helps convert the MPointArray into a C++ friendly array of
> double arrays which is not in python
>
>
>
> On Mon, Feb 22, 2010 at 10:09 PM, pjrich <[email protected]> wrote:
> > I initialize the variables, then call the allIntersections function,
> > which takes those variables as arguments, and I'd been assuming it
> > sets the values of the variables automagically.
>
> > Then I'm just using for loops to extract: "for x in hitPoints", etc.
>
> > Part of the problem is that I don't know how to look at the array all
> > at once, to see how the data is formatted inside. When I try to print
> > the array, I just get a pointer to the array, though I can see there
> > are MFloatPoints inside. When I try to do a get() as suggested by the
> > docs I get c++ errors. :P
>
> > I'll try the range iterator next though, thanks for that suggestion.
>
> > On Feb 23, 1:00 am, damon shelton <[email protected]> wrote:
> > > how are you looping through to get and set the intersection points?
>
> > > are you using MPointArray().append(MPoint(x, y, z))
>
> > > and when getting the value are you looping through the array and getting
> > > each element?
>
> > > example code:
>
> > > import maya.OpenMaya as OpenMaya
>
> > > pointArray = OpenMaya.MPointArray()
> > > for i in range(25):
> > >     pointArray.append(OpenMaya.MPoint(i, i, i))
>
> > > for i in range(pointArray.length()):
> > >     print pointArray[i].x, pointArray[i].y, pointArray[i].z
>
> > --
> >http://groups.google.com/group/python_inside_maya

-- 
http://groups.google.com/group/python_inside_maya

Reply via email to