On 18/10/2014 at 11:53, xxxxxxxx wrote:
I've found a couple posts about this but no clear answers.
https://plugincafe.maxon.net/topic/8036/10449_xref-python-command
Is it possible to create an Xref object and pass in a file path using python rather than just opening the dialog to search for it? If so, does someone have a code snippet they can share?
EDITED:
I've got this going so far, but the filepath isn't updating. I guess maybe I need to load a file into the Xref object?
import c4d
def main() :
op = c4d.BaseObject(c4d.Oxref)
rocket = "/component1.c4d"
op.GetObjectLink(rocket)
op[c4d.ID_CA_XREF_FILE_SELECT] = "component1.c4d"
op[c4d.ID_CA_XREF_NAMESPACE] = "rocket"
op[c4d.ID_CA_XREF_GENERATOR] = 1
box = c4d.BaseObject(c4d.Ocube)
box.SetName("new")
doc.InsertObject(box)
doc.InsertObject(op)
c4d.EventAdd()