Change Material On Bodies
Run the script to change material on all bodies. This script takes a user input, e.g. Material = ‘Stainless Steel’.
############################ Material User Input!##############################
Material = 'Stainless Steel'
import time
start = time.time()
geom = ExtAPI.DataModel.Project.Model.Geometry
suplist=[]
with Transaction():
for i in geom.Children:
for j in i.Children:
if j.Suppressed == True:
suplist.append(j.ObjectId)
else:
j.Suppressed = True
j.Material = Material
Model.Geometry.UnsuppressAllBodies()
for i in suplist:
obj = ExtAPI.DataModel.GetObjectById(i)
obj.Suppressed = True
end = time.time()
print(end - start)