How can I use the mechanical script to locate these six locations and delete them?
Best Answer
-
You can use DataModelObjectCategory to get category of objects and filter them. Here is an example for getting named selection with name 'Displacement'
disp_ns =[ns for ns in ExtAPI.DataModel.GetObjectsByType(DataModelObjectCategory.NamedSelection) if ns.Name=="Displacement"]
You may not be able to delete object 1, which is a geometry.
0
Answers
-
@Rajesh Meena said:
You can use DataModelObjectCategory to get category of objects and filter them. Here is an example for getting named selection with name 'Displacement'disp_ns =[ns for ns in ExtAPI.DataModel.GetObjectsByType(DataModelObjectCategory.NamedSelection) if ns.Name=="Displacement"]
You may not be able to delete object 1, which is a geometry.
Thank you very much for solving my problem. After searching on my own, I found that the script code for deleting part is
geopartdel=ExtAPI.DataModel.GeoData.Assemblies[0].AllParts Model.DeleteParts(geopartdel)
I hope it can help people who are also troubled by this problem. Please note that this script will delete all parts.
0 -
Adding to Rajesh's answer, you can get the object type by selecting a branch in the tree and running:
Tree.FirstActiveObject.GetType()
1