2
$\begingroup$

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.Image Prototype

$\endgroup$
  • $\begingroup$ 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? $\endgroup$ – Rich Sedman Apr 6 '18 at 20:44
  • $\begingroup$ 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]. $\endgroup$ – Saideep Apr 6 '18 at 21:12
2
$\begingroup$

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 **).

maths equation

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 :

symetrical surface

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

stretched

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 :

final

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).

$\endgroup$
  • $\begingroup$ 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). $\endgroup$ – Saideep Apr 12 '18 at 20:18
  • 1
    $\begingroup$ @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. $\endgroup$ – Rich Sedman Apr 12 '18 at 21:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.