ansys / ansys/pymodelcenter

Potential bug with 'create_component' method with DOE component as parent

Open
#271 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Python
Stars
6
Forks
1
Avg merge
30m
Merged PRs (30d)
2

Description

### 🔍 Before submitting the issue

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

### 🐞 Description of the bug

I'm trying to create an example trade study script that adds the DOE Tool and a new Quadratic into the 'BasicExample.pxcz' workflow (process workflow that has single Quadratic component) in the repo's examples directory (https://github.com/ansys/pymodelcenter/blob/main/examples/BasicExample.pxcz).

To accomplish this, need to use the 'create_component' for the new Quadratic component and specify the newly created DOE component as the parent. This gives a "bad argument type for built-in operation" type error which from what I can tell is another "not an assembly" error.

Conversely, the 'create_component' method doesn't have any issue with the Opt Tool component not being an assembly. In the 'test_create_and_run_optimizer_very_basic' function of the 'test_workflow.py' unit test script (https://github.com/ansys/pymodelcenter/blob/main/integration/test_workflow.py), it programmatically creates the workflow, Opt Tool component, and Quadratic component from scratch. It uses the 'create_component' method for the Quadratic component creation and specifies the Opt Tool component as the parent. This works without issue, in that the Quadratic component is successfully created under the Opt Tool component (also detailed in issue #268)

### 📝 Steps to reproduce

Attached is a script to demonstrate the issue (TradeStudy_DOE_createComponent.py).

To reproduce:
1. Copy script and BasicExample.pxcz to a folder on a machine with PyMC configured
2. Open command line in folder or 'cd' to folder
3. Run script using "python TradeStudy_DOE_createComponent.py". Will receive Type Error when script attempts to create new Quadratic component with DOE component specified as parent

[TradeStudy_DOE_createComponent.py](https://github.com/user-attachments/files/24681113/TradeStudy_DOE_createComponent.py)

### 💻 Which operating system are you using?

Windows

### 📀 Which ANSYS version are you using?

25R2

### 🐍 Which Python version are you using?

3.13

### 📦 Installed packages

```shell
ansys-api-modelcenter==0.3.4
ansys-api-platform-instancemanagement==1.1.3
ansys-engineeringworkflow-api==0.1.2
ansys-modelcenter-workflow==0.1.3
ansys-platform-instancemanagement==1.1.2
ansys-tools-common==0.4.0
anyio==4.12.1
appdirs==1.4.4
certifi==2026.1.4
cfgv==3.5.0
charset-normalizer==3.4.4
click==8.3.1
colorama==0.4.6
distlib==0.4.0
filelock==3.20.3
grpcio==1.76.0
identify==2.6.16
idna==3.11
importlib_metadata==8.7.1
nodeenv==1.10.0
numpy==2.4.1
overrides==7.7.0
platformdirs==4.5.1
pre_commit==4.5.1
protobuf==6.33.4
pyansys-tools-variableinterop==0.1.2
PyYAML==6.0.3
requests==2.32.5
scooby==0.11.0
typing_extensions==4.15.0
urllib3==2.6.3
virtualenv==20.36.1
zipp==3.23.0
```

Contributor guide

Open the contributing guide

Research direction

Run TradeStudy_DOE_createComponent.py with examples/BasicExample.pxcz to reproduce the type error when a DOE component is the parent. Compare that path with test_create_and_run_optimizer_very_basic in integration/test_workflow.py, where an Opt Tool parent works. Done means creating the Quadratic component under the DOE component succeeds without the error.

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
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.