How to automate creation of an aligned coordinate system to vector principal stress at a node in Wor

Options
Pernelle Marone-Hitz
Pernelle Marone-Hitz Member, Moderator, Employee Posts: 827
First Comment First Anniversary Ansys Employee Solution Developer Community of Practice Member

How to automate creation of an aligned coordinate system to vector principal stress at a node in Workbench Mechanical?

Tagged:

Answers

  • Pernelle Marone-Hitz
    Pernelle Marone-Hitz Member, Moderator, Employee Posts: 827
    First Comment First Anniversary Ansys Employee Solution Developer Community of Practice Member
    Options

    The following code can be adapted. Note - the script uses InternalObject, which is an undocumented and unsupported command. There is no guarantee that the script will work, or that it will work for all versions.

    vector_stress=Model.Analyses[0].Solution.AddVectorPrincipalStress()
    vector_stress.EvaluateAllResults()
    sel = ExtAPI.SelectionManager.CreateSelectionInfo(SelectionTypeEnum.MeshNodes)
    sel.Ids=[354] #known NodeId
    ExtAPI.SelectionManager.AddSelection(sel)
    csys = Model.CoordinateSystems.AddCoordinateSystem()
    ExtAPI.SelectionManager.AddSelection(sel)
    vector_stress.InternalObject.alignCoordinateSystem(ExtAPI.SelectionManager.InternalObject,csys.ObjectId)