<p>You generated a single mesh surface from a mathematical formula. If you can export this surface, you have the first step to a 3D model!</p>
<p>To turn the mesh into a solid item, you are just a couple steps away:</p>
<ul>
<li>Import the mesh into blender</li>
<li>swap into edit mode</li>
<li>[E] to extrude
<ul>
<li>input a value that puts the resulting offset copy well below the item</li>
</ul>
</li>
<li>[s] to scale the selected vertices
<ul>
<li>[Z]</li>
<li><code>0</code> to put them all on the sale Z height.</li>
</ul>
</li>
</ul>

CC BY-SA 4.0
2023-08-23T08:38:32.757Z
2023-08-23T08:38:32.757Z
Trish
<p>I don't know how <code>surf2stl</code> works, but in principle, given that you already have a way to make a single gridded surface, all you need to do is do that five more times:</p>
<ol>
<li>Generate the same grid mesh but with all Z values at 0 (or whatever you want the bottom surface to be) instead of your <span class="math-container">$p_k$</span> function value.</li>
<li>For each of the four sides, generate a mesh that is only one row wide, along the Z axis; one edge has <span class="math-container">$Z=0$</span> and the other edge has <span class="math-container">$Z=p_k$</span>, thus connecting the bottom to the top.</li>
</ol>
<p>Make sure that the triangle winding order is correct (surfaces should be “facing outward”).</p>
<p>Then put all of these triangles in the same STL file and it will be printable.</p>

CC BY-SA 4.0
2023-08-28T20:47:19.487Z
2023-08-29T14:08:01.813Z
2023-08-29T14:08:01.813Z
Kevin Reid
<p>How do I add a base to the surface I'm trying to print?</p>
<p>Target machine is a Creality Ender 3 Pro.</p>
<p>I'm using numpy-stl and surf2stl to come up with the desired surface in python:</p>
<pre><code>def SOquestion():
   pᵢs = [i / 100 for i in range(50, 96, 1)]
   pⱼs = pᵢs
   X, Y = np.meshgrid(pᵢs, pⱼs)
   Z = pₖGivenpᵢAndpⱼ(X, Y)

   stlFile = &quot;surfaceOfCriticalValues.stl&quot;
   surf2stl.write(stlFile, X, Y, Z)
   theMesh = mesh.Mesh.from_file(stlFile)

   plotFromStlFile(stlFile)

@np.vectorize
def pₖGivenpᵢAndpⱼ(pᵢ, pⱼ):
    a = pᵢ * pⱼ / ((1 - pᵢ) * (1 - pⱼ))
    return a / (a + 1)
</code></pre>
<p>I want this surface to be printable. I figure I could add the base to the mesh but I don't know how to draw all the triangles?</p>
<p><a href="https://i.sstatic.net/iMWq2.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/iMWq2.png" alt="Surface3dPlot" /></a></p>

<surface><build-surface>
Add base to STL mesh?
user2183336
# Add base to STL mesh?

(Asked by: username_0 on 2023-08-22)

How do I add a base to the surface I'm trying to print?

Target machine is a Creality Ender 3 Pro.

I'm using numpy-stl and surf2stl to come up with the desired surface in python:

```
def SOquestion():
   pᵢs = [i / 100 for i in range(50, 96, 1)]
   pⱼs = pᵢs
   X, Y = np.meshgrid(pᵢs, pⱼs)
   Z = pₖGivenpᵢAndpⱼ(X, Y)

   stlFile = "surfaceOfCriticalValues.stl"
   surf2stl.write(stlFile, X, Y, Z)
   theMesh = mesh.Mesh.from_file(stlFile)

   plotFromStlFile(stlFile)

@np.vectorize
def pₖGivenpᵢAndpⱼ(pᵢ, pⱼ):
    a = pᵢ * pⱼ / ((1 - pᵢ) * (1 - pⱼ))
    return a / (a + 1)

```

I want this surface to be printable. I figure I could add the base to the mesh but I don't know how to draw all the triangles?

[![Surface3dPlot](https://i.sstatic.net/iMWq2.png)](https://i.sstatic.net/iMWq2.png)

**Tags:** surface, build-surface


---

## 2 answers

### Answer by username_1 on 2023-08-23. Score: 2

You generated a single mesh surface from a mathematical formula. If you can export this surface, you have the first step to a 3D model!

To turn the mesh into a solid item, you are just a couple steps away:

* Import the mesh into blender
* swap into edit mode
* [E] to extrude
  + input a value that puts the resulting offset copy well below the item
* [s] to scale the selected vertices
  + [Z]
  + `0` to put them all on the sale Z height.


---

### Answer by username_2 on 2023-08-28. Score: 2

I don't know how `surf2stl` works, but in principle, given that you already have a way to make a single gridded surface, all you need to do is do that five more times:

1. Generate the same grid mesh but with all Z values at 0 (or whatever you want the bottom surface to be) instead of your $p\_k$ function value.
2. For each of the four sides, generate a mesh that is only one row wide, along the Z axis; one edge has $Z=0$ and the other edge has $Z=p\_k$, thus connecting the bottom to the top.

Make sure that the triangle winding order is correct (surfaces should be “facing outward”).

Then put all of these triangles in the same STL file and it will be printable.


---

