Home
Reply
Regular Contributor
xpz
Posts: 46

Help for 3D mesh - How to mesh multiple solids in a ENTITY_LIST?

[ Edited ]

We are testing ACIS 3D mesh. It works very good if there is only one solid in ENTITY_LIST, but if there are more than 1 solids in the list, the "api_va_generate_tet_mesh()" always fail.

 

Can you tell me what is the problem and how to solve it?

 

Following is the code:

 

    BODY *block1=NULL;
    BODY *block2=NULL;

    api_solid_block( SPAposition(0,0,0), SPAposition(50,50,50),block1);
    api_solid_block( SPAposition(50,0,0),SPAposition(100,50,50),block2);

    ENTITY_LIST e_list;
    e_list.add( block1 );
    e_list.add( block2 );

    // Generate a tet mesh using defaults for meshing options
    va_tetmesh* p_mesh = NULL; 
    va_tet_mesh_options opts;
    opts.setGrowthRate( 1.3 );
    opts.setTargetEdgeLength( 20.0 );

    va_surface_mesh_options surf_opts;
    surf_opts.setTargetEdgeLength( 20 ); 
    surf_opts.setMinEdgeLength( 0.5 );

    if( api_va_generate_tet_mesh(e_list, p_mesh, &surf_opts, &opts).ok() )
    {
		// output mesh
		{
			ofstream of( "tet_mesh.txt" );
			int nNoEle;
			api_va_get_element_count( (va_mesh*)p_mesh, nNoEle );
			of << nNoEle << "\n";
		}
        api_va_delete_mesh((va_mesh*)p_mesh);
    }

    // release BODY
    api_del_entity( block1 );
    api_del_entity( block2 );

 Thanks in advance.

Spatial Moderator
ybiyani
Posts: 223

Re: Help for 3D mesh - How to mesh multiple solids in a ENTITY_LIST?

Hello xpz,

 

The api_va_generate_tet_mesh has journaling capability. Can you please journal the api and send us the results as that will speed up the investigation?

 

Regards,

Yogesh

Regular Contributor
xpz
Posts: 46

Re: Help for 3D mesh - How to mesh multiple solids in a ENTITY_LIST?

Following is our new code with API journaling, attached is the journal output

 

// Create an AcisOptions object and initialize journalling
AcisOptions * ao = ACIS_NEW AcisOptions(); 
api_start_journal(ao); 

// Create solids
BODY *block1=NULL;
BODY *block2=NULL;

api_solid_block( SPAposition(0,0,0), SPAposition(50,50,50),block1, ao);
api_solid_block( SPAposition(50,0,0),SPAposition(100,50,50),block2, ao);

ENTITY_LIST e_list;
e_list.add( block1 );
e_list.add( block2 );

// Generate a tet mesh using defaults for meshing options
va_tetmesh* p_mesh = NULL;

//
va_tet_mesh_options opts;
opts.setGrowthRate( 1.3 );
opts.setTargetEdgeLength( 20.0 );

va_surface_mesh_options surf_opts;
surf_opts.setTargetEdgeLength( 20 ); 
surf_opts.setMinEdgeLength( 0.5 ); 

// meshing
if( api_va_generate_tet_mesh(e_list, p_mesh, &surf_opts, &opts, ao).ok() )
{
	// output mesh
	{
		ofstream of( "tet_mesh.txt" );
		int nNoEle;
		api_va_get_element_count( (va_mesh*)p_mesh, nNoEle );
		of << nNoEle << "\n";
	}

	//
    api_va_delete_mesh((va_mesh*)p_mesh);
}

// release BODY
api_del_entity( block1 );
api_del_entity( block2 );

// Terminate journalling and delete the AcisOptions object
api_end_journal(ao); 
ACIS_DELETE ao;

 

Regular Contributor
xpz
Posts: 46

Re: Help for 3D mesh - How to mesh multiple solids in a ENTITY_LIST?

We find the reason of why api_va_generate_tet_mesh() fail.

 

If the solids in the ENTITY_LIST is adjacent (touching or intersect), api_va_generate_tet_mesh() always fail.

 

But our purpose is creating conformal mesh on several adjacent solids. We find a way to make it work: firstly make non-regularized unite on all solids, then mesh. There is one problem in this method. We need to know which mesh element belonging to which original solids. But after union, all solids infomation are loss (only a united solid left), we can not use  api_va_get_entity() to obain the information.

 

Does anybody have example code to show how to mesh several adjacent solids and query the mesh element belonging to which original body?

 

One more question, how to obtain the conectivity information of mesh element, for example, given a mesh element (a tetrahedron), how to get the adjacent (connecting) mesh elements (tetrahedrons),

 

Thanks in advance.

 

Spatial Employee
RTadlock
Posts: 40

Re: Help for 3D mesh - How to mesh multiple solids in a ENTITY_LIST?

Doing a non-regularized unite is the proper way to prepare your geometry for the mesher. To create double-backed faces in a tet-mesh, you need to first create a surface mesh with double backed faces and the use that mesh to create a tet mesh. Here is some code:

// create a surface mesh with given options

va_surfmesh* sur_mesh = NULL;
va_surface_mesh_options surf_opts;

surf_opts.setEnableIntSurfBack( true );

api_va_create_surface_mesh( sur_mesh, &surf_opts );

// now create the tet mesh

va_tetmesh* tet_mesh = NULL;
api_va_generate_tet_mesh( sur_mesh, tet_mesh );

 

 

You can then use the following functions to get information about the mesh and body topology:

 

api_va_get_entityeda:element-entitiesGiven an element extract the face, edge or vertex entity associated with it.
api_va_get_elementseda:entity-elementsGiven an entity, extract the elements associated with it.
api_va_get_node_entitieseda:node-entitiesGiven a node, extract the entities associated with it.
api_va_get_nodeseda:entity-nodesGiven an entity, extract the nodes associated with it.

 

Check out the following documentation regarding how to then query the mesh you created:

http://doc.spatial.com/index.php/EDA_Querying

Please let me know if this helps you, or if this is not what you're looking for.