# Can you get what the current rectMode is?

**URL:** <https://discourse.processing.org/t/can-you-get-what-the-current-rectmode-is/37870>\
**Category:** Processing.py\
**Created:** [July 7, 2022, 11:05am UTC](https://discourse.processing.org/t/can-you-get-what-the-current-rectmode-is/37870 "2022-07-07T11:05:27Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![The\_Math\_Maniac1](https://avatars.discourse-cdn.com/v4/letter/t/34f0e0/32.png) [@The\_Math\_Maniac1](https://discourse.processing.org/u/The_Math_Maniac1)\
**Post date:** [July 7, 2022, 11:05am UTC](https://discourse.processing.org/t/can-you-get-what-the-current-rectmode-is/37870/1 "2022-07-07T11:05:27Z")

</div>

I want to make a custom rectangle function, and I want to base how it draws the rectangle on what the current rectMode is. Is it possible to get what rectMode the sketch is currently on? Something like

```auto
rectMode(CENTER)
R = rectMode
print(R)

```

would return CENTER or some associated number. If it’s not possible I have other options, but this would just make more sense. Thanks for any help!

---

<div class="post-metadata">

**Author:** ![GoToLoop](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/gotoloop/32/86_2.png) [@GoToLoop](https://discourse.processing.org/u/GoToLoop)\
**Post date:** [July 8, 2022, 3:55am UTC](https://discourse.processing.org/t/can-you-get-what-the-current-rectmode-is/37870/2 "2022-07-08T03:55:30Z")

</div>

- PGraphics::[_rectMode_](http://processing.github.io/processing-javadocs/core/processing/core/PGraphics.html#rectMode)
- PApplet::[_g_](http://processing.github.io/processing-javadocs/core/processing/core/PApplet.html#g)
- PApplet::[**getGraphics()**](http://processing.github.io/processing-javadocs/core/processing/core/PApplet.html#getGraphics--)
- Class::[**getDeclaredField()**](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Class.html#getDeclaredField(java.lang.String))
- Field::[**get()**](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/reflect/Field.html#get(java.lang.Object))

1. `print PGraphics.getDeclaredField('rectMode').get(g) == CORNER`
2. `print PGraphics.getDeclaredField('rectMode').get(this.graphics) == CORNER`
3. `print PGraphics.getDeclaredField('rectMode').get(this.getGraphics()) == CORNER`

> **[rectMode() \\ Language (API)](https://py.Processing.org/reference/rectMode.html)**
>
> Python Mode for Processing extends the Processing Development Environment with the Python programming language.
