Hi everybody,
this is fairly simple. i just want to create an object as a child of the current selection. this works fine. but i just cant figure out how to create the object normally if nothing is selected.... have a look and thanks for any help CYTE:
from win32com.client import constants as c
selObjects = []
for oObject in Application.Selection:
selObjects.append(oObject)
if (Application.Selection > None):
for oObject in selObjects:
Application.CreatePrim("Cube", "MeshSurface", "Cube_1", "")
Application.SetValue(".cube.length", 6, "")
Application.Translate("", 0, 3, 0, "siAbsolute", "siPivotCOG", "siObj", "siY", "", "", "", "", "", "", "", "", "", 0, "")
Application.AddToSelection(oObject, "", True)
Application.ParentObjects("")
else:
Application.CreatePrim("Cube", "MeshSurface", "Cube_1", "")
Application.SetValue(".cube.length", 6, "")
Application.Translate("", 0, 3, 0, "siAbsolute", "siPivotCOG", "siObj", "siY", "", "", "", "", "", "", "", "", "", 0, "")
Python Create Objects as Child or Not
Re: Python Create Objects as Child or Not
found it:
from win32com.client import constants as c
selObjects = []
for oObject in Application.Selection:
selObjects.append(oObject)
if (Application.Selection(0) != None):
for oObject in selObjects:
Application.CreatePrim("Cube", "MeshSurface", "Cube_1", "")
Application.SetValue(".cube.length", 6, "")
Application.Translate("", 0, 3, 0, "siAbsolute", "siPivotCOG", "siObj", "siY", "", "", "", "", "", "", "", "", "", 0, "")
Application.AddToSelection(oObject, "", True)
Application.ParentObjects("")
Application.TransZero()
else:
Application.CreatePrim("Cube", "MeshSurface", "Cube_1", "")
Application.SetValue(".cube.length", 6, "")
Application.Translate("", 0, 3, 0, "siAbsolute", "siPivotCOG", "siObj", "siY", "", "", "", "", "", "", "", "", "", 0, "")
from win32com.client import constants as c
selObjects = []
for oObject in Application.Selection:
selObjects.append(oObject)
if (Application.Selection(0) != None):
for oObject in selObjects:
Application.CreatePrim("Cube", "MeshSurface", "Cube_1", "")
Application.SetValue(".cube.length", 6, "")
Application.Translate("", 0, 3, 0, "siAbsolute", "siPivotCOG", "siObj", "siY", "", "", "", "", "", "", "", "", "", 0, "")
Application.AddToSelection(oObject, "", True)
Application.ParentObjects("")
Application.TransZero()
else:
Application.CreatePrim("Cube", "MeshSurface", "Cube_1", "")
Application.SetValue(".cube.length", 6, "")
Application.Translate("", 0, 3, 0, "siAbsolute", "siPivotCOG", "siObj", "siY", "", "", "", "", "", "", "", "", "", 0, "")
Re: Python Create Objects as Child or Not
If you're going to script in Softimage, you'll want to write in Object Mode for those things.
Being said that it may take a while to get used to it so I'm not sure if that would worth the effort for a dead Software.
And next time use the code tag or the code spacing will get messed up.
Being said that it may take a while to get used to it so I'm not sure if that would worth the effort for a dead Software.
Code: Select all
#python
xsi = Application
sel = xsi.GetValue('selectionlist')
for obj in sel:
cube = obj.AddGeometry('cube', 'MeshSurface')
cube.length = 6
cube.posy = 3
cube.name = 'Cube_1'
M.Yara
Character Modeler | Softimage Generalist (sort of)
Character Modeler | Softimage Generalist (sort of)
Re: Python Create Objects as Child or Not
hey myara,
thanks for the tips! yes i will use the code style next time!
I´m fairly new to scripting...
for me softimage isnt dead, i use it everyday. for me its like a pencil and i dont need new fancy features on my pencil every year.
and now i can customize the hell out of softi, as it will stay like it is!
even today lots of stuff gets produced that doesnt look as good as jurassic park (1993) (just sayin)
thanks for the tips! yes i will use the code style next time!
I´m fairly new to scripting...
for me softimage isnt dead, i use it everyday. for me its like a pencil and i dont need new fancy features on my pencil every year.
and now i can customize the hell out of softi, as it will stay like it is!
even today lots of stuff gets produced that doesnt look as good as jurassic park (1993) (just sayin)
Who is online
Users browsing this forum: No registered users and 25 guests