# Curve Cleanup for CAM

**URL:** <https://discourse.mcneel.com/t/curve-cleanup-for-cam/79760>\
**Category:** Grasshopper\
**Tags:** cam, grasshopper, curves\
**Created:** [March 6, 2019, 4:34am UTC](https://discourse.mcneel.com/t/curve-cleanup-for-cam/79760 "2019-03-06T04:34:50Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![DraftVader](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/draftvader/32/546674_2.png) [@DraftVader](https://discourse.mcneel.com/u/DraftVader)\
**Post date:** [March 6, 2019, 4:34am UTC](https://discourse.mcneel.com/t/curve-cleanup-for-cam/79760/1 "2019-03-06T04:34:50Z")

</div>

Dear all, I need your help with this

We received a truckload of linework output from illustrator, unfortunately the segments are not tangent where need to be. I developed a script to identify said kinks. Can anyone suggest an efficient way of achieving tangency between consecutive segments at the identified points? Thank you very much!!

[CAM Processing Test.3dm](https://global.discourse-cdn.com/mcneel/uploads/default/original/3X/4/0/40238f646a460ee414d6953676ca2c4305849439.3dm) (51.9 KB)  
[CAM Processing.gh](https://global.discourse-cdn.com/mcneel/uploads/default/original/3X/5/e/5eaa32455d29bee43b48f96928620504fd79838f.gh) (54.8 KB)

 ![Discontinuity%20Points](https://global.discourse-cdn.com/mcneel/original/3X/b/b/bba6cafba9018379be41b6b238d4c12bdbf82bbc.png)

---

<div class="post-metadata">

**Author:** ![TomTom](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/tomtom/32/651939_2.png) [@TomTom](https://discourse.mcneel.com/u/TomTom)\
**Post date:** [March 6, 2019, 6:06am UTC](https://discourse.mcneel.com/t/curve-cleanup-for-cam/79760/2 "2019-03-06T06:06:18Z")

</div>

Hello,

for tangency alignment you only need to bring the first two cps of each curve into a line. I made a component some time ago to match curves even with G2. However its no a one-click solution, so all the sorting has to be done beforehand.It does only match two curves and nothing more. Depending on the file, sorting is not as trivial as well. But you might get it done already, if not just tell me and I‘ll have look this day…  
… if an manual approach isn’t the fastest solution here anyway…

> [@MatchCrv in gh](https://discourse.mcneel.com/t/matchcrv-in-gh/58835/7):
>
> Hello, here is a match curve component I made sometime ago. Wasn’t made for public, so don’t blame me if it does not work as expected. Its an improved version of ASTools “Fit Curve”. Always make sure to unblock .gha. [MatchCurve.gha](https://global.discourse-cdn.com/mcneel/uploads/default/original/3X/4/b/4b0722ac2a2ad2d300c5c6feffb82a766affce86.gha) (18.5 KB) [matchTest.gh](https://global.discourse-cdn.com/mcneel/uploads/default/original/3X/0/9/09121288a732a61daeefa30e78faf0b3d756b022.gh) (15.0 KB)

---

<div class="post-metadata">

**Author:** ![Helvetosaur](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/helvetosaur/32/635974_2.png) [@Helvetosaur](https://discourse.mcneel.com/u/Helvetosaur)\
**Post date:** [March 6, 2019, 8:21am UTC](https://discourse.mcneel.com/t/curve-cleanup-for-cam/79760/3 "2019-03-06T08:21:54Z")

</div>

I developed a python (non-GH) script for this awhile back - I’ll just throw it out here FWIW. You should be able to select all curves at once and run the script. Limited to planar degree 3 curves. As with all “automatic” solutions, run some tests to make sure it does what you want, and check the results carefully…

[CheckFixNearTangentKinks.py](https://global.discourse-cdn.com/mcneel/uploads/default/original/3X/f/d/fd8d6811fec56020f887c192df786a808d8856e0.py) (6.8 KB)

---

<div class="post-metadata">

**Author:** ![DraftVader](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/draftvader/32/546674_2.png) [@DraftVader](https://discourse.mcneel.com/u/DraftVader)\
**Post date:** [April 1, 2019, 12:30am UTC](https://discourse.mcneel.com/t/curve-cleanup-for-cam/79760/4 "2019-04-01T00:30:47Z")

</div>

Thanks a million. worked a treat

---

<div class="post-metadata">

**Author:** ![DraftVader](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/draftvader/32/546674_2.png) [@DraftVader](https://discourse.mcneel.com/u/DraftVader)\
**Post date:** [April 1, 2019, 12:31am UTC](https://discourse.mcneel.com/t/curve-cleanup-for-cam/79760/5 "2019-04-01T00:31:14Z")

</div>

Thank you Tom, very helpful
