Python API Mesh Commands

Hi

I’m importing an exodus file, and Im using the python API (Cubit 2021.5) to do some querying.

I’m wondering if I’m doing something wrong, but there are number of mesh-relevant commands that dont behave as I expect. In this instance, an example would be

   num_nodeset = cubit.get_nodeset_count()
   num_sideset = cubit.get_nodeset_count()

Which both return 0, where as the same model in the Cubit GUI shows me 5 sidesets. However, get_block_count works fine.

Simillarly,

blocks = cubit.parse_cubit_list("block","all")      

Tells me I have 3 blocks, with ids 1,2 and 200002, when I pass that to get_block_tets() I get nothing.

So I’m a little confused, is there some setup i have to do to populate some data structures to make Cubit aware, or am doing something wrong?

Thanks

Andy

Is this a typo? The second command should be

num_sideset = cubit.get_sideset_count()

With a trivial model in Cubit 2021.5 I get the correct results

brick x 10
vol 1 copy move x 12
mesh vol all
sideset 1 add surface 5 11  
sideset 2 add surface 1 7  
sideset 2 add surface 1 7  
nodeset 1 add surface 12  
nodeset 2 add surface 4  
nodeset 3 add surface 3 9  

cubit.get_nodeset_count() returns 3 and cubit.get_sideset_count() returns 2

Hi Karl

I think the first one was my bad, that one is fine.

However, cubit.get_block_tets(1) returns nothing

Thanks

Andy

Hi Andy,

The way the get_block_* functions work may not be what you anticipated. The function returns the entities that were specifically added to the block.

If you do the following:

brick x 10
vol 1 scheme tetmesh
mesh vol 1
block 1 tet all

and then execute

cubit.get_block_tets(1)

you will get the list of tetrahedra in the block.

If instead of adding the tets, you do

block 1 vol 1

you will get no tets returned because the only entity added to the block was the volume.

Does that make sense?

– Karl