|
[Sponsors] |
[CAD formats] Blender export script for named ASCII STLbs |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
July 28, 2008, 00:18 |
Blender export script for named ASCII STLbs
|
#1 |
Member
Andrew King
Join Date: Mar 2009
Location: Perth, Western Australia, Australia
Posts: 82
Rep Power: 17 |
Hi All,
I have written an export script for blender, which exports selected objects (with names) to an ASCII STL file. This should be all you need to get a suitable stl for using in snappyHexMesh. Improvements/bug fixes (hopefully none) are welcome. Requests for improvements not so much (I don't have time). To use the script, save it in ~/.blender/scripts. It should then give you a menu item in File->Export->Named ascii STL file... You can give your blender objects useful names and these will be kept in the exported stl. These can be used for creating patches in snappyHexMesh. stlasciiexport.py Regards, Andrew
__________________
Dr Andrew King Fluid Dynamics Research Group Curtin University |
|
August 4, 2008, 01:38 |
Bug fix. Original script doesn
|
#2 |
Member
Andrew King
Join Date: Mar 2009
Location: Perth, Western Australia, Australia
Posts: 82
Rep Power: 17 |
Bug fix. Original script doesn't incorrectly exports local coordinates. Revised version attached.
Regards, Andrew stlasciiexport.py
__________________
Dr Andrew King Fluid Dynamics Research Group Curtin University |
|
August 7, 2008, 08:52 |
On a simple object (the cube p
|
#3 |
Senior Member
John Deas
Join Date: Mar 2009
Posts: 160
Rep Power: 17 |
On a simple object (the cube present in the default Blender scene), I got this error message:
Traceback (most recent call last): File "<string>", line 1, in <module> File "/usr/share/blender/scripts/bpymodules/BPyRegistry.py", line 53, in <module> _CFG_DIR = Blender.sys.join(Blender.Get('datadir'), 'config') TypeError: expected string argument Traceback (most recent call last): File "<string>", line 88, in <module> File "<string>", line 70, in update_RegistryInfo NameError: global name 'SKIP_DATA' is not defined Do you why I got this, or what are the steps involved to export this simple case with your script ? (if needed, I run Blender 2.45 with Ubuntu 08-04 and Python 2.5.2) |
|
August 7, 2008, 20:48 |
You are right, new version is
|
#4 |
Member
Andrew King
Join Date: Mar 2009
Location: Perth, Western Australia, Australia
Posts: 82
Rep Power: 17 |
You are right, new version is attached.
stlasciiexport.py To use it, all you have to do is put each patch in a separately named object. Select all the patches you wish to export and then use the script. snappyHexMesh will then recognise the names in the regions section of snappyHexMeshDict. Cheers, Andrew
__________________
Dr Andrew King Fluid Dynamics Research Group Curtin University |
|
August 8, 2008, 06:03 |
It works now, thanks !
|
#5 |
Senior Member
John Deas
Join Date: Mar 2009
Posts: 160
Rep Power: 17 |
It works now, thanks !
|
|
August 8, 2008, 18:59 |
Hi, Andrew,
I understand th
|
#6 |
Senior Member
Pei-Ying Hsieh
Join Date: Mar 2009
Posts: 317
Rep Power: 18 |
Hi, Andrew,
I understand that you are busy. But, is it possible to write a quick tutorial? Thanks! Pei |
|
November 26, 2008, 17:23 |
Thanks for the script, it almo
|
#7 |
Member
Terry Barnaby
Join Date: Mar 2009
Location: Beam Ltd, UK
Posts: 44
Rep Power: 17 |
Thanks for the script, it almost does what I need. However, there is a problem using this script when you have a mesh that is modified by a curve. The script outputs the the mesh without the curve modification. Does anyone now how to fix this ?
|
|
November 26, 2008, 22:12 |
Hi Terry,
You should be abl
|
#8 |
Member
Andrew King
Join Date: Mar 2009
Location: Perth, Western Australia, Australia
Posts: 82
Rep Power: 17 |
Hi Terry,
You should be able to apply the modifier, and then export the modified object using the script. I'm not sure if its possible to include this step in the script though. Andrew
__________________
Dr Andrew King Fluid Dynamics Research Group Curtin University |
|
November 26, 2008, 22:19 |
Pei,
I don't know if there'
|
#9 |
Member
Andrew King
Join Date: Mar 2009
Location: Perth, Western Australia, Australia
Posts: 82
Rep Power: 17 |
Pei,
I don't know if there's much to put in the tutorial. All you need to do is name each object (as in the image below), select the objects you wish to export, and then run the script. The object names are then exported in the STL and can be referred to in snappyHexMesh. Andrew
__________________
Dr Andrew King Fluid Dynamics Research Group Curtin University |
|
November 27, 2008, 04:51 |
Hi Andrew,
I think Pei ment i
|
#10 |
Senior Member
Dragos
Join Date: Mar 2009
Posts: 648
Rep Power: 20 |
Hi Andrew,
I think Pei ment if you can show how step by step the procedure of generating a surface, mesh it and then export it in stl format. I know that at least for me it will be very, very, very helpful. I did only the "person" tutorial in blender until know, and that was quite a long time ago. ...maybe put it on the wiki... Thanks, Dragos |
|
November 27, 2008, 23:46 |
Hi,
Don't usually do requests
|
#11 |
Member
Andrew King
Join Date: Mar 2009
Location: Perth, Western Australia, Australia
Posts: 82
Rep Power: 17 |
Hi,
Don't usually do requests, but here you go. A quick and nasty Blender tutorial. Note that I haven't done a snappyHexMesh part. (Maybe later). I have an odt of it if anyone wants to add it to the wiki. Regards, Andrew
__________________
Dr Andrew King Fluid Dynamics Research Group Curtin University |
|
November 28, 2008, 00:07 |
Hi,
Don't usually do requests
|
#12 |
Member
Andrew King
Join Date: Mar 2009
Location: Perth, Western Australia, Australia
Posts: 82
Rep Power: 17 |
Hi,
Don't usually do requests, but here you go. A quick and nasty Blender tutorial. Note that I haven't done a snappyHexMesh part. (Maybe later). It turns out it was too big for here, so I've added it to the wiki (It turns out the wiki is surprisingly easy to edit). It's at http://openfoamwiki.net/index.php/Main_Tutorials Feel free to move it if its in the wrong place. Regards, Andrew
__________________
Dr Andrew King Fluid Dynamics Research Group Curtin University |
|
November 28, 2008, 00:08 |
Please disregard the double po
|
#13 |
Member
Andrew King
Join Date: Mar 2009
Location: Perth, Western Australia, Australia
Posts: 82
Rep Power: 17 |
Please disregard the double post. I thought the first got cancelled.
Andrew
__________________
Dr Andrew King Fluid Dynamics Research Group Curtin University |
|
July 26, 2009, 06:08 |
|
#14 |
Senior Member
Fabian Braennstroem
Join Date: Mar 2009
Posts: 407
Rep Power: 19 |
Hi Andrew,
do you know, if I am able to define some patches in blender based on any angle similar like in Starccm+; e.g. I would like to select an triangle and all its neighbors as long as some feature angle is not exceeded!? Would be nice, if this works :-) In addition, is it possible to cut the geometry triangle with a plane or a region? Would be nice, if you have a suggestion! Regards! Fabian |
|
July 29, 2009, 22:51 |
|
#15 |
Member
Andrew King
Join Date: Mar 2009
Location: Perth, Western Australia, Australia
Posts: 82
Rep Power: 17 |
Hi Fabian,
You can select sharp edges with 'CTRL-ALT-SHIFT S', which allows you to select the angle. Once you've selected the edge of the patch you want to separate, press 'V', which splits it along the edge. If you want to completely separate it (so you can give it a name), you can press 'P'. Hope that helps. Cheers, Andrew
__________________
Dr Andrew King Fluid Dynamics Research Group Curtin University |
|
September 21, 2009, 12:16 |
|
#16 | |
Senior Member
Fabian Braennstroem
Join Date: Mar 2009
Posts: 407
Rep Power: 19 |
Hi Andrew,
sorry for the late reply ... thanks a lot! It still takes a bit, but quite nice tool ;-) Fabian Quote:
|
||
January 25, 2011, 15:39 |
|
#17 |
New Member
Juliano
Join Date: Jan 2011
Posts: 1
Rep Power: 0 |
Hi andrew,
could you please repost the link as is not working anymore, Regards, Juliano |
|
February 23, 2011, 21:55 |
Repost.
|
#18 |
Member
Andrew King
Join Date: Mar 2009
Location: Perth, Western Australia, Australia
Posts: 82
Rep Power: 17 |
Hi
I've had a number of requests, so here is a repost of the script. Note that this does not work in the newest versions of blender (2.5x). We are in the process of updating it for this version, but it's not quite ready yet. Install instructions etc. are as before. (but you'll have to gunzip the file, as a .py extension is not allowed on the forums). Regards, Andrew
__________________
Dr Andrew King Fluid Dynamics Research Group Curtin University |
|
March 19, 2012, 04:19 |
Similar export, for blender 2.5
|
#19 |
Member
Niklas Wikstrom
Join Date: Mar 2009
Posts: 86
Rep Power: 17 |
Hi,
I have extended the "default" STL import/export addon to include the option to export multi-solid ascii STL, similar to the above script. Still crude and I hope to extend the import functionality similarly, but have not don so yet. I have tested this with blender 2.5.8. To activate this addon unpack the tgz in ~/.blender/<version>/ Code:
~/.blender/2.58/scripts niklasw > tree . └── addons └── export_named_stl ├── blender_utils.py ├── __init__.py └── stl_utils.py /Niklas |
|
April 14, 2012, 11:02 |
|
#20 |
Retired Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,982
Blog Entries: 45
Rep Power: 128 |
Greetings to all!
I stumbled on this thread a few days ago and when I saw the wiki page + old scripts, I thought to myself "this is a good one for passing PDF to wiki". And that's what I've done: http://openfoamwiki.net/index.php/Tut_andrew_blender I hope the original author Andrew King doesn't mind that his document was converted/transcribed to wiki format, because my objective was for enabling inspired people to complement this very good article! I've also put the what I believe is the latest script for Blender <=2.49b on the wiki page and only a reference to the script by Niklas Wikstrom. So Niklas, if you feel like it, feel free to upload to and/or edit the wiki page as well Best regards, Bruno
__________________
Last edited by wyldckat; April 14, 2012 at 14:36. Reason: "transcribed", not quite exactly converted... |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Automatic Data Export (ascii format) | A Kourm | FLUENT | 4 | March 7, 2021 15:08 |
[ANSYS Meshing] Export mesh as fluent msh by using script | erkut | ANSYS Meshing & Geometry | 0 | July 13, 2018 16:41 |
export ascii file with fluent | Clementine | FLUENT | 3 | August 2, 2012 10:52 |
WSS ASCII export problem | Birkov | FLUENT | 1 | July 27, 2009 15:09 |
Is there any way to quickly export ascii file? | HVAC | FLUENT | 0 | December 29, 2005 21:24 |