Closed pmaroneh closed 1 year ago
Same root cause as #93.
I'm sorry if I'm missing the obvious here or did a mistake but I can't make the workaround work in this situation:
pressure = analysis.AddPressure()
pressure.Location = ExtAPI.DataModel.GetObjectsByName("NSInsideFaces")[0]
inputs_quantities = [Quantity("0 [s]"), Quantity("1 [s]")]
inputs_quantities_2 = System.Collections.Generic.List[System.Int32]()
[inputs_quantities_2.Add(item) for item in inputs_quantities]
returns: What's weird is that dir(input_quantities_2) does have a .Add() method: But maybe the issue here is that I'm trying to deal with quantities (so value + unit) and not just some standard items in a standard list?
Realized I was missing the obvious. Type of list needs to be adapted, as follows:
pressure.Location = ExtAPI.DataModel.GetObjectsByName("NSInsideFaces")[0]
inputs_quantities = [Quantity("0 [s]"), Quantity("1 [s]")]
output_quantities = [Quantity("0 [Pa]"), Quantity("15 [MPa]")]
inputs_quantities_2 = System.Collections.Generic.List[Ansys.Core.Units.Quantity]()
[inputs_quantities_2.Add(item) for item in inputs_quantities]
output_quantities_2 = System.Collections.Generic.List[Ansys.Core.Units.Quantity]()
[output_quantities_2.Add(item) for item in output_quantities]
pressure.Magnitude.Inputs[0].DiscreteValues = inputs_quantities_2
pressure.Magnitude.Output.DiscreteValues = output_quantities_2```
This is resolved in 0.7.dev3.
🔍 Before submitting the issue
🐞 Description of the bug
In the GUI, this works:
pressure = analysis.AddPressure() pressure.Location = ExtAPI.DataModel.GetObjectsByName("NSInsideFaces")[0] pressure.Magnitude.Inputs[0].DiscreteValues = [Quantity("0 [s]"), Quantity("1 [s]")] pressure.Magnitude.Output.DiscreteValues = [Quantity("0 [Pa]"), Quantity("15 [MPa]")]
But in embedded mode, the following error message is returned:
📝 Steps to reproduce
See above.
💻 Which operating system are you using?
Windows
🐍 Which Python version are you using?
3.7
📦 Installed packages