How to define a parameter from a Solution Combination in Mechanical

Options
Javier Vique
Javier Vique Member, Employee Posts: 78
First Answer First Anniversary Name Dropper 5 Likes
edited June 2023 in Structures

Solution Combination does not allow to define results values as output parameters. However, it does not mean that we cannot define these output values as parameters for a parametric study.

The idea would be using a Python Code object in the upstream simulation which forces Solution Combination to be evaluated and then take the value that user is interested in.

Here the code used in Python Code:

SolutionCombination = ExtAPI.DataModel.GetObjectsByType(DataModelObjectCategory.SolutionCombination)[0]
SolutionCombination.EvaluateAllResults()
StressValue = SolutionCombination.Children[0]
this.GetCustomPropertyByPath("Parameters Solution Combination/Maximum SEQV").Value = StressValue.Maximum.Value

(Be aware that we need to activate an output parameter in Property Provider).

Tagged:

Comments

  • James Derrick
    James Derrick Administrator, Employee Posts: 252
    First Anniversary Solution Developer Community of Practice Member Ansys Employee 5 Up Votes
    admin
    Options

    hi @Javier Vique I've added a codeblock to your post text, but I was wondering what the this object is? Where does it come from? This could be an ACT thing I'm not aware of.

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

    hi @James Derrick . this is a helper argument of the function that is called in the callback of the Python Code object, and refers to the datamodel object instance of the python code object you are currently editing in the tree. Indeed, this is specific to Mechanical scripting.