Python Create Objects as Child or Not
Posted: 19 Aug 2016, 06:11
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, "")
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, "")