7

I am now studying 3d models (stl files and etc) and how it is made from scratch. What software do I need to use to see what's inside the stl file like this:

solid dart
    facet normal 0.00000E+000 0.00000E+000 -1.00000E+000
        outer loop
            vertex 3.10000E+001 4.15500E+001 1.00000E+000
            vertex 3.10000E+001 1.00000E+001 1.00000E+000
            vertex 1.00000E+000 2.50000E-001 1.00000E+000
        endloop
    endfacet
endsolid dart

I have been searching for those kinds of software but so far, no luck.

Mike Kinghan
  • 55,740
  • 12
  • 153
  • 182
TerribleDog
  • 1,237
  • 1
  • 8
  • 31

5 Answers5

4

MeshLab (http://www.meshlab.net) is a widely used open source viewer for 3D models that handles well all the STL variants (and many other 3D files). Available for mac/win/linux

There is also an online version that runs in your browser http://www.meshlabjs.net

ALoopingIcon
  • 2,218
  • 1
  • 21
  • 30
  • 1
    Could I really see the text file inside the .stl file using this? – TerribleDog Dec 05 '18 at 00:57
  • You can't use this tool to convert .stl binary files to ASCII text – Ken May 12 '21 at 21:05
  • If you just want to see the coords of the file you can easily use https://www.meshlabjs.net/ to convert .stl binary to ASCII text format, by saving it into .off format – ALoopingIcon May 13 '21 at 06:24
  • 2
    Yes, you can use this to convert to stl ASCII - just unclick "use binary encoding" when exporting the file. – skjerns Jul 27 '21 at 13:57
  • He says : " I am now studying 3d models " , He asks " STL file to a readable text file" in stackoverflow. You advertise a viewer. I inspect the website no conversion possible. let alone viewing 3d visual while modifying file. – Gediz GÜRSU Mar 01 '22 at 11:51
3

STL files are available in ASCII format as well as in binary format. Most STL files are in binary format and can not be opened as text. To change the format, a CAD program can be used (change options in "Save as").

In ASCII format, the representation is as follows:

solid dart
    facet normal 0.00000E+000 0.00000E+000 -1.00000E+000
        outer loop
            vertex 3.10000E+001 4.15500E+001 1.00000E+000
            vertex 3.10000E+001 1.00000E+001 1.00000E+000
            vertex 1.00000E+000 2.50000E-001 1.00000E+000
        endloop
    endfacet
endsolid dart

Thus, only the ASCII format allows manual checking of the coordinates of the vertices.

Wai Ha Lee
  • 8,598
  • 83
  • 57
  • 92
Malte
  • 31
  • 2
2

numpy-stl does what you want:

import stl
from stl import mesh

your_mesh = mesh.Mesh.from_file('INPUT.stl')
your_mesh.save('OUTPUT.stl',mode=stl.Mode.ASCII)

However if you want it to do by binary conversion, use this program I wrote in Python3 using this reference.

import struct
def ffb(x): 
    return str(round(struct.unpack('f',x)[0],6))
f=open('3dtest.stl','rb')
print(f.read(84))
temp=''
for j in range(4):
    temp='facet normal: '
    for i in range(3):
        temp=temp+ffb(f.read(4))+' '
    print (temp)

    for n in range(3):
        temp='vertex: ' 
        for i in range(3): 
            temp=temp+ffb(f.read(4))+' ' 
        print (temp) 
    attr=f.read(2)
    print('###################################')
   
f.close()
temp=temp[:-1]
print(temp)

Result:

b'MESH-MESH-MESH-MESH-MESH-MESH-MESH-MESH-MESH-MESH-MESH-MESH-MESH-MESH-MESH-MESH\n\x0c\x00\x00\x00'
facet normal: 0.0 1.0 0.0 
vertex: 12.671906 11.296659 0.0 
vertex: -11.984282 11.296659 0.0 
vertex: -11.984282 11.296659 10.0 
###################################
facet normal: 0.0 1.0 -0.0 
vertex: 12.671906 11.296659 0.0 
vertex: -11.984282 11.296659 10.0 
vertex: 12.671906 11.296659 10.0 
###################################
facet normal: 1.0 0.0 0.0 
vertex: 12.671906 -10.8055 0.0 
vertex: 12.671906 11.296659 0.0 
vertex: 12.671906 11.296659 10.0 
###################################
facet normal: 1.0 0.0 0.0 
vertex: 12.671906 -10.8055 0.0 
vertex: 12.671906 11.296659 10.0 
vertex: 12.671906 -10.8055 10.0 
###################################

Same binary STL converted to text via numpy-stl:

solid MESH-MESH-MESH-MESH-MESH-MESH-MESH-MESH-MESH-MESH-MESH-MESH-MESH-MESH-MESH-MESH
facet normal 0,000000 246,561890 0,000000
  outer loop3
    vertex 12,671906 11,296659 0,000000
    vertex -11,984282 11,296659 0,000000
    vertex -11,984282 11,296659 10,000000
  endloop
endfacet
facet normal 0,000000 246,561890 -0,000000
  outer loop
    vertex 12,671906 11,296659 0,000000
    vertex -11,984282 11,296659 10,000000
    vertex 12,671906 11,296659 10,000000
  endloop
endfacet
facet normal 221,021591 0,000000 0,000000
  outer loop
    vertex 12,671906 -10,805500 0,000000
    vertex 12,671906 11,296659 0,000000
    vertex 12,671906 11,296659 10,000000
  endloop
endfacet
facet normal 221,021591 0,000000 0,000000
  outer loop
    vertex 12,671906 -10,805500 0,000000
    vertex 12,671906 11,296659 10,000000
    vertex 12,671906 -10,805500 10,000000
  endloop
endfacet

numpy-stl code:

import stl
from stl import mesh
your_mesh = mesh.Mesh.from_file('INPUT.stl')
your_mesh.save('OUTPUT.stl',mode=stl.Mode.ASCII)

I advise you to put 3d plotting on a loop via any language or renderer. Forward errors to /dev/null and edit the file seeing what happens in realtime. I think that would be the best possible study. Of course while checking out sample output of the various geometry in another window.

user16217248
  • 3,119
  • 19
  • 19
  • 37
Gediz GÜRSU
  • 555
  • 4
  • 12
0

You can use the open-source STL-Viewer software I made. It supports both Binary and ASCII formatted STL files. Here is the link: https://github.com/batu92k/STL-Viewer

Batu92k
  • 1
  • 2
0

Download MeshLab, Import your stl file, Export it as an stl file when you uncheck binary encoding

OR

Download FreeCAD, Import your stl file, Export it as an ast file

Open the exported file with a text editor

Y.S.
  • 157
  • 1
  • 11