On 02/05/2016 at 01:34, xxxxxxxx wrote:
Hi everyone,
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
https://plugincafe.maxon.net/topic/8936/11866_turning-selection-tags-into-separate-objects
That's what I have so far. I now it is not very much
import c4d
from c4d import gui
#Welcome to the world of Python
def main() :
mydoc = c4d.documents.GetActiveDocument()
myobj = doc.GetActiveObject()
t = myobj.GetFirstTag()
while t:
if t.GetType() == c4d.Tpolygonselection:
tagselection = t.GetBaseSelect()
c4d.CallCommand(14046)
t = t.GetNext()
c4d.EventAdd()
if __name__=='__main__':
main()
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.
Anna