How can we check the contact state and flip contact/target sides if needed?
Pernelle Marone-Hitz
Member, Moderator, Employee Posts: 871
✭✭✭✭
With Mechanical scripting, how can we check the contact state and flip contact/target sides if needed?
Tagged:
0
Best Answer
-
The following function will check the contact state (well defined or unfulfilled) and flip contact/target sides if needed:
def CheckContactState(body): ExtAPI.Log.WriteMessage("Checking contact status due to changing "+ str(body.Name) + "to rigid body") ExtAPI.DataModel.Tree.Refresh() contactRegions = ExtAPI.DataModel.Project.Model.GetChildren[Ansys.ACT.Automation.Mechanical.Connections.ContactRegion](True) for contactRegion in contactRegions: if contactRegion.State==Ansys.ACT.Interfaces.Common.State.Unfulfilled : contactRegion.FlipContactTarget() ExtAPI.DataModel.Tree.Refresh()
1
Answers
-
Hi Pernelle, please explain how this scripts works as I am not able see any difference in contact and target.
0 -
Hi @Happy Kumar , this script will reverse contact/target only if the contact is unfulfilled (blue question mark next to the contact). If it is well defined (green tick mark) it will do nothing.
2 -
Thanks, Pernelle for your response
1