How to change contact settings to revert to previous version behaviors

Mike.Thompson
Mike.Thompson Member, Employee Posts: 345
25 Answers 100 Comments 25 Likes First Anniversary
✭✭✭✭
edited March 11 in Structures

This is just a post of a short snippet that can be used to revert contacts back to augmented lagrange (previous default) if they are set to program controlled. 24.1 will set MPC in background for program controlled in some instances with shell connections. This is just a simple example of how users can script a solution to set the formulation explicitly to be consistent with older versions if desired. Trigger this from the ACT console, or publish to a button.

A further implementation would be an ACT that actually modifies the “program controlled” contact APDL definitions by modifying the input file. This would allow for program controlled to mean anything the users want it to mean for them locally, but would require in-house ACT implementation.

`

User options for if you want to review all contacts or only the ones activated in the tree.

ContactSelection = "All"

ContactSelection = "Active"

Get the contacts to work on

if ContactSelection=="All":
MyContacts = ExtAPI.DataModel.GetObjectsByType(DataModelObjectCategory.ContactRegion)
elif ContactSelection=="Active":
MyContacts = Tree.ActiveObjects

Modify the contacts

ModifiedContacts = []
with Transaction(True):
for Contact in AllContacts:
if Contact.ContactFormulation==ContactFormulation.ProgramControlled:
Contact.ContactFormulation=ContactFormulation.AugmentedLagrange
ModifiedContacts.append(Contact)

report the changes

print str(len(ModifiedContacts))+" Contacts modified from program controlled to Augmented Lagrange"
print "ModifiedContacts python list holds the contacts that have been modified in this operation"
`

Comments

  • M
    M Member, Employee Posts: 241
    50 Answers 100 Comments 100 Likes Second Anniversary
    ✭✭✭✭
    edited March 12

    @Mike.Thompson Just what I was looking for. One minor note, I think AllContacts should be MyContacts (or vice versa) for the entire script to work.

    """
    This snippet will modify contacts to augmented lagrange (previous default) from program controlled
    """
    #User options for if you want to review all contacts or only the ones activated in the tree.
    ContactSelection = "All"
    #ContactSelection = "Active"
    
    #Get the contacts to work on
    if ContactSelection=="All":
        MyContacts = ExtAPI.DataModel.GetObjectsByType(DataModelObjectCategory.ContactRegion)
    elif ContactSelection=="Active":
        MyContacts = Tree.ActiveObjects
    
    #Modify the contacts
    ModifiedContacts = []
    with Transaction(True):
        for Contact in MyContacts:
            if Contact.ContactFormulation==ContactFormulation.ProgramControlled:
                Contact.ContactFormulation=ContactFormulation.AugmentedLagrange
                ModifiedContacts.append(Contact)
    
    #report the changes
    print str(len(ModifiedContacts))+" Contacts modified from program controlled to Augmented Lagrange"
    print "ModifiedContacts python list holds the contacts that have been modified in this operation"