Set Clipping Region behavior

I want to utilize Set Clipping Region in connection with Find OCR Text but I experience some strange behavior…

Find OCR Text returns following clipping region (Left, Top, Right, Bottom) (583, 381, 660, 393)
Execute Set Clipping Region (10, 0, 0, 0)
Expect result (573, 381, 660, 393)
Getting result (573, 381, 670, 393)

Pls clarify if this is correct result.
If yes pls explain the logic used in Set Clipping Region to calculate the new region.


1 Like


If you want to achieve this behavior you need to set your clipping region Direction (under input) to Translate.

If you want to offset your “Left” value from 10 pixel, you need to compensate on the right with minus this value.
if you don’t compensate, the width of your rectangle will be impacted.

in your case it will be (10,0,-10,0)



Thx. This works fine if I use static region.

I shall mention that I get the above result when using dynamic region by supplying the Region parameter
New UiPath.Core.Region(New System.Drawing.Rectangle(10, 0, 0, 0))

Maybe I am using the Region parameter a wrong way… :frowning:


1 Like


I’m new to UiPath and I’m trying to understand the [Input.Direction] methods of Set Clipping (as I posted here: Set Clipping Region; Input.Direction (Rectangle vs Translate vs Left, Right, Top, Bottom) ). Any feedback on that post is appreciated too!

Based on your answer above I’m still a little confused how the “Left” [Direction] is working? I think what’s being said is if the [Input.Direction] is set to “Left”, a positive integer applied to the “Left” coordinate would result in the SetClippingRegion moving to the left by that amount (similar to a negative integer in the “Translate” option). Meanwhile you mention the Right coordinate would be skewed unless a negative amount was added to it which is where I get lost: how does the skew work?

It’s a mystery to my why the Right figure in J0ska’s example Added 10 when I would have thought it would just stay in the same place in the x, y plane or if anything moved Left relative to the first coordinate; which would have made it 10 less (650). I understand it would have skewed the rectangle because it just grew to the left by 10, but why would the Right have also gained an additional 10 on top of that (so now a difference in width of 20 for the rectangle)?

Also why would you need to add a negative if the [Input.Direction] is set to “Left”? Wouldn’t this mean a positive integer would be required to go in the “Right” field to move it left?

If the execute Clipping Region was (10, 0, 10, 0) what would the final result be; would it be padded twice on both sides, once for Left and once for Right? In other words would the second figure pad another 10 on to both left and right to give the rectangle a total skewed width of 40 instead of 20 as above? (563, 381, 680, 393)?

Any clarification is much appreciated by this Rookie!