How to open an STL Mesh file in Linux

In summary, the conversation revolves around issues with opening and editing a binary STL file. The individual is attempting to use vi to open the file but it is not showing any helpful information. They are also looking for a way to convert the file to ASCII format, which could allow for easier editing. Suggestions are made to use Blender or paraView to view and edit the file. Eventually, the individual is able to successfully open and edit the file using paraView.
  • #1
JD_PM
1,131
158
TL;DR Summary
I want to figure out how to open a STL file in Linux
I am building up a mesh via defining a background mesh (using blockMesh) and snappyHexMesh

I am dealing with the STL 2D Mesh surface (I cannot uploaded because PF doesn't accept zip files nor STL).

My issue comes when I want to open it. When I run vi constant/triSurface/river.stl in the linux terminal I get the following messy output

BugWhenOpeningSTLfile.png


This might be because I do not have an installed software (in Linux) to open the file. I looked up how to fix the problem (introducing the commands recommended in the most upvoted answer here: https://askubuntu.com/questions/247398/what-software-should-i-install-for-opening-stl-files) but it did not work.

Any help is appreciated :)
 
Technology news on Phys.org
  • #2
Vi doesn't show you anything helpful because the STL is a binary file, not a text file.

What do you want to do with the mesh? If you want to view and edit it then, as one of the askubuntu replies notes, Blender ought to be able to import it. Install it (it's free software and you can get it via apt/aptitude/whatever package manager you like) and go to File -> Import and one of the options should be STL. Be aware that Blender has a fairly steep learning curve.
 
  • Like
Likes JD_PM
  • #3
Google says there's plenty of ways to convert .stl files from binary to ascii.
 
  • #4
hmmm27 said:
Google says there's plenty of ways to convert .stl files from binary to ascii.
But converting a binary file to ascii might not be any help at all.
 
  • #5
Mark44 said:
But converting a binary file to ascii might not be any help at all.
gotta work better than vi .
 
  • #6
That's why I asked what OP wants to do.

There are both binary and ASCII STL formats, and converting the file to ASCII would allow text processing tools to modify it and allow direct manual viewing and editing in vi. It's only really practical for very simple meshes, but it can be done. Opening in Blender or similar would allow visualisation and editing.
 
  • #7
Ibix said:
Vi doesn't show you anything helpful because the STL is a binary file, not a text file.

What do you want to do with the mesh?

The main aim is not to visualize it (to do so I use paraView) but to check the text associated to it (yellow box).

437297987348274NNDNDJ732784.png


The point of this is that, later in the tutorial, I split the STL file, open the generated STL file and compare it to the first

437297987348274NNDNDJ732784.png
 
  • #8
The problem is that there are both binary and ASCII formats for STL files. You have a binary file but the notes assume you have an ASCII file. You either need to tell the software that produced the file to produce an ASCII STL instead of a binary one (assuming that's possible in your program), or get a program to convert binary STLs to ASCII.
 
  • Like
Likes JD_PM
  • #9
Thank you Ibix, I got it! :biggrin:

Ibix said:
get a program to convert binary STLs to ASCII.

I used paraView, did this, run vi constant/triSurface/river.stl and it worked!
 
  • #10
Ibix said:
You either need to tell the software that produced the file to produce an ASCII STL instead of a binary one (assuming that's possible in your program), or get a program to convert binary STLs to ASCII.
Or do the editing in paraView itself - that is what it is for.
 

FAQ: How to open an STL Mesh file in Linux

1. How do I open an STL mesh file in Linux?

To open an STL mesh file in Linux, you can use a variety of 3D modeling software such as Blender, MeshLab, or OpenSCAD. These programs are available for free and can be installed through the Linux package manager or downloaded directly from their respective websites.

2. Can I open an STL mesh file in Linux without any additional software?

No, you will need to use a 3D modeling software to open an STL mesh file in Linux. However, there are some basic Linux command line tools such as STLView and STLTools that can provide a limited view of the mesh file.

3. How do I convert an STL mesh file to a different format in Linux?

You can use a 3D modeling software such as Blender or MeshLab to convert an STL mesh file to a different format in Linux. These programs have the ability to import and export various 3D file formats, including STL.

4. Is there a specific software that is best for opening STL mesh files in Linux?

There is no one "best" software for opening STL mesh files in Linux as it ultimately depends on your personal preference and the specific features you are looking for. However, popular options include Blender, MeshLab, and OpenSCAD.

5. Can I edit an STL mesh file in Linux?

Yes, you can edit an STL mesh file in Linux using a 3D modeling software. These programs offer various tools for editing and manipulating 3D objects, allowing you to make changes to the mesh file as desired.

Back
Top