CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Meshing & Mesh Conversion (https://www.cfd-online.com/Forums/openfoam-meshing/)
-   -   [Technical] binary or ascii stl? (https://www.cfd-online.com/Forums/openfoam-meshing/73008-binary-ascii-stl.html)

Calobra February 24, 2010 06: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
Aborted

olesen February 25, 2010 03:00

Quote:

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

Hi,

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
reader.SetFileName("~/OpenFOAM/ruben-1.6.x/run/KFA/constant/triSurface/KFA.stl")
reader.Update()
write = vtk.vtkSTLWriter()
#uncomment unnecessary 2Ascii or 2Binary
write.SetFileTypeToASCII()
#write.SetFileTypeToBinary()


write.SetInput(reader.GetOutput())
# path to
write.SetFileName("~/OpenFOAM/ruben-1.6.x/run/KFA/constant/triSurface/KFAascii.stl")
write.Write()


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

greets

elvis

anjansir December 1, 2011 06: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 04: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?

regards
Colin

anjansir December 6, 2011 01: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 02:49

sHMD = snappyHexMeshDict

likewise there is

bMD for blockMeshDict and so on

anjansir December 6, 2011 03: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 04:06

Hi

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

you wrote:

test.stl
{
type triSurfaceMesh;
}

but it has to be written like this:

test.stl
{
type triSurfaceMesh;
name ******;
}


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

Code:

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
    endloop
  endfacet
.
.
.
.

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

regards
Colin

anjansir December 6, 2011 07: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 06: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.

vertices
(
(-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 07: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 05: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 07: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 08: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

regards

aqua February 10, 2012 10:59

Quote:

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!
Aqua


All times are GMT -4. The time now is 18:15.