Importing Quad Mesh from *.obj or *.ply

I would like to use Trelis to process an existing open quadrilateral mesh, but I am struggling to import the mesh. Specifically, while the file I import is a *.obj (or *.ply) object with quadrilateral elements (see attached image), when I import to Trelis, the object is immediately triangulated (again, see attached image). How does one go about importing a (open) quadrilateral mesh into Trelis?

Thanks.
trelis_triangulation.png
quad_mesh.png

While the mesh contains quads, an .OBJ file is made up of triangles. Each quad element will be saved as two triangles when exporting to .OBJ format. You can see this in the picture of triangles.

Often the triangle facets of an .OBJ or .STL file are not ideal for analysis, so deleting the mesh and re-meshing with Trelis will give you a much nicer mesh. When you import the .OBJ file, you can check the Create Geometry option and then delete the mesh to get the facet-based geometry. Set the meshing scheme on the facet geometry and mesh it with a new mesh.

Also, facet geometry in Trelis is not a solid like a .STEP, SolidWorks, or Parasolid file would be, so you will be limited in what you can do t0 the model in Trelis. For example, you cannot cut the model or remove surface like you could a solid model.

Thanks for your reply.

I agree that formats such as STL indeed are saved as triangulations. However, perhaps I am mistaken, but I do not believe that OBJ (or PLY) files save as triangles. Specifically, by associating more than three vertices to one face, one arrives at a polygonal (e.g. quad) object (see e.g. en.wikipedia.org/wiki/Wavefront_.obj_file). For example, a basic square mesh can be described in OBJ format as a single (quad) element as:

v 0 0 0
v 0 1 0
v 1 1 0
v 1 0 0
f 1 2 3 4

Saving the above as an OBJ file and importing into Trelis will yield a two-element triangulation. However, importing the above into other software (such as Rhinoceros 6) gives a single-quad mesh. Similarly, PLY files should support quads.

Am I correct in understanding, then, that Trelis does not currently support importing of quad meshes in OBJ and PLY formats?

We can take a look at it. Are you able to share the file? Either on the forum or send it to support@coreform.com?

Of course. Thank you.

If not, is there another file format I can use to import a quadrilateral mesh into Trelis? STEP, IGES, and ACIS all take BREPs instead of meshes; OBJ and PLY seem to be restricted to triangulations; STL is restricted to triangulations; and I am unfamiliar with the other file formats.

Thank you.

Hi @kendrick,

If you’re in a pinch, you could use Exodus. In case you’re not totally familiar with Exodus, it is the primary mesh format used by several national labs, and is the format for which Cubit is primarily designed to handle.

Exodus is part of the Sandia Engineering Analysis Code Access System (SEACAS) which is open-source. If you build the SEACAS library, you can get various tools that will help you convert Exodus into various “more-accessible” formats and from these formats into Exodus. For instance:

  • exotxt & txtexo
    • Converts to/from an ASCII text format
  • exo2mat & mat2exo
    • Converts to/from a Matlab .mat file (Personally, I like the -c flag)
  • exomatlab
    • Matlab function for interacting with an Exodus file (requies NetCDF Exodus me thinks)
  • exodus.py
    • A Python module that allows you to access, modify, create Exodus files

It might be easiest to create a simple Exodus quad mesh in Cubit, then use SEACAS to convert to your desired format. Read the manuals, study the formatting, then see if you can work with that.

Hi @gvernon,

Thank you for your reply. Really, all I need is an acceptable format for defining quadrilateral meshes that Trelis can read as quadrilateral meshes. So, if Trelis can read quad meshes from Exodus, it sounds like scripting a conversion from an *.obj file to Exodus is the way to go.

Again, thank you much!

@kendrick ,

Even better is that we can avoid scripting altogether! If you are able to open the OBJ file in ParaView you can then export the data out as Exodus. Here’s an example walkthrough:

ParaView

  1. Read OBJ file into ParaView
  2. Select the OBJ file in the pipeline, then click on the Save Data icon
    image
  3. Select Exodus as the filetype

Cubit

  1. In Cubit, import the Exodus file using one of the Import Options based on whatever works in your workflow
    image
    • Mesh Geometry - Will create “Facet Based Geometry” in Cubit that you can remesh / webcut / etc.
    • Free Mesh - Will just create the mesh elements, no geometry.
    • Lite Mesh - Probably no value to you over Free Mesh