# Mesh script unweld problem

**URL:** <https://discourse.mcneel.com/t/mesh-script-unweld-problem/113388>\
**Category:** Grasshopper Developer\
**Tags:** script, subd\
**Created:** [November 28, 2020, 10:39pm UTC](https://discourse.mcneel.com/t/mesh-script-unweld-problem/113388 "2020-11-28T22:39:04Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![martinsiegrist](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/martinsiegrist/32/498369_2.png) [@martinsiegrist](https://discourse.mcneel.com/u/martinsiegrist)\
**Post date:** [November 28, 2020, 10:39pm UTC](https://discourse.mcneel.com/t/mesh-script-unweld-problem/113388/1 "2020-11-28T22:39:05Z")

</div>

I created a SubD Radial Symmetry example in Grasshopper after looking at [this topic](https://discourse.mcneel.com/t/radial-symmetry-reflect-need-macro/113356/2).

The goal is to be able to work a a single segment, rotate this segment and weld everything into one SubD. Unfortunately after welding and aligning the vertices, all edges are smooth and creases are lost. There is an option to keep creases at Mesh Edges, but it’s impossible to distinguish between interior edges and naked edges. The solution is to weld everything and unweld based on edge indeces.

**The problem right now is that the unweld script doesn’t work anymore. For whatever reason?**

The initial segment has three edge tags:

- smooth, interior
- crease, naked
- crease, interior

Let’s say I want to keep interior naked edges creased. The edges can be filtered and unwelded.

Some time ago in an old topic I had a similar problem, but the script from a year ago does not work anymore.

[20\_11\_28\_subd\_rotational\_symmetry.gh](https://discourse.mcneel.com/uploads/short-url/f5Fr0UiHae2dOdkrpeEzWcHpeVJ.gh) (40.5 KB)

 ![image](https://global.discourse-cdn.com/mcneel/uploads/default/original/4X/4/2/f/42fe3740637437a2f973064941a0216f52ff86fd.jpeg)

What’s wrong with this:

```
private void RunScript(Mesh M, List<int> edgeindeces, ref object A)
  {
    MyClass edge = new MyClass();
    List<int> edgeindeces = new List<int>();
    foreach (var val in edge)
    {
      A = Rhino.Geometry.Mesh.UnweldEdge(edge, false);
    }
  }

```

---

<div class="post-metadata">

**Author:** ![martinsiegrist](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/martinsiegrist/32/498369_2.png) [@martinsiegrist](https://discourse.mcneel.com/u/martinsiegrist)\
**Post date:** [November 30, 2020, 1:15pm UTC](https://discourse.mcneel.com/t/mesh-script-unweld-problem/113388/2 "2020-11-30T13:15:11Z")

</div>

Can anyone help on this script problem please?

1. Error (CS0246): Der Typ- oder Namespacename ‘MyClass’ konnte nicht gefunden werden. (Fehlt eine Using-Direktive oder ein Assemblyverweis?) (line 57)

---

<div class="post-metadata">

**Author:** ![Baris](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/baris/32/759711_2.png) [@Baris](https://discourse.mcneel.com/u/Baris)\
**Post date:** [November 30, 2020, 3:46pm UTC](https://discourse.mcneel.com/t/mesh-script-unweld-problem/113388/3 "2020-11-30T15:46:00Z")

</div>

Hi @martinsiegrist,

Did you create a class called MyClass? You are trying to create an object of this class and it seems not to exist.  
If you want the naked edges you can do something like this:

```auto
 var MEV = mesh.TopologyEdges;
    var nakedEdgeIndices = new List<int>();
    var nakedEdges = new List<Line>();
    for (int i = 0; i < MEV.Count; i++)
    {
      var fE = MEV.GetConnectedFaces(i);
      if(fE.Length == 1)
      {
        nakedEdgeIndices.Add(i);
        nakedEdges.Add(MEV.EdgeLine(i));
      }
    }
    NakedEdges = nakedEdges;
    NakedIndices = nakedEdgeIndices;

```

 ![imagen](https://global.discourse-cdn.com/mcneel/uploads/default/original/4X/b/a/0/ba06df7323e585e8092ccd51a3a7ccefb91864e6.png)  
File:[20201130\_NakedMeshEdges.gh](https://discourse.mcneel.com/uploads/short-url/oH3pkn4nSrMpe5WpzV881vZuUl9.gh) (3.3 KB)

---

<div class="post-metadata">

**Author:** ![martinsiegrist](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/martinsiegrist/32/498369_2.png) [@martinsiegrist](https://discourse.mcneel.com/u/martinsiegrist)\
**Post date:** [November 30, 2020, 3:52pm UTC](https://discourse.mcneel.com/t/mesh-script-unweld-problem/113388/4 "2020-11-30T15:52:22Z")

</div>

Hi Baris,

this is an old script someone else postet a while ago. I haven’t created the c# scripts myself and I’m not looking for naked edges.

I need to unweld the mesh at the edge indices provided.

---

<div class="post-metadata">

**Author:** ![Baris](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/baris/32/759711_2.png) [@Baris](https://discourse.mcneel.com/u/Baris)\
**Post date:** [November 30, 2020, 4:01pm UTC](https://discourse.mcneel.com/t/mesh-script-unweld-problem/113388/5 "2020-11-30T16:01:51Z")

</div>

Add this lines:

 ![imagen](https://global.discourse-cdn.com/mcneel/uploads/default/original/4X/b/3/8/b3896f3d7cf2513671a83e2cb761ce3db9f02264.png)

---

<div class="post-metadata">

**Author:** ![Baris](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/baris/32/759711_2.png) [@Baris](https://discourse.mcneel.com/u/Baris)\
**Post date:** [November 30, 2020, 4:11pm UTC](https://discourse.mcneel.com/t/mesh-script-unweld-problem/113388/6 "2020-11-30T16:11:59Z")

</div>

I have not Rhino 7 installed to further try stuff, but there is some strange things going on in the c# scripts:  
Besides the really confusing naming it is redundant:

 ![imagen](https://global.discourse-cdn.com/mcneel/uploads/default/original/4X/9/5/3/9537a6888ef0f9adde4e8c887705e970693672ae.png)  
This could be done like that:  
 ![imagen](https://global.discourse-cdn.com/mcneel/uploads/default/original/4X/6/b/c/6bc13a7f905566ec857edfb56151a2e7f54cc199.png)  
[20\_11\_28\_subd\_rotational\_symmetryRe.gh](https://discourse.mcneel.com/uploads/short-url/qOj22xvHTN8zntRTki0tounLDAW.gh) (17.5 KB)

---

<div class="post-metadata">

**Author:** ![martinsiegrist](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/martinsiegrist/32/498369_2.png) [@martinsiegrist](https://discourse.mcneel.com/u/martinsiegrist)\
**Post date:** [November 30, 2020, 4:22pm UTC](https://discourse.mcneel.com/t/mesh-script-unweld-problem/113388/7 "2020-11-30T16:22:39Z")

</div>

Thanks for your help! The unweld problem has been solved.

 ![image](https://global.discourse-cdn.com/mcneel/uploads/default/original/4X/1/f/9/1f93fe340483ff4d76b1535a74fef7b338d4325c.png)

As for the midpoints and the next script, that simplification doesn’t work yet.

---

<div class="post-metadata">

**Author:** ![Baris](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/baris/32/759711_2.png) [@Baris](https://discourse.mcneel.com/u/Baris)\
**Post date:** [November 30, 2020, 4:36pm UTC](https://discourse.mcneel.com/t/mesh-script-unweld-problem/113388/8 "2020-11-30T16:36:54Z")

</div>

hmm, if they are unwelded correctly it should work.

---

<div class="post-metadata">

**Author:** ![martinsiegrist](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/martinsiegrist/32/498369_2.png) [@martinsiegrist](https://discourse.mcneel.com/u/martinsiegrist)\
**Post date:** [November 30, 2020, 5:14pm UTC](https://discourse.mcneel.com/t/mesh-script-unweld-problem/113388/9 "2020-11-30T17:14:59Z")

</div>

OK, needed another MeshJoin…

[20\_11\_30\_subd\_rotational\_symmetry.gh](https://discourse.mcneel.com/uploads/short-url/oOUG6PFQVdGaCDCmIiQqnbRzveP.gh) (37.8 KB)

 ![image](https://global.discourse-cdn.com/mcneel/uploads/default/original/4X/2/8/5/285236f3dc06ca78841b25ed01d6561fa65c6777.jpeg)

---

<div class="post-metadata">

**Author:** ![martinsiegrist](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/martinsiegrist/32/498369_2.png) [@martinsiegrist](https://discourse.mcneel.com/u/martinsiegrist)\
**Post date:** [November 30, 2020, 6:19pm UTC](https://discourse.mcneel.com/t/mesh-script-unweld-problem/113388/10 "2020-11-30T18:19:50Z")

</div>

The definition can now handle both interior and / or naked creased edges.

 ![image](https://global.discourse-cdn.com/mcneel/uploads/default/original/4X/d/b/a/dbac76a7bcdbc0bf0afe97d16d81ffd22f72a070.jpeg)

[20\_11\_30\_subd\_rotational\_symmetry.gh](https://discourse.mcneel.com/uploads/short-url/zSNTOORpEV1wHkRwYQs2oMudRbU.gh) (54.3 KB)

---

<div class="post-metadata">

**Author:** ![leex](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/leex/32/476563_2.png) [@leex](https://discourse.mcneel.com/u/leex)\
**Post date:** [December 2, 2020, 9:05pm UTC](https://discourse.mcneel.com/t/mesh-script-unweld-problem/113388/11 "2020-12-02T21:05:54Z")

</div>

Hi Martin  
I am testing your definition.  
Works very well, but there are small issues.  
I cannot sort some folds where there is a dot with a crease at the corners.  
In the original model, the point is a sharp crease, but the definition creates a smooth crease. Could you work it out please?

I attach your definition with creases sorted for my model

There is also a general question about the Grasshopper.  
A preview of the resulting geometry is always shown in the DisplayMode by default. I mean light scheme.  
For comfortable modeling and familiar perception in the process of work, I want to get a preview with the settings of my display mode. For example my Shaded or my Rendered. How to do it?

Thanx  
[Rotational\_Symmetry.gh](https://discourse.mcneel.com/uploads/short-url/yO7vshZY62BdEfDKA0kf4kfawnJ.gh) (28.8 KB)

---

<div class="post-metadata">

**Author:** ![martinsiegrist](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/martinsiegrist/32/498369_2.png) [@martinsiegrist](https://discourse.mcneel.com/u/martinsiegrist)\
**Post date:** [December 2, 2020, 10:04pm UTC](https://discourse.mcneel.com/t/mesh-script-unweld-problem/113388/12 "2020-12-02T22:04:39Z")

</div>

There’s the corner setting on the ‘SubDFromMesh’ component which should be set to ‘At Mesh Corners’ but other than that I don’t know what the problem is. Somehow it depends on the choice of creased edges. I’m usually trying to avoid sharpe edges on SubD geometry unless it is really required. Instead I would add another loop or ring or bevel an edge.

 ![image](https://global.discourse-cdn.com/mcneel/uploads/default/original/4X/7/3/7/73703cae865e9c8810237c682f94920041b59872.jpeg)

 ![image](https://global.discourse-cdn.com/mcneel/uploads/default/original/4X/5/b/7/5b723f2ade5752a2ee686a97d901dcf33e985473.jpeg)

If you want a different display mode there is a ‘Create Material’ component which allows transparency and or shine to some extend.

---

<div class="post-metadata">

**Author:** ![leex](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/leex/32/476563_2.png) [@leex](https://discourse.mcneel.com/u/leex)\
**Post date:** [December 2, 2020, 10:43pm UTC](https://discourse.mcneel.com/t/mesh-script-unweld-problem/113388/13 "2020-12-02T22:43:11Z")

</div>

Do you mean that?  
Maybe I don’t understand, nothing is happening

 ![Corners](https://global.discourse-cdn.com/mcneel/uploads/default/original/4X/7/f/3/7f3ec89a0c90ecf24a6a8fe19768b479f7c4750b.jpeg)

---

<div class="post-metadata">

**Author:** ![martinsiegrist](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/martinsiegrist/32/498369_2.png) [@martinsiegrist](https://discourse.mcneel.com/u/martinsiegrist)\
**Post date:** [December 2, 2020, 11:16pm UTC](https://discourse.mcneel.com/t/mesh-script-unweld-problem/113388/14 "2020-12-02T23:16:14Z")

</div>

Yes that one but again I’m not really sure what the problem is with corners.

---

<div class="post-metadata">

**Author:** ![martinsiegrist](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/martinsiegrist/32/498369_2.png) [@martinsiegrist](https://discourse.mcneel.com/u/martinsiegrist)\
**Post date:** [December 2, 2020, 11:45pm UTC](https://discourse.mcneel.com/t/mesh-script-unweld-problem/113388/15 "2020-12-02T23:45:13Z")

</div>

I’ve extended my test file for rotational symmetry with a flow along curve feature.

It allows rotational stretching of an segment.

[https://global.discourse-cdn.com/mcneel/uploads/default/original/4X/9/c/a/9ca0060765a1701101f78084b31f949ac8738bc5.mp4](https://global.discourse-cdn.com/mcneel/uploads/default/original/4X/9/c/a/9ca0060765a1701101f78084b31f949ac8738bc5.mp4)

---

<div class="post-metadata">

**Author:** ![leex](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/leex/32/476563_2.png) [@leex](https://discourse.mcneel.com/u/leex)\
**Post date:** [December 3, 2020, 12:01am UTC](https://discourse.mcneel.com/t/mesh-script-unweld-problem/113388/16 "2020-12-03T00:01:23Z")

</div>

This is a multicomponent model Subd + Nurbs  
In the empty cavity I will inscribe the geometry from planes that have sharp corners, so I need a sharp corner of Subd. Well, among other things the inconsistency of the obtained geometry from GH makes me confused.

I have set a new component for corners, change values ​​but nothing happens. I can’t understand why.

I also created a material, but the edges are white. How do I set the edges to black? This the single Displaymode method?  
Why can’t GH use the current Rhino settings?  
[https://discourse.mcneel.com/uploads/short-url/i3NX4CjDCakJx8YXTSxFES0bQ9X.gh](https://discourse.mcneel.com/uploads/short-url/i3NX4CjDCakJx8YXTSxFES0bQ9X.gh)

---

<div class="post-metadata">

**Author:** ![martinsiegrist](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/martinsiegrist/32/498369_2.png) [@martinsiegrist](https://discourse.mcneel.com/u/martinsiegrist)\
**Post date:** [December 3, 2020, 12:07am UTC](https://discourse.mcneel.com/t/mesh-script-unweld-problem/113388/17 "2020-12-03T00:07:16Z")

</div>

If possible, post the file with the NURBS star

---

<div class="post-metadata">

**Author:** ![leex](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/leex/32/476563_2.png) [@leex](https://discourse.mcneel.com/u/leex)\
**Post date:** [December 3, 2020, 12:09am UTC](https://discourse.mcneel.com/t/mesh-script-unweld-problem/113388/18 "2020-12-03T00:09:34Z")

</div>

Apologies but I haven’t the power.  
anyone else’s property

---

<div class="post-metadata">

**Author:** ![leex](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/leex/32/476563_2.png) [@leex](https://discourse.mcneel.com/u/leex)\
**Post date:** [December 3, 2020, 1:18am UTC](https://discourse.mcneel.com/t/mesh-script-unweld-problem/113388/19 "2020-12-03T01:18:48Z")

</div>

@martinsiegrist  
**I do not have rights!**  
Does it look strange or so unfriendly?  
Thanks a lot anyway dear Martin!  
Not finished but our work will benefit many other users.  
Radial symmetry has not yet been realized.

---

<div class="post-metadata">

**Author:** ![martinsiegrist](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/martinsiegrist/32/498369_2.png) [@martinsiegrist](https://discourse.mcneel.com/u/martinsiegrist)\
**Post date:** [December 3, 2020, 10:02am UTC](https://discourse.mcneel.com/t/mesh-script-unweld-problem/113388/20 "2020-12-03T10:02:08Z")

</div>

No problem.

Regarding your problem of sharp edges… T-Splines had an option to match a curve or surface and add a refinement for closer matching. In case of your star shape, the edge is still not perfectly pointy

 ![image](https://global.discourse-cdn.com/mcneel/uploads/default/original/4X/5/d/7/5d7866c73e7dfd80c3c868314a41afecb048478d.jpeg)

If I were you I would build the star as SubD too.

[Next page](https://discourse.mcneel.com/t/mesh-script-unweld-problem/113388.md?page=2)
