# Create a solid from 2D math function

Is it possible to create a solid based on a 2D function in Blender? Example: I have a function $y=x^2$ where $x \in [0,1]$. Here 'Z' is simple projection of XY plane so, extrude shall do the job.

I looked at the 3D Math addon functions but it not what I really want.

I finally want to create an stl image (attached). The attached stl is done using OpenSCAD but I found few issues like the symmetry is missing, scales are not accurate and I was not flexible in increasing the face count to have an accurate shape.

• It's possible to create complicated shapes using a function using the Extra Objects addon's XYZ Maths Surface option. This allows the surface to be defined mathematically. From your sample image this isn't simply y = x^2. It's not a straightforward way of creating a mesh but it is possible. What function are you actually trying to create? – Rich Sedman Apr 6 '18 at 20:44
• i did come across math surface but I am not sure how to define z in that case as its only a projection as you see in the fig. The function is "y=x^2/(x^2+(1-x)^2)" where x=[0,1]. – Saideep Apr 6 '18 at 21:12

You can achieve this with the Extra Objects addon, XYZ Math Surface option.

To enable the addon, open the User Preferences and search for the Extra Objects addon and enable it. Now in the Add menu you should find Mesh/Math Function/XYZ Math Surface. This allows you to define the coordinates of points in XYZ space as two variables (U and V) are varied.

To create your equation (y=x^2/(x^2+(1-x)^2)) you need to vary U over the range 0.0 to 1.0 and substitute x for u - by defining X as simply u and defining Y as u**2/(u**2+(1-u)**2) (note that power (^) needs to be written as **).

In order to turn this into a symetrical surface we need two points, one at +y and the other at -y. For this we can use V and vary it between -1 and 1 with only 2 steps (so it flips between -1 and +1 for each point) and multiply the previous equation by v :

To produce the shape in your question we need to stretch the two sides apart - achieved by adding a constant to the equation :

Finally, to add the 'ends' we can extend the range and use "ternary" operators to allow us to use 'x if condition else y' form. Here we set it effectively to 0.5 if u < 0 else our_equation if u <= 1 else 1.5. This produces the following result :

Note the settings in the left-hand panel. Increase the U step for more vertices along the mesh. Decrease U min for a longer 'handle', increase U max for a longer 'paddle'.

Once you're happy with the shape you can simply enter edit mode (Tab) and Extrude (E) to give it some thickness (or add a Solidify modifier if you prefer).

• Thanks!! Is there a way to name a zone on the stl image. For example, let's say I want to name the surface of the stl as "tz" between (0.4,-1.5,-0.5) to (0.6,1.5, 0.5). I want to use this name while meshing for a CFD software (for applying a boundary condition). – Saideep Apr 12 '18 at 20:18
• @Saideep I’m afraid I don’t know how you would go about that. Perhaps ask a separate question - someone might be able to help. – Rich Sedman Apr 12 '18 at 21:01