PDA

View Full Version : XSI: Script: Face Selection: polySubComponent


MasterZ
09-15-2006, 07:31 PM
New to scripting in XSI, I set out to do something simple and obvious but am stuck saying what the...
I create a sphere and select two polygons

CreatePrim "Sphere", "MeshSurface"
SelectGeometryComponents "sphere.poly[4, 53]"

I then want to actually have access to the polygons so one assumes
Getting the Selection returns items to access but it seems to return something useless...
a polySubComponent being undocumented and responding to mostly nothing.
I'm left saying how do I actually use that to access the obj (obsolete too).

set curSel = Selection
for each seldPolys in curSel
logMessage seldPolys
logMessage seldPolys.type
'elmArray = seldPolys.componentCollection
'logMessage elmArray
'logMessage TypeName(seldPolys)
'logMessage ClassName(seldPolys)
'logMessage seldPolys.NestedObjects
next

you get
'INFO : sphere.poly[4,53]
'INFO : polySubComponent

which apparently is not a usable array of polygons which is what I would need... the items are the selected polygons. no?

misterdi
09-16-2006, 03:52 AM
Not too sure what do you want.

Do you want to access individual component from the selection?, for instance accessing "Sphere.poly[4]" and "Sphere.poly[5]" individually?

Maybe you can use SubComponent.ElementArray for it?.

It will return indices of the SubComponent.

BTW: in your code :
'elmArray = seldPolys.componentCollection is not working since I think it require SubComponent.
elmArray = seldPolys.SubComponent.ComponentCollection,

Regards,

tachy0n
09-16-2006, 04:02 AM
CreatePrim "Sphere", "MeshSurface"
SelectGeometryComponents "sphere.poly[28,29,35-37]"

set curSel = selection(0)
set compColl = curSel.subcomponent.componentcollection

for each fac in compColl
logmessage fac.index
next

MasterZ
09-16-2006, 06:53 AM
Yes I think that does give the actual polygons now thanks
one fixup though... 'set' was needed.

CreatePrim "Sphere", "MeshSurface"
SelectGeometryComponents "sphere.poly[4, 53]"

set curSel = Selection
for each seldPolys in curSel
logMessage seldPolys
logMessage seldPolys.type
set pObj = GetValue(seldPolys)
logMessage pObj.type
set elmArray = seldPolys.SubComponent.ComponentCollection
for each polyItem in elmArray
logMessage polyItem
next
next


It works but I don't understand the logic fully yet!?! I suppose it's a critical part of the learning curve I'm observing there. Any words or a particular help page tutorial that explains how this is would be appreciated so I can learn the hierchy or whatever it is.

Thanks

CGTalk Moderation
09-16-2006, 06:53 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.