Ansys Mechanical Scrpting (Python): How to set direction of directional shear force?

JW Member Posts: 2
Name Dropper First Comment
edited June 2023 in Structures


I am trying to create a beam result for a directional shear force (in y- & z-axis). But this options seems not to exist as a method (at least I can't find it in the API Reference Guide). For directional bending moments, it is easily possible:

yMoment = mySolution.AddDirectionalBendingMoment()

yMoment.NormalOrientation = NormalOrientationType.YAxis

How is it possible for the shear force? (And how to insert proper code representation in this forum?)

Thanks in advance!


Best Answer

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

    Hi @JW ,

    You can use the following lines of code to insert a directional shear force:

    solution = ExtAPI.DataModel.Project.Model.Analyses[0].Solution
    new_res = solution.AddTotalShearForce()
    new_res.BeamResultType = TotalOrDirectional.Directional

    However, setting the "Orientation" of this result is not officialy exposed in the automation API (I will report this to our development team):

    As a workaround, you can use the unsupported commands below. By unsupported, we mean that they are not documented, and we do not guarantee that they will work.

    new_res.InternalObject.NormalOrientation = NormalOrientationType.ZAxis

    For using the forum text's editor, please refer to this post:

    I hope this helps.