ansys / ansys/pyoptislang

ParameterManager.modify_parameter_property not working for property_name 'range'

Open
#475 2 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Python
Stars
24
Forks
5
Avg merge
3d 14h
Merged PRs (30d)
12

Description

### 🔍 Before submitting the issue

- [x] I have searched among the existing issues
- [ ] I am using a Python virtual environment

### 🐞 Description of the bug

I tried to modify the parameter range via the _modify_parameter_property_ method of the system's _ParameterManager_. No error was raised. When checking parameters tab in the optiSLang project, the range did not change. The same approach is working for e.g. _reference_value_ or _const_ properties.

### 📝 Steps to reproduce

[25R2_sensi_py_lhs.opf.txt](https://github.com/user-attachments/files/22336290/25R2_sensi_py_lhs.opf.txt)

modify_and_run_workflow.py:
```python
from ansys.optislang.core import Optislang
from ansys.optislang.core import utils

osl_exec = utils.find_all_osl_exec()
with Optislang(executable=osl_exec[252][0], loglevel="INFO") as osl:
# Load project
osl.application.open(r'C:\ansysdev\jfoerste\optiSLang\examples\25R2\02_sensi_py_lhs\25R2_sensi_py_lhs.opf')
# Modify project
root_system = osl.application.project.root_system
sensi = root_system.find_nodes_by_name("Sensitivity")[0]
sensi.parameter_manager.modify_parameter_property('x2', 'const', True)
sensi.parameter_manager.modify_parameter_property('x2', 'reference_value', 0.42)
# Will not change the lower/upper bound:
#sensi.parameter_manager.modify_parameter_property('x1', 'range', (-10.0, 10.0))
# Will change the lower/upper bound:
for parameter in sensi.parameter_manager.get_parameters():
if parameter.name == 'x1':
parameter.range = (-10.0, 10.0)
sensi.parameter_manager.modify_parameter(parameter)
break
osl.application.save()
# Start project
osl.application.project.reset()
osl.application.project.start()
osl.application.save()
```
executed via powershell and optislang python
`> ."C:\Program Files\ANSYS Inc\v252\optiSLang\optislang-python.cmd" .\modify_and_run_workflow.py`

### 💻 Which operating system are you using?

Windows

### 📀 Which ANSYS version are you using?

```powershell
> ."C:\Program Files\ANSYS Inc\v252\optiSLang\optislang.com" --version
optiSLang 2025 R2.1 (21)
```

### 🐍 Which Python version are you using?

3.10

### 📦 Installed packages

```shell
2to3==1.0
annotated-types==0.7.0
ansys-conceptev-core==0.9.4
ansys-fluidprops==0.3.2
ansys-optislang-core==1.0.0
ansys-pythonnet==3.1.0rc0
anyio==4.9.0
appdirs==1.4.3
async-timeout==5.0.1
attrs==25.3.0
cached-property==1.5.1
certifi==2024.7.4
cffi==1.17.1
chardet==3.0.4
charset-normalizer==3.4.2
clr_loader==0.2.7.post0
colorama==0.4.6
contourpy==1.3.2
cpylog==1.5.0
cryptography==45.0.5
cycler==0.12.1
defusedxml==0.6.0
Deprecated==1.2.18
distro==1.9.0
dnspython==2.7.0
docopt-ng==0.9.0
email_validator==2.2.0
et_xmlfile==2.0.0
exceptiongroup==1.3.0
execnet==2.1.1
FMPy==0.2.26
fonttools==4.58.0
future==0.18.0
googleapis-common-protos==1.69.2
granta-miscriptingtoolkit @ file:///C:/__w/externals.local/prebuilt/granta_mi/granta_miscriptingtoolkit-3.2.164-py3-none-any.whl#sha256=ddfd47f0caf17c35c7f952007a60ba7dff4ffbc997551b0e05a494789026bf31
grpcio==1.58.3
grpcio-status==1.58.3
h11==0.16.0
h5py==3.9.0
httpcore==1.0.9
httpx==0.28.1
idna==3.10
importlib_metadata==8.7.0
iniconfig==2.1.0
isodate==0.6.0
jaraco.classes==3.4.0
keyring==23.13.1
kiwisolver==1.4.8
lark-parser==0.12.0
llvmlite==0.40.1
lml==0.1.0
lxml @ https://github.com/FrankRichterAnsys/lxml/releases/download/lxml-4.9.2%2Bzlib-1.2.13/lxml-4.9.2-cp310-cp310-win_amd64.whl#sha256=87724c20032fd68d6e7ba2dcb4dfc028f2d98752b8125d02a46b00d7d5949741
matplotlib==3.6.0
more-itertools==10.7.0
msal==1.32.3
msal-extensions==1.3.1
msgpack==1.1.1
nose==1.3.7
numba==0.57.0
numpy==1.23.5
openpyxl==3.0.10
packaging==25.0
pandas==2.2.2
pillow==11.2.1
pip-system-certs==4.0
platformdirs==4.3.8
pluggy==1.6.0
pooch==1.8.2
protobuf==4.25.5
psutil==5.9.5
py==1.11.0
pybind11==2.10.0
pycparser==2.22
pydantic==2.11.7
pydantic-settings==2.10.1
pydantic_core==2.33.2
pyexcel==0.7.0
pyexcel-ezodf==0.3.4
pyexcel-io==0.6.6
pyexcel-ods3==0.6.1
pyexcel-xls==0.7.0
pyexcel-xlsx==0.6.0
PyJWT==2.10.1
Pymem==1.14.0
pyNastran==1.4.0
pyparsing==3.2.3
pytest==7.2.1
pytest-forked==1.6.0
pytest-xdist==1.31.0
python-dateutil==2.9.0.post0
python-dotenv==1.1.1
pythonnet==3.0.5
pytz==2025.2
pyvista==0.44.0
pywin32==304
pywin32-ctypes==0.2.3
requests==2.31.0
requests-toolbelt==0.9.1
scipy==1.9.3
SCons==4.3.0
scooby==0.10.1
sip==6.5.1
six==1.15.0
sniffio==1.3.1
tenacity==8.5.0
texttable==1.7.0
toml==0.10.2
tomli==2.2.1
typing-inspection==0.4.1
typing_extensions==4.13.2
tzdata==2025.2
urllib3==1.26.10
vtk==9.4.2
websockets==15.0.1
wrapt==1.17.2
xlrd==2.0.1
xlwt==1.3.0
zeep==3.4.0
zipp==3.23.0
```

Contributor guide

Open the contributing guide

Research direction

Start by locating ParameterManager.modify_parameter_property and compare its handling of 'range' with the working 'reference_value' and 'const' cases. Reproduce the issue with modify_and_run_workflow.py and the attached 25R2_sensi_py_lhs.opf.txt project; done means the range changes through the method and remains changed after saving and reopening the project.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.