Python object count script


https://forum.reallusion.com/Topic507314.aspx
Print Topic | Close Window

By 2IDs media:design - 3 Years Ago
Hello User and Icloner

is here somebody how can program in python the following thing.


We need a pythonscript that can COUNT and LIST all used Props / Objects in an Iclone scene and EXPORT it out in a csv or txt, xml file.


For example we have a scene with a complex structure so we want to know, how many props of each type we use in the scene.

like 3xcube, 2xsphere, 6xarc, 12xtwisted box and so on......

in our case we need it exactly and it looks like that

3xwalls,   6xfloors,     8xwindows,  4xdoors, ( the names are changed for the props ) the reason is that we use it for architectural design with iclone.


Perhaps there is somebody who can realize it? or are there other solutions for it?
Many thanks and have all a nice weekend.




By Kelleytoons - 3 Years Ago
There's not really much to this:

import RLPy
holder = ""
prop_list = RLPy.RScene.GetProps()
for prop in prop_list:
    prop_name = prop.GetName()
    holder = holder + ", " + prop_name
with open("D:\\iCloneProps.txt", 'w') as propfile:
    propfile.write(holder)
print(holder)


By Data Juggler - 3 Years Ago
If you want to add to KelleyToons answer. This code gets the child objects for a prop. I just got this answer from someone at IClone after looking for it for a year.


all_level_child_props = RLPy.RScene.FindChildObjects( prop, RLPy.EObjectType_Prop )
child_props = RLPy.RScene.FindChildObjects( prop, RLPy.EObjectType_Prop, False )