# What's the efficient way of remove these closed polycurve segments and keep the curve closed?

**URL:** <https://discourse.mcneel.com/t/whats-the-efficient-way-of-remove-these-closed-polycurve-segments-and-keep-the-curve-closed/125248>\
**Category:** Rhino Developer\
**Tags:** windows, rhinocommon, python, rhino7\
**Created:** [June 2, 2021, 6:09pm UTC](https://discourse.mcneel.com/t/whats-the-efficient-way-of-remove-these-closed-polycurve-segments-and-keep-the-curve-closed/125248 "2021-06-02T18:09:55Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Asterisk](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/asterisk/32/480872_2.png) [@Asterisk](https://discourse.mcneel.com/u/Asterisk)\
**Post date:** [June 2, 2021, 6:09pm UTC](https://discourse.mcneel.com/t/whats-the-efficient-way-of-remove-these-closed-polycurve-segments-and-keep-the-curve-closed/125248/1 "2021-06-02T18:09:55Z")

</div>

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

I’m thinking:

1. Dupe segments
2. Check angle between adjacent ones
3. Remove if found
4. Fillet with radius 0 previous with the next segments
5. Join and replace original curve
6. Repeat until nothing found anymore

Does it seem sensible?

---

<div class="post-metadata">

**Author:** ![Willem](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/willem/32/773637_2.png) [@Willem](https://discourse.mcneel.com/u/Willem)\
**Post date:** [June 2, 2021, 10:30pm UTC](https://discourse.mcneel.com/t/whats-the-efficient-way-of-remove-these-closed-polycurve-segments-and-keep-the-curve-closed/125248/2 "2021-06-02T22:30:18Z")

</div>

I guess in addition to or replacement of finding the angle you can check the distance between 2 adjacent segments end and start points.  
If end-start distances are below a threshold value you can identify them as being a sliver and cull them.

---

<div class="post-metadata">

**Author:** ![Asterisk](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/asterisk/32/480872_2.png) [@Asterisk](https://discourse.mcneel.com/u/Asterisk)\
**Post date:** [June 3, 2021, 1:15pm UTC](https://discourse.mcneel.com/t/whats-the-efficient-way-of-remove-these-closed-polycurve-segments-and-keep-the-curve-closed/125248/3 "2021-06-03T13:15:02Z")

</div>

Yes, that’s exactly what I needed and figured out to do after I posted, no angle measurements needed.
