PDA

View Full Version : Getting an inventory of components using Python?


Array
05-13-2008, 07:09 PM
Hey guys,

Does anyone know how to access geometry info in XSI using Python? I.e. if I have selected a piece of geometry, how can I get a list of all of its vertices, edges, and polygons?

ThE_JacO
05-13-2008, 07:14 PM
Don't know what app you're coming from sdk wise, but in XSI object orientation is king.

say you got the first object in a selection with oSel = Application.Selection(0)
oSel.ActivePrimitive will get you the current descriptor of the object.
oSel.ActivePrimitive.Geometry will get you the geometry data, and in there you can fetch all you need.

ie: oSel.ActivePrimitive.Geometry.Points will get you the collection of points, and then you can fetch things like point positions with PointPosition (like I told you in your last thread), count for the count etc
Same goes for other subcomponent types like oSel.ActivePrimitive.Geometry.Polygons.

This is all stuff that's pretty well documented and explained in the sdk manuals/reference.
the soft wiki has a lot of addendums, especially to python, for tricky or long-way-around things.

Array
05-13-2008, 07:19 PM
Don't know what app you're coming from sdk wise, but in XSI object orientation is king.

say you got the first object in a selection with oSel = Application.Selection(0)
oSel.ActivePrimitive will get you the current descriptor of the object.
oSel.ActivePrimitive.Geometry will get you the geometry data, and in there you can fetch all you need.

ie: oSel.ActivePrimitive.Geometry.Points will get you the collection of points, and then you can fetch things like point positions with PointPosition (like I told you in your last thread), count for the count etc
Same goes for other subcomponent types like oSel.ActivePrimitive.Geometry.Polygons.

This is all stuff that's pretty well documented and explained in the sdk manuals/reference.
the soft wiki has a lot of addendums, especially to python, for tricky or long-way-around things.

That was quick,thanks!

I'm not really coming from any app in particular. I'm in between projects at work so I'm taking the time to learn Python...and what better way to do it than inside of XSI! ;)

CGTalk Moderation
05-13-2008, 07:19 PM
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.