Tut andrew blender

From OpenFOAMWiki
Jump to: navigation, search

Valid versions: OF version 15.png

Description
Construct a simple wing using Blender (suitable for snappyHexMesh)
Original Author
Andrew King
Language
English
Format
original zipped PDF
Script
Stlasciiexport_py.gz - Unpack and save this file as stlasciiexport.py (source), works only with Blender <2.50.
For Blender >2.5 and <2.63, see Similar export, for Blender 2.5 at cfd-online.
For Blender 2.63+, see Version for 2.63+, including import
Wiki format
shown below.



Contents

1 Introduction

Construct a simple wing using Blender (suitable for snappyHexMesh)

Note
For usage with Blender 2.49b or older.

In this tutorial flow over a simple wing shape (Not a particularly accurate one) will be illustrated. Note that for blender keys on the keyboard are referred with the following notation:

  • X - the x key on the keyboard,
  • A - the a key,
  • SPACE - space bar.

Mouse buttons are:

  • LMB – left mouse button
  • RMB – right mouse button

This is consistent with the online blender tutorials (highly recommended - 3D: Noob to Pro)

2 Working with Blender

Start Blender. (Either from a shell, or through the panel menus)

You will have a window that looks something like this:

Blender wing images-000.ppm.png

Note that the default scene, starts with a camera (bottom right), a lamp (middle right) and a cube (centre – in pink). As we're not interested in any of these we can delete them. Select all (press A twice) and then delete them with X.


You now should have an empty screen.

2.1 Creating the airfoil

Next we want to add our aerofoil. To add an object press SPACE, then select add->cylinder.

Note
Blender adds all objects aligned with the current plane, so before this step you should select view->top from the menu. This will give the correct orientation of our aerofoil.


Select the number of vertices (eg. 64, 32 is probably not enough) and press OK. You will now have a cylinder in the centre of your window, like so.

Blender wing images-002.ppm.png

all the vertices of our cylinder are shown, and are selected.

Note
Blender has a number of modes, the two we will use in this tutorial are object mode and edit mode. In object mode we can manipulate objects, while in edit mode, we can manipulate the vertices making up the object. Press TAB to switch between object mode and edit mode. The current mode is indicated in the bottom toolbox.
Blender wing images-003.ppm.png


We would like to now shape our aerofoil. To do this we want to be in object mode (though it is also possible in edit mode). Change to object mode, and select the cylinder with the right mouse button (RMB).

Now we want to scale it into something approaching an aerofoil shape, press S (scale). If you move the mouse you'll see that the object scales as you do it. We would like a bit better control. Press X, and you will see that the object now scales along the x-direction only, also if you type a number it will scale by this amount. If you enter the wrong value, you can press BACKSPACE, or if you change your mind completely you can press ESC (this generally cancels any operation). Pressing ENTER completes the operation The current scale is indicated in the corner of the 3D-view.

Blender wing images-004.ppm.png

We will scale our aerofoil in 3-directions separately. 2.5 times in the x-direction (S X 2.5 ENTER), 0.5 times in the y-direction (S Y 0.5 ENTER), and 5 times in the z-direction (S Z 5 ENTER), your aerofoil should now look like this.

Blender wing images-005.ppm.png

2.2 Creating the flap

Next we want to add a flap, in addition to the aerofoil. The current aerofoil is a good shape, so we will copy it, then move it and scale it.

Select the aerofoil (RMB – it should be pink) and duplicate it SHIFT-D, by default it will now move with your mouse so you can reposition it, we don't want to do that so press ESC to cancel the move (the duplicate operation still completes).

Now we want to move it. Press G (grab) – the aerofoil will now move with your mouse. As with scaling we can move it more accurately one axis at a time and by a fixed amount.
Press X to move it along the x-axis and then type 3.5 and ENTER to move our flap 3.5 units behind. (don't worry about the overlap yet)

Next we want to scale it so that its smaller than our aerofoil. We only want to scale it in the x and y directions, so we can do it along each axis separately. Alternatively we can scale it in one operation like so:

  1. press S (scale)
  2. press SHIFT-Z (i.e. don't scale along the z-axis)
  3. press 0.3 (we want it to be 0.3 times the size of the aerofoil)
  4. press ENTER (complete the operation)

Your objects should now look like this:

Blender wing images-006.jpg

Next we want to rotate our flap. We want to rotate it around the leading edge, so we will need to do it in edit mode. Select the flap (RMB) and enter edit mode (TAB). Your window will look like this:

Blender wing images-007.ppm.png

Now we want to change our rotation point to the leading edge.

Firstly unselect all the vertices (i.e. press A). Select the two vertices at the leading edge (hold down SHIFT while selecting the second).

You will probably need to zoom in to do this.

Select the two white vertices with the RMB while holding down SHIFT

Now we need to change the centre of rotation. Press SHIFT-S and choose Cursor to Selection. This will move the 3D Cursor to the centre of the leading edge.

Note
the 3D Cursor is the red and white circle in the 3d-window. It is used to mark the place where new objects are inserted, as well as (occasionally) the reference point for rotations and scaling.


Change the pivot point using to the 3D Cursor (the default is Median Point)

Blender wing images-009.ppm.png

Now we can rotate the flap (you can also do this in object mode). In edit mode press A twice so that all the vertices in the flap are selected. Next:

  1. press R (rotate);
  2. press Z (rotate along the z-axis);
  3. type 10 (we want to rotate it 10 degrees);
  4. press ENTER (to apply the rotation).

have now got an aerofoil, and a rotated flap. It should look like the following (in object mode):

Blender wing images-010.jpg

Finally, we want to scale our wing to a smaller size. In object mode, select both the aerofoil and the flap by pressing B and drawing a box through both wings (it doesn't need to go around them).

Press SHIFT-C to reset the 3D cursor to the origin. Next press S (scale), 0.1 and ENTER to scale the wing and aerofoil to 10% of their original size.

2.3 Exporting to STL

Finally, we want to export it (this is using the script from the message board, i.e. the one available at the beginning of this page).

First we will give our objects names.

Select just the large aerofoil, then change the name (the OB: field) in the Links and Materials panel at the bottom by clicking in the OB: field.

Change the name here to "wing"

In the same way change the name of the flap to "flap".

Export the objects using File->Export->Named ASCII STL file (.stl)... .

You now have an ASCII STL file with multiple objects suitable for using in snappyHexMesh.