On 07/11/2015 at 12:39, xxxxxxxx wrote:
Hi Guys,
A Question on GetActiveObject?
I use GetActiveObject to Select active object, that is in the Object List.
Now when i use doc.GetActiveObject it dont work right.
It separate them and not group them.
This What *Console* Said:
AssertionError: Found next objects. Please add them separately.
So I wanted It to generate with the selected object use choose and go under or become a child.
Code:
def Generator_TAXILINE(self) :
doc = c4d.documents.GetActiveDocument()
#--| Generate and SET NAMES |--#
#Generate Sweep
taxi_sweep_Name = c4d.BaseObject(c4d.Osweep)
taxi_sweep_Name.SetName("TaxiLine")
#User Custom TEMP
TEMP_Name = self.linkBox.GetLink()
TEMP_Name.SetName("TAXILINE_TEMP")
#Select User Custom Path
selectedobject = doc.GetActiveObject() # <----| this Problem
selectedobject.SetName("User-Custom-Path")
#Insert Objects To LIST!
doc.InsertObject(taxi_sweep_Name)
doc.InsertObject(TEMP_Name)
doc.InsertObject(selectedobject)
# Objects Order!
parent = doc.SearchObject("TaxiLine")
child_Temp = doc.SearchObject("User-Custom-Path")
child_Temp.InsertUnder(parent)
parent = doc.SearchObject("TaxiLine")
child_Temp = doc.SearchObject("TAXILINE_TEMP")
child_Temp.InsertUnder(parent)
c4d.EventAdd()
return True
#--|C.O.M.M.A.N.D.S|-------------------------------------------------------#
def Command (self, id, msg) :
if (id == GEN_BUTTON) :
self.Generator_TAXILINE()
#-------------------------------------------------------------------------------------------------#
This what is happen when excute with doc.GetActiveObject() :
But If i use selectedobject = c4d.BaseObject(c4d.Osplinecircle) , IT WORKS FINE:
Help or Tip,
Cheers,
Ashton,
sorry for my English guys.