On 02/05/2016 at 01:34, xxxxxxxx wrote:
I am currently getting obj files of many objects. Sadly if I am importing them into cinema 4d, I am getting one polygon object with lots of selection tags. Each selection tag represents one piece of the model and I need them separated into single objects. So I thought I could write a python script and loop through all the selection tags and then separate them.
I found this thread here, which is actually doing, what I want to do, but building the parts into my own script doesn't really work and I am not sure, wich parts I need and which not. As for example I don't need to compare the names, but only the type
That's what I have so far. I now it is not very much
from c4d import gui
#Welcome to the world of Python
def main() :
mydoc = c4d.documents.GetActiveDocument()
myobj = doc.GetActiveObject()
t = myobj.GetFirstTag()
if t.GetType() == c4d.Tpolygonselection:
tagselection = t.GetBaseSelect()
t = t.GetNext()
Currently it is only separating the whole object but not the polygons in the single selection tags. But I think it is going through all the selection tags, as I am currently testing it with a cube, which has 6 selection tags and I am getting 6 copies.
So why is it not making the new objects from the selection tag? Has anyone an idea? I thought the GetBaseSelect() would activate the polygon selection in the selection tag, wouldn't it?
Would be great if someone could give me some hints into the right direction.