CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Meshing & Mesh Conversion

[mesh manipulation] How to split stl file?

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 16, 2021, 01:06
Default How to split stl file?
  #1
Member
 
Sunag R A
Join Date: Jul 2019
Location: Bangalore, India
Posts: 59
Rep Power: 3
sunagra27 is on a distinguished road
Dear Foamers,


I have an stl file where the mesh was created using Open3D python library (which uses cloud points to convert to mesh). This stl file is in the shape of sphere with bottom part closed. So, the file is watertight (checked with surfaceCheck).


I want to create internal heat transfer from this stl file. I actually wanted the bottom portion of the stl to be a separate part and top portion as separate part. How can I do that?



After snappyHexMesh, I can get complete stl as one region, I was thinking whether the bottom part of blockMesh can be extracted separately?




I have attached the stl file along with the image in this query. Any leads will be appreciated.


Stl file link:



https://drive.google.com/file/d/1KqF...ew?usp=sharing


Image of stl:


https://drive.google.com/file/d/1Cvl...ew?usp=sharing

As can be seen, the stl image is watertight. I need the bottom part of stl to be separate and can it be done using BlockMesh boundary?



Regards,


Sunag R A.
sunagra27 is offline   Reply With Quote

Old   March 16, 2021, 03:36
Default
  #2
Senior Member
 
M
Join Date: Dec 2017
Posts: 376
Rep Power: 7
AtoHM is on a distinguished road
You are mixing some stuff together here and it is hard to understand what you want to do due to it.

First of all, the STL file is just a tessellated representation of faces. What you get after snappy is not a stl region, but a finite volume mesh of the volume enclosed by the stl. And there comes my question what you want to do: are you aiming to split the stl (surface) into patches to apply e.g. heat at the boundary or do you want to split the mesh into different parts so you can apply heat sources to cells?


P.S.: on what earth is that a sphere?
AtoHM is offline   Reply With Quote

Old   March 16, 2021, 04:56
Default
  #3
Member
 
Sunag R A
Join Date: Jul 2019
Location: Bangalore, India
Posts: 59
Rep Power: 3
sunagra27 is on a distinguished road
Dear AtoHM,


Sorry for not addressing the question correctly. Firstly, It is random shape and not sphere..!! My bad..!1


1. I need to apply constant heat at the boundary and some other boundary condition on the surface. So, for this, I wanted to know how to split it?



2. It can be either way of splitting. stl split before entering into snappyHexMesh or boundary condition at the base after snappyHexMesh.



( Note: I dont want stl split because once the stl is splitted, the mesh will be open and snappyHexMesh cant handle it without watertight mesh if I am correct. Also, since the mesh was developed from point cloud, I found it difficult to separate the base and surface mesh accurately).


Hopefully, this is little clarified. Leads will be appreciated.


Regards,


Sunag R A.
sunagra27 is offline   Reply With Quote

Old   March 16, 2021, 06:03
Default
  #4
Senior Member
 
M
Join Date: Dec 2017
Posts: 376
Rep Power: 7
AtoHM is on a distinguished road
It is clear now what you are aiming for.



I don't know all the tools of OpenFOAM for stls as I usually generate them to my needs in Solidworks and don't touch them with OF. However, since stls are just a couple of triangles in a long list in ascii files, you can access it and create what you need with a little coding.
The stl can be watertight but split into patches at the same time. If you take a look into the file, you will see it starts with an entry "solid <solidname>", then there is a long list of verteces and stuff and at the end there is usually an "endsolid" entry. This solid can be readily refered to as patch in snappyHexMesh. You can have multiple patches in one stl file that form a closed surface.

So what you could do: the bottom surface you need to "extract" into a single patch seems to be planar. If it is aligned in a coordinate direction, probably all the triangles will lay at a certain position. You can write a bit of python to get the triangle centres. Then go through the file, check if the current triangle is inside the plane or not and just create two lists of triangles. Finally enclose these lists by "solid ..." ... "endsolid" and put them into one stl file. Now you can reference the patches in snappyHexMesh and get two distinct regions for your boundary condition.


This is obviously the hard way, there might be a software package to help split the stl into two. However, basically its just that, order the triangles you already have (watertight) into two lists you can address separately.
AtoHM is offline   Reply With Quote

Old   March 16, 2021, 06:12
Default
  #5
Member
 
Sunag R A
Join Date: Jul 2019
Location: Bangalore, India
Posts: 59
Rep Power: 3
sunagra27 is on a distinguished road
Dear AtoHM,


Thank you very much for your explanation. This is exactly what I wanted. I will definitely work with the stl file and update the post.


Regards,


Sunag R A.
sunagra27 is offline   Reply With Quote

Old   March 18, 2021, 11:00
Default Try blender
  #6
Senior Member
 
Carlos Rubio Abujas
Join Date: Jan 2018
Location: Spain
Posts: 100
Rep Power: 6
crubio.abujas is on a distinguished road
Splitting STL is somehow common in 3D printting. You can use blender for do it (its free and open), and maybe do some other manipulation on STL domains if you need so.

Blender is a powerful tool, but it may requiere some time until feeling confortable with it.
Here is a quick tutorial on how to split STL files.

I hope you find it usefull!
crubio.abujas is offline   Reply With Quote

Reply

Tags
blockmesh, boundary, snappyhexmesh, stl, watertight

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
[swak4Foam] funkyDoCalc with OF2.3 massflow NiFl OpenFOAM Community Contributions 14 November 25, 2020 03:30
polynomial BC srv537 OpenFOAM Pre-Processing 4 December 3, 2016 09:07
[OpenFOAM.org] Compile OF 2.3 on Mac OS X .... the patch gschaider OpenFOAM Installation 225 August 25, 2015 19:43
[swak4Foam] swak4foam building problem GGerber OpenFOAM Community Contributions 54 April 24, 2015 16:02
ParaView Compilation jakaranda OpenFOAM Installation 3 October 27, 2008 11:46


All times are GMT -4. The time now is 13:52.