i think you need to go bruteforce...
pretty slow code but i dont know python

from win32com.client import constants as c
app = Application
oGeo = 
app.Selection(0).SubComponent.Parent3DObject.ActivePrimitive.GetGeometry3(0,c.siConstructionModeSecondaryShape)
 # arguments needed otherwise crash
indarray = [0] * oGeo.Samples.Count
for point in oGeo.Points:
    for ptsample in point.Samples:
        indarray[ ptsample.Index ] = point.Index
cmparray = [0] * oGeo.Points.Count
outIndexArray = []
for sample in app.Selection(0).SubComponent.ElementArray:
    if not cmparray[ indarray[ sample ] ]:
        outIndexArray.append( indarray[ sample ] )
        cmparray[ indarray[ sample ] ] = 1

for i in outIndexArray:
    Application.LogMessage ( i )

From: Jules Stevenson 
Sent: Wednesday, September 12, 2012 7:58 PM
To: softimage@listproc.autodesk.com 
Subject: Re: Python, Returning the vertex index from a sample cluster

Apologies, hit send a little early there.... 

for sample in samples.SubComponent.ComponentCollection:
log(uvs.FindIndices([sample.Index]))
                log (sample.Index)
                log(elements.FindIndex(sample.Index)

The 'elements' clusterElementCollection seems to contain the indices to the 
samples, not the mapping to the geometry, which goes against what is syas in 
the docs:

"The ClusterElementCollection returned by Cluster.Elements (and 
Envelope.Elements) provides the mapping between an index of a component in a 
cluster with the index of the component on the Geometry. For example index 10 
on a polygon Cluster might refer to Polygon 45 on the geometry, in which case 
ClusterElementCollection.Item(10) has the value 45. This data is read-only."

This is not what I get at all, for a start the cluster.Elements.Count returns 
approximatly 80k, which makes no sense as a geometry index since there are only 
about 20k points. Clearly this is an array of the sample indices (4 per vert). 
Soooooooo, how do I get the point / facet / polygon ID from a sample?

Any help much appreciated, this is driving me nuts.

Cheers,

Jules

Reply via email to