How to define a parameter from a Solution Combination in Mechanical

Javier Vique
Javier Vique Member, Employee Posts: 61
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]
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).



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

    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: 741
    First Comment First Anniversary Ansys Employee Solution Developer Community of Practice Member
    edited December 2022

    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.