# Avoiding temporary world zones reset.

**URL:** <https://tech-community.robotics.abb.com/t/avoiding-temporary-world-zones-reset/9146>\
**Category:** RAPID Programming\
**Tags:** robotstudio, worldzones\
**Created:** [October 12, 2019, 2:32am UTC](https://tech-community.robotics.abb.com/t/avoiding-temporary-world-zones-reset/9146 "2019-10-12T02:32:41Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kami](https://dub1.discourse-cdn.com/flex005/user_avatar/tech-community.robotics.abb.com/kami/32/949_2.png) [@Kami](https://tech-community.robotics.abb.com/u/Kami)\
**Post date:** [October 12, 2019, 2:32am UTC](https://tech-community.robotics.abb.com/t/avoiding-temporary-world-zones-reset/9146/1 "2019-10-12T02:32:41Z")

</div>

Hello,  
I am in a situation that I have to set up and free different temporary world zones dynamically.  
I am encountering a problem that the temporary world zones are automatically erased after pptomain or pp leaves the routine where the world zones are set.  
Is there a method that can keep those temporary world zones activated until they are freed?  
Thanks

---

<div class="post-metadata">

**Author:** ![lemster68](https://dub1.discourse-cdn.com/flex005/user_avatar/tech-community.robotics.abb.com/lemster68/32/1945_2.png) [@lemster68](https://tech-community.robotics.abb.com/u/lemster68)\
**Post date:** [October 14, 2019, 12:42pm UTC](https://tech-community.robotics.abb.com/t/avoiding-temporary-world-zones-reset/9146/2 "2019-10-14T12:42:08Z")

</div>

Why not use stationary then?

---

<div class="post-metadata">

**Author:** ![soup](https://dub1.discourse-cdn.com/flex005/user_avatar/tech-community.robotics.abb.com/soup/32/1592_2.png) [@soup](https://tech-community.robotics.abb.com/u/soup)\
**Post date:** [October 14, 2019, 3:19pm UTC](https://tech-community.robotics.abb.com/t/avoiding-temporary-world-zones-reset/9146/3 "2019-10-14T15:19:33Z")

</div>

You can enable and disable from a background task – might help with having more control – mentioned in the Rapid manual under wztemporary.

---

<div class="post-metadata">

**Author:** ![Kami](https://dub1.discourse-cdn.com/flex005/user_avatar/tech-community.robotics.abb.com/kami/32/949_2.png) [@Kami](https://tech-community.robotics.abb.com/u/Kami)\
**Post date:** [October 15, 2019, 1:09am UTC](https://tech-community.robotics.abb.com/t/avoiding-temporary-world-zones-reset/9146/4 "2019-10-15T01:09:26Z")

</div>

Hi [@lemster68](https://forums.robotstudio.com/profile/lemster68)  
Thank you for your suggestion. However, I need to free and reactivate world zones when needed, but I can not free a stationary one. Is there way I can modify a stationary wz after it is activated?

---

<div class="post-metadata">

**Author:** ![Kami](https://dub1.discourse-cdn.com/flex005/user_avatar/tech-community.robotics.abb.com/kami/32/949_2.png) [@Kami](https://tech-community.robotics.abb.com/u/Kami)\
**Post date:** [October 15, 2019, 1:35am UTC](https://tech-community.robotics.abb.com/t/avoiding-temporary-world-zones-reset/9146/5 "2019-10-15T01:35:49Z")

</div>

Hi, @soup  
Thank you for your suggestion.  
I forgot to mention that the reason I need to activate and deactivate world zones because the maximum number of world zones is 20 and I need more.  
So I have to modify and redefine and them according to TCP.

---

<div class="post-metadata">

**Author:** ![Kami](https://dub1.discourse-cdn.com/flex005/user_avatar/tech-community.robotics.abb.com/kami/32/949_2.png) [@Kami](https://tech-community.robotics.abb.com/u/Kami)\
**Post date:** [October 15, 2019, 1:47am UTC](https://tech-community.robotics.abb.com/t/avoiding-temporary-world-zones-reset/9146/6 "2019-10-15T01:47:25Z")

</div>

If anyone knows a way to detect pptomain event, I can then call my redefine procedure to solve this problem.

---

<div class="post-metadata">

**Author:** ![graemepaulin](https://avatars.discourse-cdn.com/v4/letter/g/258eb7/32.png) [@graemepaulin](https://tech-community.robotics.abb.com/u/graemepaulin)\
**Post date:** [October 15, 2019, 5:12am UTC](https://tech-community.robotics.abb.com/t/avoiding-temporary-world-zones-reset/9146/7 "2019-10-15T05:12:41Z")

</div>

If you use a WHILE loop in the main routine you can call your world zone routine above this - thus only run when PP to main.

---

<div class="post-metadata">

**Author:** ![Kami](https://dub1.discourse-cdn.com/flex005/user_avatar/tech-community.robotics.abb.com/kami/32/949_2.png) [@Kami](https://tech-community.robotics.abb.com/u/Kami)\
**Post date:** [October 15, 2019, 5:37am UTC](https://tech-community.robotics.abb.com/t/avoiding-temporary-world-zones-reset/9146/8 "2019-10-15T05:37:42Z")

</div>

Thank you @[graemepaulin](https://forums.robotstudio.com/profile/graemepaulin),  
That will work nicely when I run the program, but if the operator pressed pp to main without running the program, and then use jogging mode, the world zones are not activated, so there comes the risk.

---

<div class="post-metadata">

**Author:** ![graemepaulin](https://avatars.discourse-cdn.com/v4/letter/g/258eb7/32.png) [@graemepaulin](https://tech-community.robotics.abb.com/u/graemepaulin)\
**Post date:** [October 15, 2019, 6:03am UTC](https://tech-community.robotics.abb.com/t/avoiding-temporary-world-zones-reset/9146/9 "2019-10-15T06:03:51Z")

</div>

So if program is not running and PP to main pressed the world zones are still reset?

---

<div class="post-metadata">

**Author:** ![Kami](https://dub1.discourse-cdn.com/flex005/user_avatar/tech-community.robotics.abb.com/kami/32/949_2.png) [@Kami](https://tech-community.robotics.abb.com/u/Kami)\
**Post date:** [October 15, 2019, 6:30am UTC](https://tech-community.robotics.abb.com/t/avoiding-temporary-world-zones-reset/9146/10 "2019-10-15T06:30:42Z")

</div>

[@graemepaulin](https://forums.robotstudio.com/profile/graemepaulin)  
Yep, It happens to me, at least on a virtual robot. I have not tried it on a real robot yet. My Robotstudio version is 6.08.

---

<div class="post-metadata">

**Author:** ![lemster68](https://dub1.discourse-cdn.com/flex005/user_avatar/tech-community.robotics.abb.com/lemster68/32/1945_2.png) [@lemster68](https://tech-community.robotics.abb.com/u/lemster68)\
**Post date:** [October 15, 2019, 10:28am UTC](https://tech-community.robotics.abb.com/t/avoiding-temporary-world-zones-reset/9146/11 "2019-10-15T10:28:33Z")

</div>

> [@Kami](#):
>
> Hi, @soup  
> Thank you for your suggestion.  
> I forgot to mention that the reason I need to activate and deactivate world zones because the maximum number of world zones is 20 and I need more.  
> So I have to modify and redefine and them according to TCP.
> 
> With IRC5, there is a function PPMovedInManMode that you can use. You might also be able to use an UNDO handler in your routines. Both might still not help, because I don’t know which will happen first. If the last thing that the controller decides to do is to delete the world zones, then you are boned.

> [@graemepaulin](#):
>
> So if program is not running and PP to main pressed the world zones are still reset?

@graemepaulin

Yes, it is documented that this will occur. I think that I remember you addressing the number of WZ’s before with someone else. Despite the documentation saying 20, it is actually 40?

---

<div class="post-metadata">

**Author:** ![lemster68](https://dub1.discourse-cdn.com/flex005/user_avatar/tech-community.robotics.abb.com/lemster68/32/1945_2.png) [@lemster68](https://tech-community.robotics.abb.com/u/lemster68)\
**Post date:** [October 15, 2019, 4:52pm UTC](https://tech-community.robotics.abb.com/t/avoiding-temporary-world-zones-reset/9146/12 "2019-10-15T16:52:06Z")

</div>

One other thing that you can try is the function IsStopStateEvent(\PPToMain), if you have not already come across that one yet.

---

<div class="post-metadata">

**Author:** ![soup](https://dub1.discourse-cdn.com/flex005/user_avatar/tech-community.robotics.abb.com/soup/32/1592_2.png) [@soup](https://tech-community.robotics.abb.com/u/soup)\
**Post date:** [October 15, 2019, 7:50pm UTC](https://tech-community.robotics.abb.com/t/avoiding-temporary-world-zones-reset/9146/13 "2019-10-15T19:50:08Z")

</div>

Something to test: if you WZEnable from the background task, does PPtoMain in the motion task reset the zones?

---

<div class="post-metadata">

**Author:** ![soup](https://dub1.discourse-cdn.com/flex005/user_avatar/tech-community.robotics.abb.com/soup/32/1592_2.png) [@soup](https://tech-community.robotics.abb.com/u/soup)\
**Post date:** [October 15, 2019, 7:51pm UTC](https://tech-community.robotics.abb.com/t/avoiding-temporary-world-zones-reset/9146/14 "2019-10-15T19:51:54Z")

</div>

@lemster68 That’s a good thought, but wouldn’t protect on a PPtoMain then a manual jog.

---

<div class="post-metadata">

**Author:** ![Kami](https://dub1.discourse-cdn.com/flex005/user_avatar/tech-community.robotics.abb.com/kami/32/949_2.png) [@Kami](https://tech-community.robotics.abb.com/u/Kami)\
**Post date:** [October 16, 2019, 2:16pm UTC](https://tech-community.robotics.abb.com/t/avoiding-temporary-world-zones-reset/9146/15 "2019-10-16T14:16:06Z")

</div>

[@](https://forums.robotstudio.com/profile/soup)[soup](https://forums.robotstudio.com/profile/soup) [@lemster68](https://forums.robotstudio.com/profile/lemster68)  
Thank you guys.  
I had tried setting up more than 20 world zones. And the program stopped on the 21st one.  
I will take WZEnable from the background task as a final try I guess

---

<div class="post-metadata">

**Author:** ![soup](https://dub1.discourse-cdn.com/flex005/user_avatar/tech-community.robotics.abb.com/soup/32/1592_2.png) [@soup](https://tech-community.robotics.abb.com/u/soup)\
**Post date:** [October 16, 2019, 3:54pm UTC](https://tech-community.robotics.abb.com/t/avoiding-temporary-world-zones-reset/9146/16 "2019-10-16T15:54:03Z")

</div>

And, even if PPtoMain in the motion task does reset the zones which were enabled in the background task, you could keep track of which zones should be enabled with a shared PERS bool or signal and quickly re-enable them after the PPtoMain.

---

<div class="post-metadata">

**Author:** ![lemster68](https://dub1.discourse-cdn.com/flex005/user_avatar/tech-community.robotics.abb.com/lemster68/32/1945_2.png) [@lemster68](https://tech-community.robotics.abb.com/u/lemster68)\
**Post date:** [October 16, 2019, 4:26pm UTC](https://tech-community.robotics.abb.com/t/avoiding-temporary-world-zones-reset/9146/17 "2019-10-16T16:26:38Z")

</div>

I still don’t know why you need so many world zones, but maybe this can help you out. You can call these functions as needed to check temp wz’s in given positions.

MODULE WZ\_Check  
LOCAL PERS tooldata tool2:=[TRUE,[[0,270,186.3],[0,0,0,1]],[20,[1.3,38.9,92.4],[1,0,0,0],0,0,0.777]];  
LOCAL PERS wobjdata wobj1:=[FALSE,TRUE,“”,[[0,0,0],[1,0,0,0]],[[0,0,0],[1,0,0,0]]];  
LOCAL VAR shapedata shCheck;  
LOCAL VAR wztemporary wzTempCheck;  
PERS num nCylRadius:=50;  
PERS num nCylHeight:=150;  
PERS pos posBox1C1:=[1299,-110,1350];  
PERS pos posBox1C2:=[1299,-110,1350];  
PERS pos posCyl1:=[1299,-110,1350];

! This function will return a TRUE value if the robot TCP is  
! inside a temporary world zone box.  
FUNC bool fCheckBoxWZ(pos posLow, pos posHigh, tooldata tCheck \wobjdata wobjCheckWZBox)  
VAR robtarget pCheckPos;

tool2 := tCheck;  
IF Present(wobjCheckWZBox) THEN  
wobj1 := wobjCheckWZBox;  
ELSE  
wobj1 := wobj0;  
ENDIF  
WZBoxDef \Inside, shCheck, posLow, posHigh;  
WZFree wzTempCheck;  
WZDoSet \Temp, wzTempCheck \Inside, shCheck, vdoTempPos1, high;  
! Make pCheckPos equal to where the robot is at the moment.  
pCheckPos := CRobT(\Tool:=tool2\WObj:=wobj1);  
! Move robot to where it already is to make the necessary TCP active  
MoveJ pCheckPos, v500, fine, tool2\WObj:=wobj1;  
IF DOutput(vdoTempPos1) = 1 THEN  
RETURN TRUE;  
ELSE  
RETURN FALSE;  
ENDIF  
ENDFUNC

! This function will return a TRUE value if the robot TCP is  
! inside a temporary world zone cylinder.  
FUNC bool fCheckCylWZ(pos posOrigin, num nRadius, num nHeight, tooldata tCheck \wobjdata wobjCheckWZBox)  
VAR robtarget pCheckPos;

tool2 := tCheck;  
IF Present(wobjCheckWZBox) THEN  
wobj1 := wobjCheckWZBox;  
ELSE  
wobj1 := wobj0;  
ENDIF  
WZCylDef \Inside, shCheck, posOrigin, nRadius, nHeight;  
WZFree wzTempCheck;  
WZDoSet \Temp, wzTempCheck \Inside, shCheck, vdoTempPos1, high;  
! Make pCheckPos equal to where the robot is at the moment.  
pCheckPos := CRobT(\Tool:=tool2\WObj:=wobj1);  
! Move robot to where it already is to make the necessary TCP active  
MoveJ pCheckPos, v500, fine, tool2\WObj:=wobj1;  
IF DOutput(vdoTempPos1) = 1 THEN  
RETURN TRUE;  
ELSE  
RETURN FALSE;  
ENDIF  
ENDFUNC  
ENDMODULE

---

<div class="post-metadata">

**Author:** ![Kami](https://dub1.discourse-cdn.com/flex005/user_avatar/tech-community.robotics.abb.com/kami/32/949_2.png) [@Kami](https://tech-community.robotics.abb.com/u/Kami)\
**Post date:** [October 17, 2019, 1:52pm UTC](https://tech-community.robotics.abb.com/t/avoiding-temporary-world-zones-reset/9146/18 "2019-10-17T13:52:31Z")

</div>

Thank you very much. [@](https://forums.robotstudio.com/profile/soup)[soup](https://forums.robotstudio.com/profile/soup) [@lemster68](https://forums.robotstudio.com/profile/lemster68)  
The reason I need this is that my project is like carrying books into a grid like shelf. The project requires unprofessional operators to jog the robot.  
And the ABB robot(760) is a four axis robot which does not support collision avoidance. So, I was trying to set up world zones only that are close to TCP.

---

<div class="post-metadata">

**Author:** ![EricH](https://avatars.discourse-cdn.com/v4/letter/e/ea5d25/32.png) [@EricH](https://tech-community.robotics.abb.com/u/EricH)\
**Post date:** [October 19, 2019, 9:10am UTC](https://tech-community.robotics.abb.com/t/avoiding-temporary-world-zones-reset/9146/19 "2019-10-19T09:10:43Z")

</div>

This is maybe a bit off topic, but: How can you avoid the reset of a _ **stationary** _ worldzone signal after a restart? Cross connect?

---

<div class="post-metadata">

**Author:** ![Kami](https://dub1.discourse-cdn.com/flex005/user_avatar/tech-community.robotics.abb.com/kami/32/949_2.png) [@Kami](https://tech-community.robotics.abb.com/u/Kami)\
**Post date:** [October 19, 2019, 10:37am UTC](https://tech-community.robotics.abb.com/t/avoiding-temporary-world-zones-reset/9146/20 "2019-10-19T10:37:03Z")

</div>

[@EricH](https://forums.robotstudio.com/profile/EricH)  
I use a PowerON event routine to set up my stationary worldzones, so the stationary worldzones are active all the time.

 ![image.png](https://europe1.discourse-cdn.com/flex005/uploads/robotics1/original/2X/b/b8d5006618c127653c1c4611a74d0d5177aa993d.png)

[Next page](https://tech-community.robotics.abb.com/t/avoiding-temporary-world-zones-reset/9146.md?page=2)
