Hello,
Is there an easy way or an AddOn who can remove all empty components, I mean all components with triangle count equal to 0?
Thanks
I don’t think there is any ready addon for that. I wanted to test how this would go.
Add a python script to some component and paste this in the script. It should delete all components that have 0 triangles.
from vcScript import *
def give_geo_count(c):
nodes = [c]
data_count = 0
while nodes:
node = nodes.pop(0)
own_kids = [x for x in node.Children if x.Component == c]
nodes.extend( own_kids )
data_count += sum(x.PolygonCount for x in node.Geometry.GeometrySets if x.Type == VC_TRIANGLESET)
return data_count
app = getApplication()
comps = app.Components
for c in comps:
if give_geo_count(c) == 0:
print "Deleted", c.Name
c.delete()
Please make a backup of your layout in case the script deletes too much since I didn’t test this
1 Like
Thanks a lot, I tested it but it seems to be not working…
I ran the Python script but nothing happens.
Perhaps I do not run the simulation as I should…
I created a Python Script inside my component and start the simulation but nothing…