# Getting error while trying to create a Rectangle 2Pt from gh python

**URL:** <https://discourse.mcneel.com/t/getting-error-while-trying-to-create-a-rectangle-2pt-from-gh-python/142892>\
**Category:** Grasshopper\
**Tags:** windows, python, rhino6\
**Created:** [May 22, 2022, 4:21pm UTC](https://discourse.mcneel.com/t/getting-error-while-trying-to-create-a-rectangle-2pt-from-gh-python/142892 "2022-05-22T16:21:37Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![vijesh](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/vijesh/32/509577_2.png) [@vijesh](https://discourse.mcneel.com/u/vijesh)\
**Post date:** [May 22, 2022, 4:21pm UTC](https://discourse.mcneel.com/t/getting-error-while-trying-to-create-a-rectangle-2pt-from-gh-python/142892/1 "2022-05-22T16:21:37Z")

</div>

Dear all,  
I am trying to create a rectangle by translating the info from a point (which is considered the midpoint of the rectangle geometry.). While I wrote the code in GHPython but got stuck. Am getting an error while trying to create a Rectangle 2Pt from gh python.  
Thanks in advance  
Vijesh

---

<div class="post-metadata">

**Author:** ![anon39580149](https://avatars.discourse-cdn.com/v4/letter/a/977dab/32.png) [@anon39580149](https://discourse.mcneel.com/u/anon39580149)\
**Post date:** [May 22, 2022, 5:16pm UTC](https://discourse.mcneel.com/t/getting-error-while-trying-to-create-a-rectangle-2pt-from-gh-python/142892/2 "2022-05-22T17:16:35Z")

</div>

Where is the code?

---

<div class="post-metadata">

**Author:** ![vijesh](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/vijesh/32/509577_2.png) [@vijesh](https://discourse.mcneel.com/u/vijesh)\
**Post date:** [May 23, 2022, 3:59am UTC](https://discourse.mcneel.com/t/getting-error-while-trying-to-create-a-rectangle-2pt-from-gh-python/142892/3 "2022-05-23T03:59:27Z")

</div>

Am sorry, I missed attaching the file. Here it is.

 ![error](https://global.discourse-cdn.com/mcneel/uploads/default/original/4X/e/e/0/ee0536d52737c2236e6742fa251248e4553bc436.png)

---

<div class="post-metadata">

**Author:** ![bbalbastre](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/bbalbastre/32/643080_2.png) [@bbalbastre](https://discourse.mcneel.com/u/bbalbastre)\
**Post date:** [May 23, 2022, 7:29am UTC](https://discourse.mcneel.com/t/getting-error-while-trying-to-create-a-rectangle-2pt-from-gh-python/142892/4 "2022-05-23T07:29:05Z")

</div>

Hi @vijesh

Rectangle2PT component needs a plane, two points located in the plane defined before, and a radius. Maybe the mistake is because you are not assigning a hint to the variables.

In your case, x should be a plane, and y and z should be a point3D.

 ![image](https://global.discourse-cdn.com/mcneel/uploads/default/original/4X/9/9/e/99e1c428f242f1d77fed140a9a78e4a810bf1d57.png)

Regards

[Rectangle2PT.gh](https://discourse.mcneel.com/uploads/short-url/7FCZGnVTRM9aur903E3KLsuCVjh.gh) (6.4 KB)

---

<div class="post-metadata">

**Author:** ![anon39580149](https://avatars.discourse-cdn.com/v4/letter/a/977dab/32.png) [@anon39580149](https://discourse.mcneel.com/u/anon39580149)\
**Post date:** [May 23, 2022, 9:57am UTC](https://discourse.mcneel.com/t/getting-error-while-trying-to-create-a-rectangle-2pt-from-gh-python/142892/5 "2022-05-23T09:57:24Z")

</div>

You can use `ghpythonlib.components` or `Rhino.Geometry`

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

 ![image](https://global.discourse-cdn.com/mcneel/uploads/default/original/4X/c/e/c/cec87be289d464d08464f739c5bf6b26d93af3d9.png)

[rec.gh](https://discourse.mcneel.com/uploads/short-url/n8bBkdSPYsNZa5mPRxrzBMrpj7Y.gh) (5.2 KB)

---

<div class="post-metadata">

**Author:** ![vijesh](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/vijesh/32/509577_2.png) [@vijesh](https://discourse.mcneel.com/u/vijesh)\
**Post date:** [May 23, 2022, 12:34pm UTC](https://discourse.mcneel.com/t/getting-error-while-trying-to-create-a-rectangle-2pt-from-gh-python/142892/6 "2022-05-23T12:34:29Z")

</div>

Thank you very much for the replies. I did not set the points and plane on ‘Type Hint’. I have solved it with the given instructions. Thanks for both.
