Thank you very much
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.
@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.
@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'
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.
Adding to Rajesh's answer, you can get the object type by selecting a branch in the tree and running:Tree.FirstActiveObject.GetType()
Tree.FirstActiveObject.GetType()