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

Pernelle Marone-Hitz
Pernelle Marone-Hitz Member, Moderator, Employee Posts: 871
100 Answers 500 Comments 250 Likes First Anniversary
✭✭✭✭

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: 871
    100 Answers 500 Comments 250 Likes First Anniversary
    ✭✭✭✭

    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)