# ExtrudeShapeCustom: Close Path?

**URL:** <https://forum.babylonjs.com/t/extrudeshapecustom-close-path/2968>\
**Category:** Questions\
**Created:** [May 4, 2019, 11:04am UTC](https://forum.babylonjs.com/t/extrudeshapecustom-close-path/2968 "2019-05-04T11:04:55Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![olli2home](https://avatars.discourse-cdn.com/v4/letter/o/7ab992/32.png) [@olli2home](https://forum.babylonjs.com/u/olli2home)\
**Post date:** [May 4, 2019, 11:04am UTC](https://forum.babylonjs.com/t/extrudeshapecustom-close-path/2968/1 "2019-05-04T11:04:55Z")

</div>

Hello,

A loud hello to the Babylon community!

I’ve just started programming with the Babylon Framework and have already gotten into a problem:  
How do I close the extrusion I create with ExtrudeShapeCustom?  
An example should illustrate this: [https://www.babylonjs-playground.com/#QBC29E](https://www.babylonjs-playground.com/#QBC29E).  
The triangle will later be replaced with different shapes. The path should be extruded closed.  
What do I have to adjust or add to make this work?

---

<div class="post-metadata">

**Author:** ![Galen](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/galen/32/539_2.png) [@Galen](https://forum.babylonjs.com/u/Galen)\
**Post date:** [May 4, 2019, 4:36pm UTC](https://forum.babylonjs.com/t/extrudeshapecustom-close-path/2968/2 "2019-05-04T16:36:53Z")

</div>

What you’re seeing is due to extruding from one side of the triangle instead of extruding from the center of the triangle.

Galen

---

<div class="post-metadata">

**Author:** ![olli2home](https://avatars.discourse-cdn.com/v4/letter/o/7ab992/32.png) [@olli2home](https://forum.babylonjs.com/u/olli2home)\
**Post date:** [May 6, 2019, 12:44am UTC](https://forum.babylonjs.com/t/extrudeshapecustom-close-path/2968/3 "2019-05-06T00:44:49Z")

</div>

Hello,

Thank you for your prompt reply.  
However, extrusion takes place from the center. I have not found a solution yet …

---

<div class="post-metadata">

**Author:** ![JohnK](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/johnk/32/26764_2.png) [@JohnK](https://forum.babylonjs.com/u/JohnK)\
**Post date:** [May 6, 2019, 2:12pm UTC](https://forum.babylonjs.com/t/extrudeshapecustom-close-path/2968/4 "2019-05-06T14:12:33Z")

</div>

> [@olli2home](#):
>
> The path should be extruded closed.  
> What do I have to adjust or add to make this work?

Close the underlying ribbon array [https://www.babylonjs-playground.com/#QBC29E#2](https://www.babylonjs-playground.com/#QBC29E#2)

---

<div class="post-metadata">

**Author:** ![Galen](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/galen/32/539_2.png) [@Galen](https://forum.babylonjs.com/u/Galen)\
**Post date:** [May 6, 2019, 2:24pm UTC](https://forum.babylonjs.com/t/extrudeshapecustom-close-path/2968/5 "2019-05-06T14:24:17Z")

</div>

@olli2home @JohnK

I already tried to close the triangle extrusion, which is why I assumed the triangles were extruding from an axis not in the center of the triangle. But if it is extruding from the center, I’m not certain how to close the extrusion in his playground scene.

Galen

---

<div class="post-metadata">

**Author:** ![JohnK](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/johnk/32/26764_2.png) [@JohnK](https://forum.babylonjs.com/u/JohnK)\
**Post date:** [May 6, 2019, 2:29pm UTC](https://forum.babylonjs.com/t/extrudeshapecustom-close-path/2968/6 "2019-05-06T14:29:11Z")

</div>

PG I posted is closed (is it not?) note ribbonCloseArray parameter in the ExtrudeShapeCustom

---

<div class="post-metadata">

**Author:** ![Galen](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/galen/32/539_2.png) [@Galen](https://forum.babylonjs.com/u/Galen)\
**Post date:** [May 6, 2019, 2:41pm UTC](https://forum.babylonjs.com/t/extrudeshapecustom-close-path/2968/7 "2019-05-06T14:41:31Z")

</div>

@JohnK

Yes, I see. I tried this, but I must have made an error. Thank you for solving this. 🙂

Galen

---

<div class="post-metadata">

**Author:** ![olli2home](https://avatars.discourse-cdn.com/v4/letter/o/7ab992/32.png) [@olli2home](https://forum.babylonjs.com/u/olli2home)\
**Post date:** [May 6, 2019, 6:07pm UTC](https://forum.babylonjs.com/t/extrudeshapecustom-close-path/2968/8 "2019-05-06T18:07:54Z")

</div>

Thanks for the answers.

But the problem is not solved. This becomes clear when a texture is applied.

Here is a screenshot: [http://download.fam-nestler.de/babylon\_01.jpg](http://download.fam-nestler.de/babylon_01.jpg)

---

<div class="post-metadata">

**Author:** ![JohnK](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/johnk/32/26764_2.png) [@JohnK](https://forum.babylonjs.com/u/JohnK)\
**Post date:** [May 6, 2019, 6:27pm UTC](https://forum.babylonjs.com/t/extrudeshapecustom-close-path/2968/9 "2019-05-06T18:27:05Z")

</div>

That’s disappointing. Will have a closer look again tomorrow. If @jerome has time perhaps he can spot what we have missed.

---

<div class="post-metadata">

**Author:** ![jerome](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/jerome/32/22_2.png) [@jerome](https://forum.babylonjs.com/u/jerome)\
**Post date:** [May 6, 2019, 7:15pm UTC](https://forum.babylonjs.com/t/extrudeshapecustom-close-path/2968/10 "2019-05-06T19:15:14Z")

</div>

Maybe try this :  
change the triangle position in its local system, then extrude : [https://www.babylonjs-playground.com/#QBC29E#3](https://www.babylonjs-playground.com/#QBC29E#3)

then close the ribbon : [https://www.babylonjs-playground.com/#QBC29E#4](https://www.babylonjs-playground.com/#QBC29E#4)

---

<div class="post-metadata">

**Author:** ![jerome](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/jerome/32/22_2.png) [@jerome](https://forum.babylonjs.com/u/jerome)\
**Post date:** [May 7, 2019, 6:44am UTC](https://forum.babylonjs.com/t/extrudeshapecustom-close-path/2968/11 "2019-05-07T06:44:06Z")

</div>

That said, if you really want to close an extruded circular shape, you may consider build your own ribbon around a a set of (three) circular paths because there’s quite no chance that the extrusion process sets the first step of the shape (your triangle) in a radial orientation to your circular path.

What I would do then ?  
Build 3 arrays of vertices, each defining a circle parallel to the others, all having the same rotation axis. Then build a ribbon on these 3 arrays and close it. You then be sure that every step (triangle) will be radial to the circle.

---

<div class="post-metadata">

**Author:** ![JohnK](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/johnk/32/26764_2.png) [@JohnK](https://forum.babylonjs.com/u/JohnK)\
**Post date:** [May 7, 2019, 12:40pm UTC](https://forum.babylonjs.com/t/extrudeshapecustom-close-path/2968/12 "2019-05-07T12:40:27Z")

</div>

@olli2home as I did not solve it the first time here is a solution based on @jerome’s method

[https://www.babylonjs-playground.com/#TL281S](https://www.babylonjs-playground.com/#TL281S)

Notice that the 0 index path point is not added to the end of any path array and the closeArray and closePath option parameters are set to true.

This gives a better joint than closing paths with path.push(path[0]) as in [https://www.babylonjs-playground.com/#TL281S#1](https://www.babylonjs-playground.com/#TL281S#1)

---

<div class="post-metadata">

**Author:** ![olli2home](https://avatars.discourse-cdn.com/v4/letter/o/7ab992/32.png) [@olli2home](https://forum.babylonjs.com/u/olli2home)\
**Post date:** [May 9, 2019, 7:05pm UTC](https://forum.babylonjs.com/t/extrudeshapecustom-close-path/2968/13 "2019-05-09T19:05:54Z")

</div>

Thanks for the answers.

I will not have time until the weekend to take a closer look at the solutions and to test them. The solution with the ribbon looks good.

Thank you

---

<div class="post-metadata">

**Author:** ![olli2home](https://avatars.discourse-cdn.com/v4/letter/o/7ab992/32.png) [@olli2home](https://forum.babylonjs.com/u/olli2home)\
**Post date:** [May 19, 2019, 6:48pm UTC](https://forum.babylonjs.com/t/extrudeshapecustom-close-path/2968/14 "2019-05-19T18:48:05Z")

</div>

Thanks to all. The solution with the ribbons worked.
