# Need help debugging a problem

**URL:** <https://discourse.mcneel.com/t/need-help-debugging-a-problem/66522>\
**Category:** Grasshopper Developer\
**Created:** [July 7, 2018, 2:47pm UTC](https://discourse.mcneel.com/t/need-help-debugging-a-problem/66522 "2018-07-07T14:47:05Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![ivelin.peychev](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/ivelin.peychev/32/676038_2.png) [@ivelin.peychev](https://discourse.mcneel.com/u/ivelin.peychev)\
**Post date:** [July 7, 2018, 2:47pm UTC](https://discourse.mcneel.com/t/need-help-debugging-a-problem/66522/1 "2018-07-07T14:47:05Z")

</div>

Could someone help me find out why do I get negative number for max-deviation line Y coordinate, when all the points of the curves in scope have positive Y and Z coordinates.

 ![image](https://global.discourse-cdn.com/mcneel/uploads/default/original/3X/e/a/eacdddd5ab24dceed7ee645bfa4dd195d07ea8ff.png)

 ![image](https://global.discourse-cdn.com/mcneel/uploads/default/original/3X/5/9/59a2a8c55f2452668c8873cfe71fe3f9ff166904.png)

[something \_wrong.gh](https://global.discourse-cdn.com/mcneel/uploads/default/original/3X/3/a/3ae2e81db18da29141a12869689ceb48c457f497.gh) (22.9 KB)

Update: Thread where the component was created. Just adding it for navigation purposes.

> [@\[Solved\] What is GH alternative of the 'crvdeviation' Rhino command?](https://discourse.mcneel.com/t/solved-what-is-gh-alternative-of-the-crvdeviation-rhino-command/65174/11):
>
> For the sake of completeness I created a Python component based on the C# from the thread @tim.stark posted. [curve\_deviation.gh](https://global.discourse-cdn.com/mcneel/uploads/default/original/3X/f/1/f1e17cdee54e00afe77dfb9bc2f6b8bdcf8b9697.gh) (11.3 KB) EDIT: fixed small typo in the component

Update:  
@piac, when you have time could you help me with this. On the above mentioned thread there’s a csharp component that I translated to python, for me they are the same but there’s some bug in my Python translation that causes this.

---

<div class="post-metadata">

**Author:** ![ivelin.peychev](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/ivelin.peychev/32/676038_2.png) [@ivelin.peychev](https://discourse.mcneel.com/u/ivelin.peychev)\
**Post date:** [July 25, 2018, 2:27pm UTC](https://discourse.mcneel.com/t/need-help-debugging-a-problem/66522/2 "2018-07-25T14:27:26Z")

</div>

Anyone?

---

<div class="post-metadata">

**Author:** ![dsonntag](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/dsonntag/32/529361_2.png) [@dsonntag](https://discourse.mcneel.com/u/dsonntag)\
**Post date:** [July 25, 2018, 3:27pm UTC](https://discourse.mcneel.com/t/need-help-debugging-a-problem/66522/3 "2018-07-25T15:27:12Z")

</div>

I have no idea what the rs function does, but shouldn’t it be:

maxDptA = curveA.PointAt(maxA)  
maxDptB = curveB.PointAt(maxB)  
minDptA = curveA.PointAt(minA)  
minDptB = curveB.PointAt(minB)

?

---

<div class="post-metadata">

**Author:** ![ivelin.peychev](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/ivelin.peychev/32/676038_2.png) [@ivelin.peychev](https://discourse.mcneel.com/u/ivelin.peychev)\
**Post date:** [July 25, 2018, 3:59pm UTC](https://discourse.mcneel.com/t/need-help-debugging-a-problem/66522/4 "2018-07-25T15:59:44Z")

</div>

No, it is connecting the min deviation point of curveA to min deviation point of curve B, and respectively maxDpt from crvA with maxDpt from crvB. Creating lines between them.

The issue is that using the same algorithm in Csharp works but Python doesn’t.

Update:

 ![image](https://global.discourse-cdn.com/mcneel/original/3X/c/4/c47b6865a76683a9f1732edde9ff6825d884c824.png)

[something \_wrong.gh](https://global.discourse-cdn.com/mcneel/uploads/default/original/3X/4/3/436b6472ba6d8e500c867689ab1367a8b6b0b127.gh) (25.3 KB)

---

<div class="post-metadata">

**Author:** ![dsonntag](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/dsonntag/32/529361_2.png) [@dsonntag](https://discourse.mcneel.com/u/dsonntag)\
**Post date:** [July 25, 2018, 4:47pm UTC](https://discourse.mcneel.com/t/need-help-debugging-a-problem/66522/5 "2018-07-25T16:47:59Z")

</div>

Your C# Script:

```
    var maxDistPtA = curveA.PointAt(maxDistanceParameterA);
    var maxDistPtB = curveB.PointAt(maxDistanceParameterB);
    var minDistPtA = curveA.PointAt(minDistanceParameterA);
    var minDistPtB = curveB.PointAt(minDistanceParameterB);

```

Your Python Script:

```
    maxDptA = curveA.PointAt(maxA)
    maxDptB = curveA.PointAt(maxB)
    minDptA = curveB.PointAt(minA)
    minDptB = curveB.PointAt(minB)

```

Both codes would be the same if you’d have:

```
    maxDptA = curveA.PointAt(maxA)
    maxDptB = curveB.PointAt(maxB)
    minDptA = curveA.PointAt(minA)
    minDptB = curveB.PointAt(minB)

```

Or in words: you are taking a parameter referring to curve B which is called maxB and evaluate curve A with it, and vice versa. If you still have doubts, adjust your code as suggested in the previous post, they then produce identical results.

---

<div class="post-metadata">

**Author:** ![ivelin.peychev](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/ivelin.peychev/32/676038_2.png) [@ivelin.peychev](https://discourse.mcneel.com/u/ivelin.peychev)\
**Post date:** [July 25, 2018, 4:56pm UTC](https://discourse.mcneel.com/t/need-help-debugging-a-problem/66522/6 "2018-07-25T16:56:03Z")

</div>

How very interesting.

You know I worked with this component ever since I wrote it, and had no problems, but once I scaled a huge model to work with meters I noticed there’s something wrong.

That’s why they say 4 eyes are better than 2.

Thanks a lot
