Issue in embedded mode in unselecting contacts from the initial selected contacts from contact tool results
- Dominant language
- Python
- Stars
- 83
- Forks
- 37
- Avg merge
- 1d 3m
- Merged PRs (30d)
- 26
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 am not able to remove contacts from contact tool in embedded mode. It is coming with error.
### 📝 Steps to reproduce
I am inserting contact results in static analysis and removing all the tick marked contacts.
While removing contacts, I am facing this issue in embedded mode however it worked fine if we directly submit it through ACT console.
`#input_variables:
var_contact_name = "Frictional - pad_rotor_contact To pad_rotor_target" #string
var_Analysis_index=1
#pymechanical_commands:
contactList = Model.Connections.GetChildren(DataModelObjectCategory.ContactRegion,True)
myContactList = [contact for contact in contactList if contact.Name==var_contact_name]
listContactIds=[contact.ObjectId for contact in contactList] # list of ids of items in contactList
for contact in myContactList: # loop on all contacts in myContactList
newContactTool = Model.Analyses[var_Analysis_index].Solution.AddContactTool() # add a Contact Tool
#remove all scoped contacts
for id in listContactIds:
newContactTool.InternalObject.RemoveScopedContact(id)
# add scoping for contact
newContactTool.InternalObject.AddScopedContact(contact.ObjectId)`
### 💻 Which operating system are you using?
Windows
### 📀 Which ANSYS version are you using?
Ansys V2025R1
### 🐍 Which Python version are you using?
3.10
### 📦 Installed packages
```shell
(pyMechanical_demo) D:\pyAnsys\pyMechanical>python -m pip freeze
aiohappyeyeballs==2.6.1
aiohttp==3.12.13
aiosignal==1.3.2
ansys-api-mechanical==0.1.2
ansys-mechanical-core==0.11.21
ansys-mechanical-env==0.1.14
ansys-mechanical-stubs==0.1.6
ansys-pythonnet==3.1.0rc6
ansys-tools-path==0.7.3
ansys-tools-visualization-interface==0.10.0
anyio==4.9.0
appdirs==1.4.4
argon2-cffi==25.1.0
argon2-cffi-bindings==21.2.0
arrow==1.3.0
asttokens==3.0.0
async-timeout==5.0.1
attrs==25.3.0
beautifulsoup4==4.13.4
bleach==6.2.0
certifi==2025.6.15
cffi==1.17.1
charset-normalizer==3.4.2
click==8.2.1
clr_loader==0.2.7.post0
cmocean==4.0.3
colorama==0.4.6
colorcet==3.1.0
comm==0.2.2
contourpy==1.3.2
cycler==0.12.1
debugpy==1.8.14
decorator==5.2.1
defusedxml==0.7.1
exceptiongroup==1.3.0
executing==2.2.0
fastjsonschema==2.21.1
fonttools==4.58.4
fqdn==1.5.1
frozenlist==1.7.0
grpcio==1.73.0
idna==3.10
imageio==2.37.0
importlib_metadata==8.7.0
ipykernel==6.29.5
ipython==8.37.0
ipywidgets==8.1.7
isoduration==20.11.0
jedi==0.19.2
Jinja2==3.1.6
joblib==1.5.1
jsonpointer==3.0.0
jsonschema==4.24.0
jsonschema-specifications==2025.4.1
jupyter-events==0.12.0
jupyter_client==8.6.3
jupyter_core==5.8.1
jupyter_server==2.16.0
jupyter_server_proxy==4.4.0
jupyter_server_terminals==0.5.3
jupyterlab_pygments==0.3.0
jupyterlab_widgets==3.0.15
kiwisolver==1.4.8
markdown-it-py==3.0.0
MarkupSafe==3.0.2
matplotlib==3.10.3
matplotlib-inline==0.1.7
mdurl==0.1.2
meshio==5.3.5
mistune==3.1.3
more-itertools==10.7.0
msgpack==1.1.1
multidict==6.5.1
nbclient==0.10.2
nbconvert==7.16.6
nbformat==5.10.4
nest-asyncio==1.6.0
numpy==2.2.6
overrides==7.7.0
packaging==25.0
pandas==2.3.0
pandocfilters==1.5.1
parso==0.8.4
pillow==11.2.1
platformdirs==4.3.8
pooch==1.8.2
prometheus_client==0.22.1
prompt_toolkit==3.0.51
propcache==0.3.2
protobuf==5.29.5
psutil==7.0.0
pure_eval==0.2.3
pycparser==2.22
Pygments==2.19.2
pyparsing==3.2.3
python-dateutil==2.9.0.post0
python-json-logger==3.3.0
pytz==2025.2
pyvista==0.45.2
pywin32==310
pywinpty==2.0.15
PyYAML==6.0.2
pyzmq==27.0.0
referencing==0.36.2
requests==2.32.4
rfc3339-validator==0.1.4
rfc3986-validator==0.1.1
rich==14.0.0
rpds-py==0.25.1
scikit-learn==1.7.0
scipy==1.15.3
scooby==0.10.1
Send2Trash==1.8.3
simpervisor==1.0.0
six==1.17.0
sniffio==1.3.1
soupsieve==2.7
stack-data==0.6.3
terminado==0.18.1
threadpoolctl==3.6.0
tinycss2==1.4.0
tornado==6.5.1
tqdm==4.67.1
traitlets==5.14.3
trame==3.10.2
trame-client==3.9.1
trame-common==1.0.0
trame-server==3.4.2
trame-vtk==2.9.0
trame-vuetify==3.0.1
types-python-dateutil==2.9.0.20250516
typing_extensions==4.14.0
tzdata==2025.2
uri-template==1.3.0
urllib3==2.5.0
usd-core==25.5.1
vtk==9.4.2
wcwidth==0.2.13
webcolors==24.11.1
webencodings==0.5.1
websocket-client==1.8.0
websockets==15.0.1
widgetsnbextension==4.0.14
wslink==2.3.4
yarl==1.20.1
zipp==3.23.0
```
Contributor guide
Research direction
Start by reproducing the supplied contact-tool script in embedded mode with Ansys V2025R1, then compare it with the same flow through the ACT console. Focus on AddContactTool, RemoveScopedContact, and AddScopedContact; done means removing the initially selected contacts and adding the target contact completes without an error in embedded mode.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100