Getting an inventory of components using Python?

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

THREAD CLOSED
 
Thread Tools Search this Thread Display Modes
Old 05 May 2008   #1
Getting an inventory of components using Python?

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?
 
Old 05 May 2008   #2
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.
__________________
Come, Join the Cult http://www.cultofrig.com - Rigging from First Principles
 
Old 05 May 2008   #3
Originally Posted by ThE_JacO: 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!
 
Old 05 May 2008   #4
Thread automatically closed

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.
__________________
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
 
Thread Closed share thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
CGSociety
Society of Digital Artists
www.cgsociety.org

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump
Miscellaneous

All times are GMT. The time now is 01:17 AM.


Powered by vBulletin
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.