# Gumball possible behavior or more specific custom widget?

**URL:** <https://discourse.mcneel.com/t/gumball-possible-behavior-or-more-specific-custom-widget/43288>\
**Category:** Rhino for Windows\
**Tags:** rhino, gumball, python\
**Created:** [April 19, 2017, 7:16pm UTC](https://discourse.mcneel.com/t/gumball-possible-behavior-or-more-specific-custom-widget/43288 "2017-04-19T19:16:45Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![bmartin](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/bmartin/32/514301_2.png) [@bmartin](https://discourse.mcneel.com/u/bmartin)\
**Post date:** [April 19, 2017, 7:16pm UTC](https://discourse.mcneel.com/t/gumball-possible-behavior-or-more-specific-custom-widget/43288/1 "2017-04-19T19:16:46Z")

</div>

Hi,

I have a mesh surface onto which I want to project a special planar curve like an ellipse. To allow precise positioning of the curve, I would like to constrain its center always touch the mesh surface so its supporting plane is tangent to the mesh surface at the contact point.

Can this be achieved with a Gumball or would I need a custom Widget? If so, is there a Python code example upon which I could base my custom widget?

Thanks,

Bruno

---

<div class="post-metadata">

**Author:** ![Alexandre\_Filiatraul](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/alexandre_filiatraul/32/669191_2.png) [@Alexandre\_Filiatraul](https://discourse.mcneel.com/u/Alexandre_Filiatraul)\
**Post date:** [April 19, 2017, 7:43pm UTC](https://discourse.mcneel.com/t/gumball-possible-behavior-or-more-specific-custom-widget/43288/2 "2017-04-19T19:43:27Z")

</div>

![](https://global.discourse-cdn.com/mcneel/uploads/default/original/3X/d/6/d68d0bf339c70982bba64e9f0ca4907704b3b24e.png)

Here is what Bruno is talking about: The right curve is at the initial location. When moving it to the left side, we would want it to rotate automatically towards the mesh, as shown at the left side with its gumball. Here, the rotation has been done manually.

Thanks,

Alexandre

---

<div class="post-metadata">

**Author:** ![pascal](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/pascal/32/479395_2.png) [@pascal](https://discourse.mcneel.com/u/pascal)\
**Post date:** [April 19, 2017, 8:33pm UTC](https://discourse.mcneel.com/t/gumball-possible-behavior-or-more-specific-custom-widget/43288/3 "2017-04-19T20:33:30Z")

</div>

Hi bmartin - so you want to slide the curve around ‘freehand’ but in a way that is constrained to the mesh, paying attention to the normals, is that correct?

-Pascal

---

<div class="post-metadata">

**Author:** ![bmartin](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/bmartin/32/514301_2.png) [@bmartin](https://discourse.mcneel.com/u/bmartin)\
**Post date:** [April 20, 2017, 12:52pm UTC](https://discourse.mcneel.com/t/gumball-possible-behavior-or-more-specific-custom-widget/43288/4 "2017-04-20T12:52:47Z")

</div>

The final result would be just what you described but I would be glad to make it work in 2 steps (implementation might be way simpler):

1. Just constrain the “middle” of the planar curve to be a point on the mesh. The normal at this point would define a plane where my curve would lie. Moving this point along the mesh would make the plane change as it adjusts to the new point normal of the mesh.
2. When the positioning is satisfying, project the planar curve onto the mesh in the direction of the normal at the contact point defined in 1).

Also, as my curve is not a circle, during step 1), I would like to be able to rotate the curve around the axis defined by the contact point and the mesh normal. This way, I would be able to control precisely its position and orientation before projecting on the mesh.

Does that makes sense to you?

Bruno

---

<div class="post-metadata">

**Author:** ![pascal](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/pascal/32/479395_2.png) [@pascal](https://discourse.mcneel.com/u/pascal)\
**Post date:** [April 20, 2017, 6:32pm UTC](https://discourse.mcneel.com/t/gumball-possible-behavior-or-more-specific-custom-widget/43288/5 "2017-04-20T18:32:25Z")

</div>

Hi Bruno - it makes sense, but I do not see how to get there easily- I’d ask the giant brains over on the scripting and developer forums-

> **[Scripting](https://discourse.mcneel.com/c/scripting)**
>
> Topics related to RhinoScript and Python scripting.

-Pascal
