How to delete load objects in WB LS-DYNA?
How to delete load objects in WB LS-DYNA?
I have learned "How to create load objects in WB LS-DYNA" as below link.
But I cannot delete it before create new load objects.
https://discuss.ansys.com/discussion/comment/1170#Comment_1170
May anyone tell me how, thank you.
Best Answer
-
Hello Zephyr,
Try the solution in this post:
https://discuss.ansys.com/discussion/526/how-to-delete-a-custom-object-by-scriptSOmething like this
analysis.Activate() user_obj = analysis.CreateLoadObject("Section", "LSDYNA") DS = ExtAPI.DataModel.InternalObject["ds"] DS.Tree.DeleteObject(user_obj.ObjectId)
0
Answers
-
Hi Aria,
It works. Thank you.
a=ExtAPI.DataModel.Project.Model.Analyses[0]
target = r'targetName'
object_id = None
for i in a.Children:
if i.Name == target:
object_id = i.ObjectId
analysis = ExtAPI.DataModel.AnalysisList[0]
user_obj = analysis.CreateLoadObject("Section", "LSDYNA")
DS = ExtAPI.DataModel.InternalObject["ds"]
DS.Tree.DeleteObject(object_id)
0 -
def DeleteObject(obj): try: ID = obj.ObjectId except: ID = obj.InternalObject.ID JScmds = 'DS.Tree.DeleteObject({})'.format(ID) ExtAPI.Application.ScriptByName("jscript").ExecuteCommand(JScmds)
0