Home
Reply
Contributor
bryn
Posts: 20

Merging multiple solids to obtain conforming multi-material surface mesh

I am trying to create a tool, which takes two BODYs (like two cubes, which share one face), and returns a conforming surface mesh of the combined region.

 

I do not want to use the Union of the two BODYs, since the resulting mesh should represent a multi-material/multi-domain conforming mesh.

 

I have tried the following:

 

 

api_boolean(body1, body2_copy, UNION); // result in second argument body2_copy

api_imprint_stitch(body2_copy, body2); // result in first argument body2_copy

 

 

this creates a BODY with an interface between body1 and body2. However, the (non interface) faces from body2 are duplicated in the final result. Stitching adds those from the <union of body1 and body2> and again the same from body2.

 

How can I avoid this behavior, or safely remove the duplicate faces?

 

 

Thanks a lot

Bryn

 

 

 

 

 

 

Spatial Moderator
rbagley
Posts: 120

Re: Merging multiple solids to obtain conforming multi-material surface mesh

Hello Bryn,

 

You want to perform a "non-regularized unite".  The concept is explained here:

http://doc.spatial.com/index.php/Regularized_and_Non-regularized_Boolean_Operations

 

Best regards,

Ray Bagley

Contributor
bryn
Posts: 20

Re: Merging multiple solids to obtain conforming multi-material surface mesh

Hi Ray

 

Thanks a lot for the quick reply.

 

I tried this method ("non-regularized unite") as well. However, I end up with nearly the same problem.

 

If the two bodies share only a face, this will deliver a body with one face (the interface) which is double-sided.

Is there a method, which can I make a double-sided face single sided again? Otherwise the faceting will produce noncorming triangle meshes at the interface.

 

Thanks a lot!

 

Best regards

Bryn

 

 

 

 

Contributor
bryn
Posts: 20

Re: Merging multiple solids to obtain conforming multi-material surface mesh

OK, I think I have managed to get it to work.

 

Basically I did following three steps:

 

1. Unite Bodies (b1, b2) -> b12

2. Imprint Bodies (b1, b12) -> b1', b12'
3. Nonreg Unite Bodies (b1', b12') -> final result

 

Is this the typical way how this problem is solved, or is there a better/more robust way?

 

Best regards

Bryn

Spatial Moderator
rbagley
Posts: 120

Re: Merging multiple solids to obtain conforming multi-material surface mesh

I think that's a redundant workflow - I'll get somebody more expert to chime in.

Spatial Employee
asdf
Posts: 93

Re: Merging multiple solids to obtain conforming multi-material surface mesh

Dear Bryn

 

My name is Eric Zenk.  I have a phd in math and have worked at spatial for the last three plus years, specializing on the ACIS faceter and some other pieces of core functionality.  Ray asked me to follow up here with you.  I will do what I can to help, but I need a better high level understanding of what you are trying to do to give you useful advice.

 

You used the words "conforming mesh" to describe what you are trying to make.  My first guess at what you are doing, is you have two separate ACIS BODY objects and you want to facet them so the facets on the coincident regions are the same.  Is this correct?  One might also want to construct a block mesh for some types of analysis.  Is a block mesh or some other sort of 3D object (tets, blocks,...) the aim?

 

The other main piece of information I get from the message thread is that the two BODY objects whose meshes must conform is that they are made from different material.  What is the compatibility requirement across the material boundary?

 

best regards

 

Eric

Spatial Employee
asdf
Posts: 93

Re: Merging multiple solids to obtain conforming multi-material surface mesh

Hi again Bryn

 

I just reread the thread and I think I am getting a clearer picture of what is going on. To answer my own question, you are looking for a surface mesh (which may or may not be triangular).  Are you using our faceter and/or some other meshing tool to make the surface mesh?

 

It looks like your objection to nonreg unite is that you get a double sided face on the shared region between the two bodies.  Why is this undesirable for you?  The two sided face in ACIS terms, means that there is material on each side.  Perhaps you are looking to retain some distinction between the two materials.  The cellular topology component in ACIS was designed to handle this type of situation.

 

Does the double sidedness of the face effect the surface mesh?  If so how?

 

Eric

Contributor
bryn
Posts: 20

Re: Merging multiple solids to obtain conforming multi-material surface mesh

Hi Eric

 

Thanks for your reply.

 

The larger picture is the following. I would like to have an application, where the user creates multiple bodies, which might share a face, or might even be overlapping.

 

From this collection of bodies, I want to create a triangle surface mesh using the ACIS faceting function, which represents the individual bodies.

a) If I have two cubes, which share a face, the application should create a triangle mesh of the outer surface of the two cubes plus the interface between the two cubes. The interface and the outer surface should share the same edge in the mesh, i.e. should have the same number and position of points.

b) If I have two overlapping bodies, maybe a sphere and a cube, I assume body1 has priority over body2 and will define the interface between both domains. This case is like the one in a) but I first need to remove the overlapping region from body2.

 

From the resulting triangle mesh, I will use a software to create a tetrahedral mesh.

 

We might also try the Spatial tetrahedral mesh generator, however, currently we do not have the product and I would like to get our own tetrahedral mesh generator to work on the ACIS bodies.

 

It would be great if you can give me an idea if my suggested workflow could be improved and if it will be robust also for complicated bodies, and more than two input bodies.

 

Also, is it possible to label bodies and such that I know if a face originated from body1 or body2, or is an interface between body1/body2? Could this be done with attributes, or is this functionality already in ACIS modeler?

 

Thanks.

 

Best regards

Bryn

Spatial Employee
asdf
Posts: 93

Re: Merging multiple solids to obtain conforming multi-material surface mesh

Hi Bryn

 

I think generic attributes, and nonreg unite provide a good way to do both workflows.  The idea is that you can label all the faces on both bodies with some tag so that you can tell where all the faces in the result cam from.  The summary documentation about generic attributes is at http://doc.spatial.com/qref/ACIS/html/ga__api_8hxx.html.  The workflow as follows:

 

1) Use a distinctive label to label each face of each BODY that you are about to operator on.  Use api_get_faces to get all the faces of each body.  For each face use api_add_generic_named_attribute to add that the label for that BODY to the face.  In a real application, it may make sense to label the body with the material it is made of or something else physically relevant.  The code for this is something like

 

ENTITY_LIST faces;

api_get_faces(body1, faces);

ENTITY* this_face=NULL;

for( faces.init(); this_face=faces.next(); )

{

api_add_generic_named_attribute(this_face,"fromBody1", SplitCopy, MergeKeepAll );

}

 

The third and forth arguments to the api are very important because they specify that if you make a new face by splitting or merging this_face any resulting faces will have the same attribute copied on to them.

 

2)  Do a non reg boolean unite to get one body where everything is imprinted together.

 

3)  Use api_get_faces again to get all the faces on the result of the nonreg boolean.  For each two sided face, look for the named attributes you gave to each BODYs faces.

 

You can find the attributes with 

 

ATTRIB_GEN_NAME* returned_attrib=NULL;

api_find_named_attribute(this_twosided_face, name, returned_attrib);

 

where in this case name will either be "fromBody1" or "fromBody2".  If the api call finds an attribute, the returned_attrib variable will be nonnull.  A face which resulted from coincident faces on body1 and body2 will have both a "fromBody1" and "fromBody2" label attached.  Interior faces which come from one or the other body can also be identified this way.

 

4) Remove any faces you don't want by using api_unhook_faces to take them out of the body and api_del_entity to delete the faces.

 

5) Call the faceter.  For applications where you are making a tet mesh with the results it may be a good idea to use facet_options_precise and specify an aspect ratio, to help avoid getting triangles whose normal is inverted relative to their surface.  You can get the mesh output in various formats using a mesh manager, but that is another long story.  See http://doc.spatial.com/index.php/Mesh_Managers for more details.  I would imagine you either want to use the default mesh manager (INDEXED), or a global indexed mesh manager (which will make one big array of vertices for all the points in the mesh and reference triangles from that.  This is different from INDEXED_MESH_MANAGER where you get a separate mesh for each face, and the mesh edges along acis EDGE objects are duplicated.)

 

hope this helps

 

Eric

Contributor
bryn
Posts: 20

Re: Merging multiple solids to obtain conforming multi-material surface mesh

Hi Eric

 

Thanks a lot for the detailed answer. I think this gives me a lot to work on. Thanks a lot!

 

Best regards

Bryn