Skip to content

Add mesh related any casts#3324

Open
janvonrickenbach wants to merge 12 commits into
mainfrom
jvonrick/add_mesh_related_any_casts
Open

Add mesh related any casts#3324
janvonrickenbach wants to merge 12 commits into
mainfrom
jvonrick/add_mesh_related_any_casts

Conversation

@janvonrickenbach

@janvonrickenbach janvonrickenbach commented Jul 17, 2026

Copy link
Copy Markdown

I think they were just forgotten.

@github-actions

Copy link
Copy Markdown
Contributor

Please add one of the following labels to add this contribution to the Release Notes 👇

@github-actions

Copy link
Copy Markdown
Contributor

Please add one of the following labels to add this contribution to the Release Notes 👇

@codecov

codecov Bot commented Jul 17, 2026

Copy link
Copy Markdown

❌ 3 Tests Failed:

Tests completed Failed Passed Skipped
2455 3 2452 87
View the top 3 failed test(s) by shortest run time
tests\test_any.py::test_any::test_cast_meshed_region_any[gRPC CLayer]
Stack Traces | 0.008s run time
server_type = <ansys.dpf.core.server_types.GrpcServer object at 0x000001ADDE639000>

    @pytest.mark.skipif(
        not conftest.SERVERS_VERSION_GREATER_THAN_OR_EQUAL_TO_10_0,
        reason="any does not support operator below 10.0",
    )
    def test_cast_meshed_region_any(server_type):
        entity = dpf.MeshedRegion(server=server_type)
        entity.unit = "mm"
>       any_dpf = dpf.Any.new_from(entity)

tests\test_any.py:180: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.tox\test-api\lib\site-packages\ansys\dpf\core\any.py:276: in new_from
    any_dpf._internal_obj = type_tuple[0](obj)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

any = <ansys.dpf.core.meshed_region.MeshedRegion object at 0x000001ADDFA26470>

    @staticmethod
    def any_new_from_meshed_region(any):
    	errorSize = ctypes.c_int(0)
    	sError = ctypes.c_wchar_p()
    	res = capi.dll.Any_newFrom_meshedRegion(any._internal_obj if any is not None else None, ctypes.byref(utils.to_int32(errorSize)), ctypes.byref(sError))
    	if errorSize.value != 0:
>   		raise errors.DPFServerException(sError.value)
E     ansys.dpf.gate.errors.DPFServerException: Invalid API pointer when calling function Any_newFrom_meshedRegion

.tox\test-api\lib\site-packages\ansys\dpf\gate\generated\any_capi.py:482: DPFServerException
tests\test_any.py::test_any::test_cast_scopings_container_any[gRPC CLayer]
Stack Traces | 0.012s run time
server_type = <ansys.dpf.core.server_types.GrpcServer object at 0x000001ADDE639000>

    @pytest.mark.skipif(
        not conftest.SERVERS_VERSION_GREATER_THAN_OR_EQUAL_TO_10_0,
        reason="any does not support operator below 10.0",
    )
    def test_cast_scopings_container_any(server_type):
        entity = dpf.ScopingsContainer(server=server_type)
        entity.add_label("idx")
        entity.add_scoping({"idx": 0}, dpf.Scoping(server=server_type))
    
>       any_dpf = dpf.Any.new_from(entity)

tests\test_any.py:208: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.tox\test-api\lib\site-packages\ansys\dpf\core\any.py:276: in new_from
    any_dpf._internal_obj = type_tuple[0](obj)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

any = <ansys.dpf.core.scopings_container.ScopingsContainer object at 0x000001ADDFA6D120>

    @staticmethod
    def any_new_from_scopings_container(any):
    	errorSize = ctypes.c_int(0)
    	sError = ctypes.c_wchar_p()
    	res = capi.dll.Any_newFrom_ScopingsContainer(any._internal_obj if any is not None else None, ctypes.byref(utils.to_int32(errorSize)), ctypes.byref(sError))
    	if errorSize.value != 0:
>   		raise errors.DPFServerException(sError.value)
E     ansys.dpf.gate.errors.DPFServerException: Invalid API pointer when calling function Any_newFrom_ScopingsContainer

.tox\test-api\lib\site-packages\ansys\dpf\gate\generated\any_capi.py:392: DPFServerException
tests\test_any.py::test_any::test_cast_meshes_container_any[gRPC CLayer]
Stack Traces | 0.014s run time
server_type = <ansys.dpf.core.server_types.GrpcServer object at 0x000001ADDE639000>

    @pytest.mark.skipif(
        not conftest.SERVERS_VERSION_GREATER_THAN_OR_EQUAL_TO_10_0,
        reason="any does not support operator below 10.0",
    )
    def test_cast_meshes_container_any(server_type):
        entity = dpf.MeshesContainer(server=server_type)
        entity.add_label("idx")
        entity.add_mesh({"idx": 0}, dpf.MeshedRegion(server=server_type))
    
>       any_dpf = dpf.Any.new_from(entity)

tests\test_any.py:194: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.tox\test-api\lib\site-packages\ansys\dpf\core\any.py:276: in new_from
    any_dpf._internal_obj = type_tuple[0](obj)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

any = <ansys.dpf.core.meshes_container.MeshesContainer object at 0x000001ADDFA47160>

    @staticmethod
    def any_new_from_meshes_container(any):
    	errorSize = ctypes.c_int(0)
    	sError = ctypes.c_wchar_p()
    	res = capi.dll.Any_newFrom_MeshesContainer(any._internal_obj if any is not None else None, ctypes.byref(utils.to_int32(errorSize)), ctypes.byref(sError))
    	if errorSize.value != 0:
>   		raise errors.DPFServerException(sError.value)
E     ansys.dpf.gate.errors.DPFServerException: Invalid API pointer when calling function Any_newFrom_MeshesContainer

.tox\test-api\lib\site-packages\ansys\dpf\gate\generated\any_capi.py:428: DPFServerException

To view more test analytics, go to the Test Analytics Dashboard
📋 Got 3 mins? Take this short survey to help us improve Test Analytics.

@github-actions

Copy link
Copy Markdown
Contributor

Please add one of the following labels to add this contribution to the Release Notes 👇

@rafacanton

Copy link
Copy Markdown
Collaborator

@janvonrickenbach You will need a couple of methods in https://github.com/ansys/pydpf-core/blob/main/src/ansys/dpf/gate/any_grpcapi.py to make this pass. You can take this as an example: #3155

@janvonrickenbach
janvonrickenbach requested a review from a team as a code owner July 21, 2026 07:27
@github-actions

Copy link
Copy Markdown
Contributor

Please add one of the following labels to add this contribution to the Release Notes 👇

Comment thread src/ansys/dpf/gate/any_grpcapi.py Outdated
(generic_support.GenericSupport, base_pb2.Type.GENERIC_SUPPORT),
(cyclic_support.CyclicSupport, base_pb2.Type.CYCLIC_SUPPORT),
(meshed_region.MeshedRegion, base_pb2.Type.MESHED_REGION),
(meshes_container.MeshesContainer, base_pb2.Type.MESHES_CONTAINER),

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
(meshes_container.MeshesContainer, base_pb2.Type.MESHES_CONTAINER),
(meshes_container.MeshesContainer, base_pb2.Type.COLLECTION, base_pb2.Type.MESHED_REGION),

@github-actions

Copy link
Copy Markdown
Contributor

Please add one of the following labels to add this contribution to the Release Notes 👇

@github-actions

Copy link
Copy Markdown
Contributor

Please add one of the following labels to add this contribution to the Release Notes 👇

@github-actions

Copy link
Copy Markdown
Contributor

Please add one of the following labels to add this contribution to the Release Notes 👇

@github-actions

Copy link
Copy Markdown
Contributor

Please add one of the following labels to add this contribution to the Release Notes 👇

Comment thread src/ansys/dpf/gate/any_grpcapi.py Outdated
Comment thread src/ansys/dpf/gate/any_grpcapi.py Outdated
Comment thread src/ansys/dpf/gate/any_grpcapi.py Outdated
janvonrickenbach and others added 3 commits July 21, 2026 14:42
Co-authored-by: Rafael Canton <107186344+rafacanton@users.noreply.github.com>
Co-authored-by: Rafael Canton <107186344+rafacanton@users.noreply.github.com>
Co-authored-by: Rafael Canton <107186344+rafacanton@users.noreply.github.com>
@github-actions

Copy link
Copy Markdown
Contributor

Please add one of the following labels to add this contribution to the Release Notes 👇

Comment thread src/ansys/dpf/gate/any_grpcapi.py Outdated
Co-authored-by: Rafael Canton <107186344+rafacanton@users.noreply.github.com>
@github-actions

Copy link
Copy Markdown
Contributor

Please add one of the following labels to add this contribution to the Release Notes 👇

@janvonrickenbach

Copy link
Copy Markdown
Author

@rafacanton Thanks for the suggestions and fixes. I'm still getting these kind of errors in the CLayer:

any = <ansys.dpf.core.meshed_region.MeshedRegion object at 0x7f5bfff8fac0>

  @staticmethod
  def any_new_from_meshed_region(any):
  	errorSize = ctypes.c_int(0)
  	sError = ctypes.c_wchar_p()
  	res = capi.dll.Any_newFrom_meshedRegion(any._internal_obj if any is not None else None, ctypes.byref(utils.to_int32(errorSize)), ctypes.byref(sError))
  	if errorSize.value != 0:
	raise errors.DPFServerException(sError.value)

E ansys.dpf.gate.errors.DPFServerException: Invalid API pointer when calling function Any_newFrom_meshedRegion

Any ideas?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants