hexagon logo

How to fetch or export contact incident data with multiple contact events through python commands?

(Flexible bodies) I have multiple contact events in a single incident.
  • Hi Lingaiah,
     
    Unfortunately the current Python API (2017.2) does not have an 'Analysis' object that you can interact with. Fortunately the next version (2018) will have such an object BUT I just checked it and it doesn't include contact incidents.. I logged a defect report about that so hopefully that gets sorted out soon.
     
    I've made two simple Python functions that might be a starting point for you here. There IS an error about flex bodies not existing that should be cleaned up, but this is an example to start with.. Put the example file in your Adams working directory and do:
     
    ------- python code: -------
    >>> import sys, os
    >>> sys.path.append(os.getcwd())
    >>> from contact_incidents import *
     
    >>> get_all_incidents('last_run')
    ('.MODEL_1.Last_Run.CONTACT_INCIDENTS.INCIDENT_1', '.MODEL_1.Last_Run.CONTACT_INCIDENTS.INCIDENT_2', '.MODEL_1.Last_Run.CONTACT_INCIDENTS.INCIDENT_3', '.MODEL_1.Last_Run.CONTACT_INCIDENTS.INCIDENT_4', '.MODEL_1.Last_Run.CONTACT_INCIDENTS.INCIDENT_5', '.MODEL_1.Last_Run.CONTACT_INCIDENTS.INCIDENT_6', '.MODEL_1.Last_Run.CONTACT_INCIDENTS.INCIDENT_7', '.MODEL_1.Last_Run.CONTACT_INCIDENTS.INCIDENT_8', '.MODEL_1.Last_Run.CONTACT_INCIDENTS.INCIDENT_9', '.MODEL_1.Last_Run.CONTACT_INCIDENTS.INCIDENT_10')
     
    >>> get_contact_incident('.MODEL_1.Last_Run.CONTACT_INCIDENTS.INCIDENT_2')
    ERROR: The object ".MODEL_1.Last_Run.CONTACT_INCIDENTS.INCIDENT_2" has no elements to index in the "flex_bodies" field
    ERROR: The object ".MODEL_1.Last_Run.CONTACT_INCIDENTS.INCIDENT_2" has no elements to index in the "flex_bodies" field
    {'contacts': '.MODEL_1.CONTACT_1', 'penetration_depths': -0.48047318366377567, 'i_points': (-409.5719241922741, -97.04596699134936, 5.115405576416785e-15), 'step': 13, 'flex_bodies': None, 'i_geometries': '.MODEL_1.PART_2.ELLIPSOID_1', 'time': 0.23214686702505102, 'penetration_velocities': 8.806052274455453, 'j_geometries': '.MODEL_1.ground.CYLINDER_2', 'j_points': (-409.79971644362206, -96.62292423884577, 5.093422208936336e-15)}
     
    HTH,
    Kent
     
     
     
     

    Attached Files (1)