CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM Meshing Format & General Technical (
-   -   binary or ascii stl? (

Calobra February 24, 2010 07:15

binary or ascii stl?
Just received a stl file produced with ProE.
I loaded it to ParaFOAM and the geometry was nicely reproduced.
Now my plan was to follow the motorcycle tutorials but with my geometry instead.
When running surfaceCheck only mishmash comes out.
I guess my stl is binary. Do I need a new stl or how can I use the one that I have?
ruben@ruben-desktop:~/OpenFOAM/ruben-1.6.x/run/KFA/constant/triSurface$ surfaceCheck KFA.stl > log.surfacecheck
word::stripInvalid() called for word ��tC�U�C
For debug level (= 2) > 1 this is considered fatal

olesen February 25, 2010 04:00


Originally Posted by Calobra (Post 247199)
I guess my stl is binary. Do I need a new stl or how can I use the one that I have?
ruben@ruben-desktop:~/OpenFOAM/ruben-1.6.x/run/KFA/constant/triSurface$ surfaceCheck KFA.stl > log.surfacecheck

If it is binary, try renaming to *.stlb so that OpenFOAM knows to treat it as a binary STL.

elvis August 31, 2010 08:38


If you have the Package "python-vtk" (as is called for debian) installed. You can convert your ASCII-type STL into a BINARY-Type STL file or vice versa.

PHP Code:
#!/usr/bin/env python
import vtk
reader = vtk.vtkSTLReader()
# path to binary or ascii stl file to be converted
write = vtk.vtkSTLWriter()
#uncomment unnecessary 2Ascii or 2Binary

# path to

this script converts Binary.STL -> ASCII.STL
and ASCII.STL-> Binary.STL



anjansir December 1, 2011 07:28

stl giving error in FOAM
1 Attachment(s)
Hello everyone,

I am trying to go for a snappyHexMesh for my own STL file. Like Calobra said, I can also see my file in paraView too. blockMesh is running fine but "snappyHexMesh" is giving error. I have attached the error clip in attachment. Can anyone help me please where I am wrong.

I followed the below steps as given in the userguide.

1. I have put the file in the "trisurface" folder located below. $run.../.../incompressible/pimpleDyMFoam/wingMotion/wingMotion_snappyHexMesh/constant/trisurface.

2. Changed the old filename to new (i.e. test.stl) inside the "snappyHexMeshDict" within "system" folder.

Please help...

colinB December 2, 2011 05:09

it is a little bit hard to tell what is wrong in particular, but the error message
looks to me like you eventually forgot a bracket or a semicolon, but it is easier
to say if you attach your sHMD file so we can have a look at it.

And since you didn't mention it specifically: you have a blockMesh background mesh?


anjansir December 6, 2011 02:01

stl giving error in FOAM
Hi colinB,

Yes, I used a blockMesh background.

I could not understand what is sHMD file ? Can you help me how to get it ?

thanks, anjansir.

colinB December 6, 2011 03:49

sHMD = snappyHexMeshDict

likewise there is

bMD for blockMeshDict and so on

anjansir December 6, 2011 04:29

stl giving error in FOAM
1 Attachment(s)
Oh thanks. I attached the two files i.e. both sHMD and bMD.

Thanks, Anjan.

colinB December 6, 2011 05:06


I just had a look at it and found the failure:

you wrote:

type triSurfaceMesh;

but it has to be written like this:

type triSurfaceMesh;
name ******;

instead of the stars you put the name of the solid of your .stl file which looks like:


solid any_object

facet normal -0.52733372213947194 0.7512430031456685 0.39692958534128875
    outer loop
      vertex 234.52195739746094 -0.67765188217163086 19.251394271850586
      vertex 234.73222351074219 -0.53262174129486084 19.256250381469727
      vertex 234.39920043945313 -0.48949074745178223 18.732187271118164

endsolid any_object

then the stars after name would be named any_object

Note that you have to specify the solids name elsewhere in the sHMD as well
see therefore also the motorbike tutorial and compare there the stl file and the sHM which helps quite a lot for understanding sHM

I hope I explained everything well


anjansir December 6, 2011 08:03

STL Error corrected
Thanks a lot Colin for your help. The model is now recognized perfectly by OpenFOAM. The mesh looks pretty interesting now..

Regards, Anjan.

anjansir December 8, 2011 07:58

blockMesh editing
1 Attachment(s)
Hi Colin,

I am trying to change the vertices inside the blockMesh file. I am trying to generate a cube having all sides equal. The changed vertices are as below.

(-2 -2 0)
(2 -2 0)
(2 2 0)
(-2 2 0)
(-2 -2 4)
(2 -2 4)
(2 2 4)
(-2 2 4)

Now as per my knowledge it should create a cubical domain having all sides equal but when I am running blockMesh it is generating the default geometry which it was generating before editing the file. I have attached the snapshot in the attachment after opening the domain in paraFoam. Can you please help where I am mistaken.

colinB December 8, 2011 08:29

try deleting all contents of the polyMesh folder except the bMD file and then
run blockMesh again.
this should work

anjansir December 9, 2011 06:21

blockMesh editing
Hi Colin,

I had done exactly as you said but I got no improvement in the model. It is as like before.

Regards, Anjan.

anjansir December 9, 2011 08:13

selection for motorBike solver
1 Attachment(s)
Hi Colin,

I could run the motorbike mesh successfully and can see it in paraFoam. But I am confused while I am putting the solver to run. I first selected "MRFSimpleFoam" but it is giving some error. Then I selected "icoFoam", but still it is giving error. Please see the error snapshot attached below. Can you suggest a suitable solver.

Thanks, Anjan.

colinB December 9, 2011 09:05

Hi there,

a general thing concerning the forum:

there are different sections for different topics, for a particular reason:

people encountering a similar problem can easily find a topic where their
problems are eventually already discussed!

so the last two posts of you clearly don't match with the ascii or binary stl file for a sHMD anymore and should be in the

blockMesh forum

and the solving forum

Another note:

Generally speaking there are no things like stupid questions, but I guess most of the users are not willing to do once home work:

An error message like:

FOAM Fatal Error: cannot find file
file .../project/0/p

is missing

is more or less self explaining.

concerning your blockMesh problem:

it is handy to have both files to understand why there are / should be differences.

So Bottom line if a problem occurs:

- read error message
- think
- if problem not solved read error message again

- think again

- if it is still not solved ask google or the forum search for the answer

- if they don't have it formulate your problem and gather all data you might
think are important

- think again

- make a forum post

- read the post and think again

- push the review post button

- then think again

- if everything is now well documented and well formulated and the problem
still hasn't solved push the submit button

This rough check list usually works out fine for me, it doesn't always keep me from asking obvious things, but keeps it to a minimum

I hope the above text is of assistance


aqua February 10, 2012 11:59


Originally Posted by anjansir (Post 334844)
Thanks a lot Colin for your help. The model is now recognized perfectly by OpenFOAM. The mesh looks pretty interesting now..

Regards, Anjan.

Hello, Anjan,
I tried to use stl file created form proE, but OF didn't recognize it, after snappyHexMesh, in boundary file, nfaces is 0 for my test.stl.

So I wonder, your stl file is from Proe or what software?

thank you so much!

All times are GMT -4. The time now is 22:47.