THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 27/03/2012 at 14:34, xxxxxxxx wrote:
doesn't work, res is the variable containing the result returned by utils.SendModelingCommand and not a reference to the object in your object manager.
def main() : obj = c4d.BaseObject(c4d.Ocube) obj[c4d.PRIM_CUBE_LEN] = c4d.Vector(30,30,100) res = utils.SendModelingCommand(command = c4d.MCOMMAND_CURRENTSTATETOOBJECT, list = [obj], mode = c4d.MODELINGCOMMANDMODE_ALL, bc = c4d.BaseContainer(), doc = doc) sel = res.GetPolygonS() sel.Select(2) doc.InsertObject(res) c4d.EventAdd()
this would be the shortest way. even if doc.SetActiveObject(res) would be a propper statement, it would have no impact on your further code as selecting an object does not have any impact on your further python code. Baseodocument.SearchObject() would be the method you would use to get an object from the objectmanager. it returns an baseobject you could modify.